Erik Dubbelboer
1ceb192a9b
Remove stripTrailingSlashes
...
It was unused.
2026-03-16 02:30:39 +01:00
Erik Dubbelboer
1d3c69196c
Honor Root for fs.FS and normalize fs-style roots ( #2145 )
...
- Apply `fs.Root` in non-`os.FS` path resolution.
- Normalize `fs.FS` roots (`./`, trailing slash, leading slash, separators).
- Handle `PathRewrite` outputs without a leading slash.
- Add tests for `MapFS` and `DirFS` root enforcement.
2026-02-22 18:15:07 +01:00
Erik Dubbelboer
c2b317d47d
Go 1.26 and golangci-lint updates ( #2146 )
...
Keep Go 1.24 compatibility for now (by not using `wg.Go()`).
2026-02-21 10:28:39 +01:00
Erik Dubbelboer
1828bd4eee
Optimize fs to have 0 allocations ( #2052 )
...
When using caching fs shouldn't cause any allocations.
Only do []byte to string conversions when really needed. When a file is
already cached the conversion shouldn't be needed.
Fixes https://github.com/valyala/fasthttp/issues/2045
2025-08-10 00:06:11 +02:00
Ivan Gabaldon
8e25db024a
fix: compression priority ( #1950 )
...
* Initial update
* update remaining tests
* update .gitignore
* update another test, fix linting
* fix tests
* add missing Vary header
2025-02-12 14:58:38 +09:00
Erik Dubbelboer
c3050516d9
Fix lint and security issues
...
gosec was failing after the last update introduced some new checks.
2024-09-07 15:22:05 +02:00
newacorn
b0ea03f70a
Fix Different request paths share the same fs cache is some cases. ( #1843 )
...
Currently, the implementation may result in shared fs cache between requests for dir and dir/.
2024-08-31 14:21:51 +02:00
newacorn
d29a2b90a6
Add a dedicated cache container for the zstd compression algorithm ( #1828 )
...
Add a dedicated cache container for the zstd compression algorithm to prevent discrepancies between the response content and the implied Content-Encoding in certain scenarios.Fix: https://github.com/valyala/fasthttp/issues/1827#issue-2459271452
2024-08-20 23:25:02 +02:00
Juan Calderon-Perez
1fb3453165
Use Named Fields and Align Structures to Reduce Memory Usage ( #1814 )
...
* Use Named fields and Align Structures to Reduce Memory Usage
* Remove extra spaces
2024-08-02 22:26:52 +02:00
Kashiwa
86c7e844f4
Optimize struct field order to reduce memory usage ( #1809 )
...
1. Reduce RequestHeader from 368 bytes to 360 bytes
2. Reduce Request from 816 bytes to 800 bytes
3. Reduce Response from 432 bytes to 416 bytes
4. Reduce Client from 312 bytes to 288 bytes
5. Reduce HostClient from 416 bytes to 392 bytes
6. Reduce PipelineClient from 176 bytes to 168 bytes
7. Reduce pipelineConnClient from 216 bytes to 208 bytes
8. Reduce Cookie from 232 bytes to 224 bytes
9. Reduce FS from 184 bytes to 160 bytes
10. Reduce fsHandler from 168 bytes to 160 bytes
11. Reduce ResponseHeader from 328 bytes to 320 bytes
12. Reduce headerScanner from 128 bytes to 120 bytes
13. Reduce TCPDialer from 104 bytes to 96 bytes
14. Reduce workerPool from 152 btyes to 144 btyes
2024-07-20 19:20:26 +02:00
M. Efe Çetin
ee34656bec
fs: fix openIndexFile when dirPath is empty string ( #1779 )
2024-05-19 15:11:58 +02:00
M. Efe Çetin
aadadb913a
fs: fix GenerateIndexPages when DirFS or embed.FS is used ( #1778 )
2024-05-18 10:30:01 +02:00
Limux
091733b08e
Implemented what was described by me in #1766 . ( #1767 )
...
* Implemented what was described by me in issue#1766.
* fixed linting isssues in fs.go with gofmt -e -d -s
---------
Co-authored-by: Raphael Habichler <raphael.habichler@bmd.at >
2024-04-29 21:37:39 +02:00
Oleksandr Redko
bbc7bd04e2
refactor: rename error local variables ( #1738 )
2024-03-25 14:30:27 +01:00
Oleksandr Redko
3166afd835
Enable few gocritic checks; fix up issues ( #1728 )
2024-03-02 16:19:05 +01:00
Co1a
5f81476d7c
feat:support zstd compress and uncompressed ( #1701 )
...
* feat:support zstd compress and uncompressed
* fix:real & stackless write using different pool to avoid get stackless.writer
* fix:zstd normalize compress level
* Change empty string checks to be more idiomatic (#1684 )
* chore:lint fix and rebase with master
* chore:remove 1.18 test & upgrade compress version
* fix:error default compress level
* Fix lint
---------
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
2024-02-21 07:21:52 +01:00
Oleksandr Redko
190204cf1a
Upgrade golangci-lint to v1.56.2; fix gocritic issues ( #1722 )
2024-02-21 05:51:28 +01:00
Oleksandr Redko
28615eba55
Change empty string checks to be more idiomatic ( #1684 )
2024-01-04 15:05:38 +01:00
Oleksandr Redko
9d6b470260
chore: Add missing dots at the end of comments ( #1677 )
2023-12-13 13:56:24 +08:00
Oleksandr Redko
12949de784
chore: Set max line length to 130 characters ( #1676 )
2023-12-05 19:49:41 +01:00
Oleksandr Redko
8ecfc989d9
Enable dupword, unconvert linters ( #1658 )
2023-11-12 16:42:39 +01:00
Tiago Peczenyj
dfce853067
Skip fs cache based on config ( #1644 )
...
* add cache manager struce
* refactor cache by adding interface
* generalize ctor
* implement feature add unit tests
* fix code
* rename fs field as filesystem
2023-11-05 19:31:04 +01:00
Tiago Peczenyj
4010b16eef
Add support to fs.fs on serve static files ( #1640 )
...
* substitute *os.File by fs.File
* refactor error handling by using the new recommended form
* finish implementation
* substitute seek(offset,0) by seek(offset, io.SeekStart)
* add unit test
* use io.SeekStart on Seek method
2023-11-05 14:46:42 +01:00
leonklingele
f0865d4aab
fs: fix race condition on global map ( #1565 )
...
* fs: fix race condition on global map
Previously, when creating multiple FS instances with a non-empty
"CompressedFileSuffix" field concurrently, a data race on the global
"FSCompressedFileSuffixes" might occur.
This was found in fiber, probably the largest web framework based on fasthttp:
git clone https://github.com/gofiber/fiber.git && cd fiber
git checkout 182f9f09705eab40c61a618835d46faee79c1e49
go test -v -race -run Test_App_Static_Prefix_*
=== RUN Test_App_Static_Prefix_Wildcard
=== PAUSE Test_App_Static_Prefix_Wildcard
=== RUN Test_App_Static_Prefix
=== PAUSE Test_App_Static_Prefix
=== CONT Test_App_Static_Prefix
=== CONT Test_App_Static_Prefix_Wildcard
==================
WARNING: DATA RACE
Write at 0x00c0001b1c50 by goroutine 7:
runtime.mapassign_faststr()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/runtime/map_faststr.go:203 +0x0
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2c4
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x84
github.com/gofiber/fiber/v2.Test_App_Static_Prefix_Wildcard()
/home/leon/code/fiber/app_test.go:1017 +0x5c
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Previous write at 0x00c0001b1c50 by goroutine 8:
runtime.mapassign_faststr()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/runtime/map_faststr.go:203 +0x0
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2c4
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x84
github.com/gofiber/fiber/v2.Test_App_Static_Prefix()
/home/leon/code/fiber/app_test.go:1042 +0x59
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Goroutine 7 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
Goroutine 8 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
==================
==================
WARNING: DATA RACE
Write at 0x00c0001f43e8 by goroutine 7:
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2d3
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x84
github.com/gofiber/fiber/v2.Test_App_Static_Prefix_Wildcard()
/home/leon/code/fiber/app_test.go:1017 +0x5c
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Previous write at 0x00c0001f43e8 by goroutine 8:
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2d3
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x84
github.com/gofiber/fiber/v2.Test_App_Static_Prefix()
/home/leon/code/fiber/app_test.go:1042 +0x59
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Goroutine 7 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
Goroutine 8 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
==================
==================
WARNING: DATA RACE
Read at 0x00c0001f43f8 by goroutine 7:
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:435 +0x344
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x84
github.com/gofiber/fiber/v2.Test_App_Static_Prefix_Wildcard()
/home/leon/code/fiber/app_test.go:1017 +0x5c
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Previous write at 0x00c0001f43f8 by goroutine 8:
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:435 +0x38c
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x84
github.com/gofiber/fiber/v2.Test_App_Static_Prefix()
/home/leon/code/fiber/app_test.go:1042 +0x59
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Goroutine 7 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
Goroutine 8 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
==================
==================
WARNING: DATA RACE
Read at 0x00c0001b1c50 by goroutine 11:
runtime.mapaccess1_faststr()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/runtime/map_faststr.go:13 +0x0
github.com/valyala/fasthttp.(*fsHandler).newFSFile()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:1329 +0xec
github.com/valyala/fasthttp.(*fsHandler).openFSFile()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:1317 +0x7c9
github.com/valyala/fasthttp.(*fsHandler).handleRequest()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:865 +0x846
github.com/valyala/fasthttp.(*fsHandler).handleRequest-fm()
<autogenerated>:1 +0x44
github.com/gofiber/fiber/v2.(*App).registerStatic.func3()
/home/leon/code/fiber/router.go:403 +0x15e
github.com/gofiber/fiber/v2.(*App).next()
/home/leon/code/fiber/router.go:144 +0x50b
github.com/gofiber/fiber/v2.(*App).handler()
/home/leon/code/fiber/router.go:171 +0xf2
github.com/gofiber/fiber/v2.(*App).handler-fm()
<autogenerated>:1 +0x44
github.com/valyala/fasthttp.(*Server).serveConn()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/server.go:2365 +0x1b4a
github.com/valyala/fasthttp.(*Server).ServeConn()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/server.go:2035 +0x10f
github.com/gofiber/fiber/v2.(*App).Test.func1()
/home/leon/code/fiber/app.go:934 +0xd8
Previous write at 0x00c0001b1c50 by goroutine 7:
runtime.mapassign_faststr()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/runtime/map_faststr.go:203 +0x0
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:435 +0x37d
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x84
github.com/gofiber/fiber/v2.Test_App_Static_Prefix_Wildcard()
/home/leon/code/fiber/app_test.go:1017 +0x5c
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Goroutine 11 (running) created at:
github.com/gofiber/fiber/v2.(*App).Test()
/home/leon/code/fiber/app.go:926 +0x645
github.com/gofiber/fiber/v2.Test_App_Static_Prefix()
/home/leon/code/fiber/app_test.go:1045 +0xba
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Goroutine 7 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
==================
==================
WARNING: DATA RACE
Write at 0x00c0001b1c50 by goroutine 8:
runtime.mapassign_faststr()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/runtime/map_faststr.go:203 +0x0
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2c4
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x2c6
github.com/gofiber/fiber/v2.Test_App_Static_Prefix()
/home/leon/code/fiber/app_test.go:1051 +0x29b
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Previous write at 0x00c0001b1c50 by goroutine 7:
runtime.mapassign_faststr()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/runtime/map_faststr.go:203 +0x0
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2c4
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x2c9
github.com/gofiber/fiber/v2.Test_App_Static_Prefix_Wildcard()
/home/leon/code/fiber/app_test.go:1026 +0x29b
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Goroutine 8 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
Goroutine 7 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
==================
==================
WARNING: DATA RACE
Write at 0x00c0001f43e8 by goroutine 8:
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2d3
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x2c6
github.com/gofiber/fiber/v2.Test_App_Static_Prefix()
/home/leon/code/fiber/app_test.go:1051 +0x29b
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Previous write at 0x00c0001f43e8 by goroutine 7:
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2d3
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x2c9
github.com/gofiber/fiber/v2.Test_App_Static_Prefix_Wildcard()
/home/leon/code/fiber/app_test.go:1026 +0x29b
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Goroutine 8 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
Goroutine 7 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
==================
==================
WARNING: DATA RACE
Read at 0x00c0001f43f8 by goroutine 8:
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:435 +0x344
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x2c6
github.com/gofiber/fiber/v2.Test_App_Static_Prefix()
/home/leon/code/fiber/app_test.go:1051 +0x29b
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Previous write at 0x00c0001f43f8 by goroutine 7:
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:435 +0x38c
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x2c9
github.com/gofiber/fiber/v2.Test_App_Static_Prefix_Wildcard()
/home/leon/code/fiber/app_test.go:1026 +0x29b
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Goroutine 8 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
Goroutine 7 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
==================
==================
WARNING: DATA RACE
Write at 0x00c0001b1c50 by goroutine 8:
runtime.mapassign_faststr()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/runtime/map_faststr.go:203 +0x0
github.com/valyala/fasthttp.(*FS).initRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:434 +0x2c4
github.com/valyala/fasthttp.(*FS).initRequestHandler-fm()
<autogenerated>:1 +0x39
sync.(*Once).doSlow()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:74 +0x101
sync.(*Once).Do()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/sync/once.go:65 +0x46
github.com/valyala/fasthttp.(*FS).NewRequestHandler()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:389 +0x9bb
github.com/gofiber/fiber/v2.(*App).registerStatic()
/home/leon/code/fiber/router.go:396 +0x984
github.com/gofiber/fiber/v2.(*App).Static()
/home/leon/code/fiber/app.go:762 +0x4f0
github.com/gofiber/fiber/v2.Test_App_Static_Prefix()
/home/leon/code/fiber/app_test.go:1060 +0x4c5
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
Previous read at 0x00c0001b1c50 by goroutine 20:
runtime.mapaccess1_faststr()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/runtime/map_faststr.go:13 +0x0
github.com/valyala/fasthttp.(*fsHandler).newFSFile()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:1329 +0xec
github.com/valyala/fasthttp.(*fsHandler).openFSFile()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:1317 +0x7c9
github.com/valyala/fasthttp.(*fsHandler).handleRequest()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/fs.go:865 +0x846
github.com/valyala/fasthttp.(*fsHandler).handleRequest-fm()
<autogenerated>:1 +0x44
github.com/gofiber/fiber/v2.(*App).registerStatic.func3()
/home/leon/code/fiber/router.go:403 +0x15e
github.com/gofiber/fiber/v2.(*App).next()
/home/leon/code/fiber/router.go:144 +0x50b
github.com/gofiber/fiber/v2.(*App).handler()
/home/leon/code/fiber/router.go:171 +0xf2
github.com/gofiber/fiber/v2.(*App).handler-fm()
<autogenerated>:1 +0x44
github.com/valyala/fasthttp.(*Server).serveConn()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/server.go:2365 +0x1b4a
github.com/valyala/fasthttp.(*Server).ServeConn()
/home/leon/go/pkg/mod/github.com/valyala/fasthttp@v1.47 .0/server.go:2035 +0x10f
github.com/gofiber/fiber/v2.(*App).Test.func1()
/home/leon/code/fiber/app.go:934 +0xd8
Goroutine 8 (running) created at:
testing.(*T).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x805
testing.runTests.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2036 +0x8d
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.runTests()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:2034 +0x87c
testing.(*M).Run()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1906 +0xb44
main.main()
_testmain.go:871 +0x2e9
Goroutine 20 (finished) created at:
github.com/gofiber/fiber/v2.(*App).Test()
/home/leon/code/fiber/app.go:926 +0x645
github.com/gofiber/fiber/v2.Test_App_Static_Prefix_Wildcard()
/home/leon/code/fiber/app_test.go:1028 +0x304
testing.tRunner()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1576 +0x216
testing.(*T).Run.func1()
/nix/store/8v5zwymidmry0wd3lhj6zggskzsvqrfk-go-1.20.4/share/go/src/testing/testing.go:1629 +0x47
==================
testing.go:1446: race detected during execution of test
--- FAIL: Test_App_Static_Prefix_Wildcard (0.03s)
=== NAME Test_App_Static_Prefix
testing.go:1446: race detected during execution of test
--- FAIL: Test_App_Static_Prefix (0.03s)
FAIL
exit status 1
FAIL github.com/gofiber/fiber/v2 0.050s
* Update fs.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
---------
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
2023-05-24 12:29:42 +02:00
Moritz Poldrack
d0f2727a4d
get rid of some panics ( #1526 )
...
* client: simplify (*HostClient).do()
Remove an allocation in favour of deferring a call to release the
response.
* client: remove panic in dialAddr
Return an error instead of panicking if the user supplied a nonsensical
DialFunc.
* compression: remove panic on invalid compression level
If a compression level exceeding gzip's boundaries is provided, fasthttp
will panic. Instead it would be better to handle this error for them by
limiting it to the minimum or maximum value, depending on the direction
the user has exceeded the limits.
Clamp the value of gzip to always be between gzip.BestSpeed and
gzip.BestCompression.
* peripconn: remove panic on negative connection count
When a negative count is reached when unregistering a connection, a
panic is caused even though data-integrity is not at risk.
Replace the panic() with a simple clamp on the value to ensure the
value does not exceed it's expected lower bounds.
References: #1504
* compress: remove error on failed nonblocking writes
Since there is no way of handling or even logging non-critical errors in
stateless non-blocking writecalls, just drop them and hope the user
notices and tries again.
* workerPool: remove panic on redundant Start and Stop calls
Instead of panicking for invalid behaviour, it's preferable to just turn
the function into a noop.
* http: remove panic on invalid form boundary
* http: remove panic on negative reads
Since bufio already panics on negative reads, it is not necessary to do
so as well. If the length is zero and for some reason no error is
returned, readBodyIdentity and appendBodyFixedSize now errors in these
cases.
Link: https://github.com/golang/go/blob/851f6fd61425c810959c7ab51e6dc86f8a63c970/src/bufio/bufio.go#L246
* fs: remove panic on negative reader count
When a negative count is reached when unregistering a reader, a panic is
thrown even though data-integrity is not at risk.
Replace the panic() with a simple clamp on the value to ensure the
value does not exceed it's expected lower bounds.
* server: remove panic in favour of a segfault
Panicking with "BUG: " obscures the error. As the segfault causes a
panic anyway, just let the chaos unfold.
* server: remove panic in favour of returning an error
Writing on a timed-out response is not endangering data integrity and
just fails.
* chore: add comments to all panics
* chore: fix minor typo
2023-03-30 03:38:28 +02:00
Oleksandr Redko
e15a810a98
docs: fix grammar issues and typos in comments ( #1492 )
2023-02-13 10:43:44 +08:00
Oleksandr Redko
934f04e330
Refactor golangci-lint config and remove redundant nolints ( #1486 )
...
* Refactor golangci-lint config
- Use golangci-lint-action for GitHub workflow.
- Add additional golangci-lint run options.
- Remove unused nolint directives.
* Revert exclude-use-default option
2023-02-11 15:35:15 +08:00
Erik Dubbelboer
dbf457ee66
Revert "feat: support mulit/range ( #1398 )" ( #1446 )
...
This reverts commit a468a7dd37 .
2022-11-28 11:52:30 +01:00
byene0923
a468a7dd37
feat: support mulit/range ( #1398 )
...
* feat: support mulit/range
* fix:
1. lint code
2. add SetByteRanges method
* fix: reduce the test number of testFSSingleByteRange
2022-10-30 09:48:46 +01:00
Aoang
a696949f6c
Deprecate Go 1.15 ( #1379 )
...
* Dropping support for 1.15.
* Replaces Go 1.16 Deprecated functions
* Update test build flag
* Fix import sort and comment
* Update github.com/klauspost/compress to v1.15.9
https://github.com/klauspost/compress improved performance and changed Minimum version is 1.16, this should be the final supported release for Go 1.16 (https://github.com/klauspost/compress/commit/6d0019a95afa3221f7522d1f2eed0033b5e79470 ) .
2022-09-15 22:28:25 +03:00
Aoang
ea6052464e
Add Go 1.19 Support ( #1355 )
...
* Update Go Version to Go1.19.x And add cache
* Fix CI Line endings
* Update test CI Go Version to Go1.19.x And add cache
* Update Gosec Security Scanner CI to securego/gosec@v2.12 .0
* Format comment
Go 1.19 adds support for links, lists, and clearer headings in doc comments. As part of this change, gofmt now reformats doc comments to make their rendered meaning clearer. See “Go Doc Comments” for syntax details and descriptions of common mistakes now highlighted by gofmt. As another part of this change, the new package go/doc/comment provides parsing and reformatting of doc comments as well as support for rendering them to HTML, Markdown, and text.
ref: https://tip.golang.org/doc/go1.19
ref: https://tip.golang.org/doc/comment
* Fix doc structure
2022-08-14 11:31:57 +02:00
mojatter
f3513ccc59
Introduce FS.CompressRoot ( #1331 )
...
* Introduce FS.CompressRoot
* Avoid duplicated filepath.FromSlash
* Introduce filePathToCompressed
* Revert openIndexFile manually
* Join root and path, and then calls filepath.FromSlash
2022-07-10 10:07:18 +02:00
Sergey Ponomarev
c9f43eaa1b
Response.ContentEncoding(): store as field and avoid using Header.SetCanonical() ( #1311 )
...
* Response.ContentEncoding(): store as field
The CE is not so often used for plain APIs responses and even not so often used for static files and on the fly compression.
But still it should be checked each time.
Also having a dedicated field getter and setter simplifies code
* header.go Use shorter Response.setNonSpecial() and Request.setNonSpecial() methods instead of SetCanonical()
The change should improve performance because the setSpecialHeader() call is omitted.
As a downside on adding a new basic header field all putHeader() must be replaced with a direct getter and setter.
2022-06-05 15:47:59 +02:00
RW
66bc61ee64
Add an option to allow empty root in the fsHandler ( #1299 )
...
* Add an option to allow empty root in the fsHandler
this is necessary to restore the capabilities before the commit https://github.com/valyala/fasthttp/commit/c7576cc10cabfc9c993317a2d3f8355497bea156
and to allow further functionality to be docked from the outside which is not affected by setting the root dir afterwards
https://github.com/gofiber/fiber/pull/1882#issuecomment-1120832500
* Add an option to allow empty root in the fsHandler
this is necessary to restore the capabilities before the commit https://github.com/valyala/fasthttp/commit/c7576cc10cabfc9c993317a2d3f8355497bea156
and to allow further functionality to be docked from the outside which is not affected by setting the root dir afterwards
https://github.com/gofiber/fiber/pull/1882#issuecomment-1120832500
* Update fs.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
* Update fs.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
2022-05-16 12:33:47 +02:00
Mauro Leggieri
c7576cc10c
Added Windows support and removed some panics ( #1264 )
2022-04-09 15:38:51 +02:00
Erik Dubbelboer
7a5afddf5b
Use %v for errors and %q for strings ( #1262 )
...
Mostly in tests.
2022-04-01 18:11:16 +02:00
Erik Dubbelboer
15262ecf3c
Warn about unsafe ServeFile usage ( #1228 )
...
See: https://github.com/valyala/fasthttp/issues/1226
2022-03-03 08:51:13 +01:00
Erik Dubbelboer
e9db537178
Use %w to wrap errors ( #1175 )
2021-12-13 09:41:34 +01:00
Erik Dubbelboer
931d0a4523
Fix lint
2021-11-04 13:24:40 +01:00
halst
d613502912
use sync.map is better ( #1145 )
...
* use sync.map is better
* Use LoadOrStore
2021-11-04 13:01:58 +01:00
Erik Dubbelboer
3cec26d42d
Allow stopping FS handler cleanup gorountine ( #942 )
...
* Allow stopping FS handler cleanup gorountine
* CleanStop
2021-02-06 10:22:14 +01:00
hex0x00
805af0ee73
Brotli support in FS handler. ( #880 )
...
* Add files via upload
* Update fs.go
* Add files via upload
* Update fs_test.go
2020-09-28 17:14:28 +02:00
Erik Dubbelboer
380f00bfdb
Fixed bug which prevents cached FS files from being updated
...
Bug was introduced in previous "Fixed recompressing of stale files"
commit.
2020-06-12 21:47:32 +02:00
Erik Dubbelboer
2f28edba01
Fixed recompressing of stale files
2020-06-07 11:54:40 +02:00
RW
853abb31af
🐞 panic in fs.go #824 ( #825 )
...
Co-authored-by: wernerr <rene.werner@verivox.com >
2020-06-04 16:53:47 +02:00
Moritz Marquardt
5bd1b0cf2c
Make FS return a redirect for directories without trailing slash ( #802 )
...
* Make FS return a redirect for directories without trailing slash
Fixes #792
* Add a test for the directory redirect
* Fix directory redirects for ServeFile
* Fix error message
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
2020-05-18 18:30:13 +02:00
Erik Dubbelboer
32793db72d
Run golangci-lint using a Github Action
2019-11-16 18:09:28 +01:00
Shulhan
9574c37fb8
Various changes regarding code readibility ( #523 )
...
* all: use sort.Strings when applicable
Basically, sort.Strings is the shortcut of Sort(StringSlice(a)) but its
more readable.
* all: replace string(bytes.Buffer.Bytes()) with bytes.Buffer.String()
Although its only occured on test files, it may be worth to simplified it.
* http_test: simplify strings.Index with strings.Contains
Both have the same O(n), but strings.Contains more readable on
if-condition.
* args: simplify if-condition check on boolean value
* all: simplify variable initialization
If we assign the variable after declaring it, we can simplify it using
":=" operator or "= value".
The reader can still known the type of variable from the struct name or
variable type before assignment operator.
2019-02-02 11:13:33 +00:00
Shulhan
4c53f113c5
all: pre-allocated slice with possible known size
...
This fix is based on suggestion of "prealloc" static analysis tool [1].
Per note of the tool's author suggestion, its recommended to allocate the
slice length/capability, if we known their possible size. This is to
minimize "append" to re-allocate the slice underlying array.
[1] https://github.com/alexkohler/prealloc
2019-01-30 20:42:28 +01:00
Erik Dubbelboer
d4f0cf56d8
Remove fasthttp.ByteBuffer
...
As advertised in https://github.com/valyala/fasthttp/commit/b5f96d4b4120bb1e09c23ac32baf21a14da4a71d
2018-10-01 14:15:29 +08:00