Age | Commit message (Collapse) | Author | Files | Lines |
|
* 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>
|
|
|
|
|
|
* 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>
|
|
|
|
|
|
|
|
|
|
|
|
* add cache manager struce
* refactor cache by adding interface
* generalize ctor
* implement feature add unit tests
* fix code
* rename fs field as filesystem
|
|
* 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
|
|
* 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>
|
|
* 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
|
|
|
|
* 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
|
|
This reverts commit a468a7dd3734d9866ef6ab8ee1e36695f5c3b09c.
|
|
* feat: support mulit/range
* fix:
1. lint code
2. add SetByteRanges method
* fix: reduce the test number of testFSSingleByteRange
|
|
* 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) .
|
|
* 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
|
|
* Introduce FS.CompressRoot
* Avoid duplicated filepath.FromSlash
* Introduce filePathToCompressed
* Revert openIndexFile manually
* Join root and path, and then calls filepath.FromSlash
|
|
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.
|
|
* 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>
|
|
|
|
Mostly in tests.
|
|
See: https://github.com/valyala/fasthttp/issues/1226
|
|
|
|
|
|
* use sync.map is better
* Use LoadOrStore
|
|
* Allow stopping FS handler cleanup gorountine
* CleanStop
|
|
* Add files via upload
* Update fs.go
* Add files via upload
* Update fs_test.go
|
|
Bug was introduced in previous "Fixed recompressing of stale files"
commit.
|
|
|
|
Co-authored-by: wernerr <rene.werner@verivox.com>
|
|
* 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>
|
|
|
|
* 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.
|
|
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
|
|
As advertised in https://github.com/valyala/fasthttp/commit/b5f96d4b4120bb1e09c23ac32baf21a14da4a71d
|
|
Fixes #417
|
|
|
|
Signed-off-by: Kirill Danshin <k@guava.by>
|
|
See https://github.com/erikdubbelboer/fasthttp/pull/10
|
|
|
|
Previously each concurrent compression could allocate huge compression state
with the size up to 1Mb each. So 10K concurrent connections could result in
10Gb of compression state in the heap.
This CL limits the number of compression states among concurrent requests
when {Append,Write}{Gzip,Deflate}* functions are called to O(GOMAXPROCS).
These functions are used by CompressHandler* for non-streaming responses,
i.e. it should cover the majority of use cases.
Memory usage for 10K concurrent connections that compress responses drops
from 10Gb to 200Mb after this CL.
|
|
https://github.com/klauspost/compress/issues/64 is fixed"
The original issue has been fixed, so reverting.
This reverts commit 2f4876aaf2b591786efc9b49f34b86ad44c25074.
|
|
https://github.com/klauspost/compress/issues/64 is fixed
|
|
github.com/klauspost/compress/*"
According to @klauspost, his packages are still faster than the standard packages.
See https://github.com/valyala/fasthttp/commit/a98191f43560ea2ddbbf848c1c727daeed2e39ae#commitcomment-19409416
for details.
This reverts commit a98191f43560ea2ddbbf848c1c727daeed2e39ae.
|
|
The reasons are:
- @klauspost optimized standard packages in go1.7+
- This removes an external dependency from fasthttp
|
|
The bug raises when io.Writer passed to fsSmallFileReader.WriteTo
doesn't support ReadFrom interface.
|
|
FSHandlerCacheDuration documentation
|