newacorn
a1db411cc2
StreamRequestBody shouldn't read more data than actual need. ( #1819 )
...
* The StreamRequestBody should not read content beyond what is required.
The StreamRequestBody feature on the server side should not read content that does not belong to the current request body.This is more logical and consistent with the result of not using the StreamRequestBody feature.Fixes: https://github.com/valyala/fasthttp/issues/1816 .
* Update server_test.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
* Update http.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
---------
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
2024-08-11 15:35:28 +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
Erik Dubbelboer
2909827c57
Fix another flaky test
2024-06-02 12:29:30 +02:00
Oleksandr Redko
9c3915b1fc
test: remove redundant error check ( #1741 )
2024-03-28 21:34:02 +01:00
Oleksandr Redko
190204cf1a
Upgrade golangci-lint to v1.56.2; fix gocritic issues ( #1722 )
2024-02-21 05:51:28 +01:00
mopeneko
b430b88e78
Implement GetRejectedConnectionsCount function ( #1704 )
...
* Implement `GetRejectedConnectionsCount`
* Implement test for `GetRejectedConnectionsCount`
2024-02-10 10:26:36 +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
f196617f55
chore: Use 'any' instead of 'interface{}' ( #1666 )
...
gofmt -w -r "interface{} -> any" -l .
2023-11-24 11:33:04 +01:00
Oleksandr Redko
d3397c64ed
Enable wastedassign, whitespace linters; fix issues ( #1665 )
2023-11-24 11:32:11 +01:00
Oleksandr Redko
4ec5c5a774
docs: fix typos in comments and tests
2023-08-30 14:13:13 +02:00
AutumnSun
0d0bbfee5a
Auto add 'Vary' header after compression ( #1585 )
...
* Auto add 'Vary' header after compression
Add config `SetAddVaryHeaderForCompression` to enable
'Vary: Accept-Encoding' header when compression is used.
* feat: always set the Vary header
* create and use `ResponseHeader.AddVaryBytes`
* not export 'AddVaryBytes'
2023-07-02 12:40:26 +02:00
Oleksandr Redko
ffdf59d04c
Enable gofumpt linter; format code gofumpt -w . ( #1576 )
2023-06-13 15:18:59 +02:00
Erik Dubbelboer
829f5b2445
Don't run test that times out often in parallel
2023-05-23 10:14:50 +02:00
Erik Dubbelboer
fa72f3cc39
Fix tests ( #1552 )
2023-05-07 14:32:14 +02:00
Oleksandr Redko
1dcf56222d
test: refactor to use WriteString ( #1546 )
2023-04-28 17:39:58 +02:00
Oleksandr Redko
498a814fbf
test: fix typos in function, error message, comment ( #1512 )
2023-03-06 16:55:21 +01:00
Oleksandr Redko
4ca6994c93
test: use Fprintf to simplify writing headers ( #1510 )
2023-03-06 11:13:37 +01:00
Oleksandr Redko
5147cecec7
docs: replace links to golang.org with go.dev ( #1489 )
...
- Replace https://godoc.org with https://pkg.go.dev .
- Replace https://golang.org with https://go.dev .
- Replace https://golang.org/pkg with https://pkg.go.dev .
- Replace https://blog.golang.org with https://go.dev/blog .
- Use https://pkg.go.dev/golang.org/x/net/http2 instead of non-existing https://http2.golang.org/ .
- Remove trailing slashes.
2023-02-11 19:59:44 +08:00
Oleksandr Redko
f84e2346ba
Rename unexported funcs, vars to match common Go ( #1488 )
...
See https://github.com/golang/go/wiki/CodeReviewComments#initialisms
and https://go.dev/doc/effective_go#mixed-caps
2023-02-10 21:34:49 +08:00
Oleksandr Redko
c0c5f9cd38
doc,test: correct typos ( #1484 )
2023-02-09 09:29:28 +01:00
Sergey Ponomarev
434022b461
server.go Simplify default Server name logic ( #1467 )
...
The serverName atomic.Value field is used as a cache. This is not needed and logic can be simplified.
See related #1458
2023-01-06 04:55:09 +01:00
kinggo
b788e663c6
feat: support custom formvalue function ( #1453 )
2022-12-25 09:37:49 +01:00
kinggo
49951353c8
feat: add ShutdownWithContext ( #1383 )
2022-11-20 13:26:36 +02:00
pj
d404f2db91
make RequestCtx's userdata accept keys that are of type: interface{} ( #1387 )
...
Co-authored-by: rocketlaunchr-cto <rocketlaunchr.cloud@gmail.com >
2022-10-06 16:25:32 +02: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
Erik Dubbelboer
a5f448fc97
Improve Client timeout ( #1346 )
...
Don't run requests in a separate Goroutine anymore. Instead use proper
conn deadlines to enforce timeouts.
- Also contains some linting fixes.
2022-07-29 19:03:15 +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
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
7670c6eaa6
Fix windows tests ( #1235 )
...
* Fix windows tests
Just ignore /../ tests on windows until we have proper suppor.
* Remove useless test code
This code was basically just testing if tcp works. To test if
SO_REUSEPORT works we only have to try to listen on the same addr:port
twice.
* Fix test
2022-03-04 10:02:31 +01:00
Sergio VS
436977654a
fix(hijack): reuse RequestCtx ( #1201 )
...
* fix(hijack): reuse RequestCtx
* fix(test/hijack): increase wait time
* fix(test/hijack): wait for all connections to finish to check responses
2022-01-22 04:54:37 +01:00
Sergio VS
2aca3e8263
fix(hijack): reset userValues after hijack handler execution ( #1199 )
...
* fix(hijack): reset userValues after hijack handler execution
* feat: add test
* fix: typo
* fix(test): race condition
2022-01-18 12:45:41 +01:00
Erik Dubbelboer
7eeb00e1cc
Make tests less flaky ( #1189 )
2022-01-10 05:15:30 +01:00
Sergio VS
258a4c17b4
fix: reset response after reset user values on keep-alive connections ( #1176 )
2021-12-16 05:27:02 +01:00
ichx
da7ff7a208
Add trailer support ( #1165 )
...
* Add trailer support
* fix issue and add documentation
* remove redundant code
* add error return for add/set trailer method
* fix lint error
* fix bad trailer error return issue and update bad content-length error
* update errNonNumericChars
* update errNonNumericChars
* fix issue about error and fix typo
2021-12-05 14:11:51 +01:00
Sergio VS
017f0aa09d
fix: reset request after reset user values on keep-alive connections ( #1162 )
...
* fix: reset request after reset user values on keep-alive connections
* test: add test for reset request after reset user values
2021-11-23 11:12:06 +01:00
ichx
3b117f8f1e
feat: close idle connections when server shutdown ( #1155 )
...
* feat: close idle connections when server shutdown
* Fix redundant code
* Update test
* Update test
2021-11-13 11:53:10 +01:00
Sergey Ponomarev
3ff6aaa591
uri: isHttps() and isHttp() ( #1150 )
...
* uri: isHttps() and isHttp()
Use them instead of manual schema comparison
* uri: use SetSchemeBytes()
2021-11-08 13:35:26 +01:00
Erik Dubbelboer
c15e642a16
Don't run all race tests on windows ( #1143 )
...
* Don't run all race tests on windows
It's too slow and gives a lot of false positives in our tests.
* No FS tests on windows
2021-10-31 22:09:40 +01:00
Erik Dubbelboer
63211032d4
Various deadline fixes ( #1081 )
2021-08-28 11:19:32 +02:00
Erik Dubbelboer
51508d7480
Fix various Windows Github Action errors ( #1082 )
...
* Fix various Windows Github Action errors
These tests keep giving errors because Windows Actions are slower.
* Remove some timeouts
We don't need timeouts in all tests, only in the ones where we are
actually testing timeout logic.
2021-08-28 09:42:38 +02:00
Erik Dubbelboer
a50f59be52
Increase various test timeouts
...
Github workers on windows are slow.
2021-08-24 11:18:22 +02:00
Erik Dubbelboer
5a6e6e102b
Add Go 1.17 support ( #1074 )
...
* Add Go 1.17 support
* Increase test timeouts
2021-08-18 21:38:21 +02:00
Tianyi Song
d31e6dbdba
Handle perIPConn in RequestCtx.IsTLS() specially ( #1064 )
2021-08-04 20:15:05 +02:00
Sujit Baniya
d0df1e1dde
Add ResetUserValues() and test ( #1056 )
2021-07-01 10:57:21 +02:00
Erik Dubbelboer
f6560bebb2
Flush buffered responses if we have to wait for the next request ( #1050 )
...
* Flush buffered responses if we have to wait for the next request
Don't wait for the next request as this can take some time, instead
flush the outstanding responses already.
Fixes #1043
* Only peek 1 byte
Make sure old clients that send bogus \r\n still work.
See: https://github.com/golang/go/commit/bf5e19fbaf02b1b25fbe50c27ec301fe830a28d0
2021-06-28 17:38:39 +02:00
Erik Dubbelboer
924a63fdeb
Increase TestServerTLSReadTimeout timeout
...
And TestFSCompressConcurrent timeout
2021-06-18 15:41:42 +02:00
Erik Dubbelboer
410bde6009
Fix race condition in TestPipelineClientIssue832
2021-06-18 15:28:58 +02:00
Erik Dubbelboer
9f2c63676d
Lower go test time
2021-06-18 14:57:18 +02:00
Meng
4ed933a2e7
fix: set content-length properly when StreanRequestBody was enabled ( #1049 )
...
* fix: set content-length properly when StreanRequestBody was enabled
* fix: add test cases for validating content length of streaming request
2021-06-18 13:43:29 +02:00
Lauris BH
620f0c83ad
Add option for middleware to set custom remote address ( #1009 )
...
* Add option for middleware to set custom remote address
* Update Init2 to clear custom context remoteAddr
2021-04-23 13:25:02 +02:00