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
Erik Dubbelboer
3cd0862fbb
Streaming fixes ( #970 )
...
- Allow DisablePreParseMultipartForm in combination with
StreamRequestBody.
- Support streaming into MultipartForm instead of reading the whole body
first.
- Support calling ctx.PostBody() when streaming is enabled.
2021-02-16 21:53:53 +01:00
AlphaBaby
a88030b8fb
fix gracefilly shutdown bug, issue #958 ( #960 )
...
* fix gracefilly shutdown bug, issue #958
* fix golangci-lint
* add option: CloseOnShutdown into Sever
* Update server.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
* Update server.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
Co-authored-by: fujianhao3 <fujianhao3@jd.com >
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
2021-02-07 21:13:36 +01:00
Kirill Danshin
0956208cc6
Add request body streaming. Fixes #622 ( #911 )
...
* Add request body streaming. Fixes #622
* Add test cases for StreamRequestBody
Co-authored-by: Kiyon <kiyonlin@163.com >
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
Co-authored-by: Fiber
2021-02-06 23:03:23 +03:00
Erik Dubbelboer
fbe6a2d470
Add fasthttp.GenerateTestCertificate and use in tests
...
Remove ssl-cert-snakeoil so our tests don't fail in 2025.
2021-02-06 11:47:11 +01:00
Erik Dubbelboer
01acd76daf
Allow TimeoutHandler connections to be kept alive ( #864 )
2020-08-16 09:21:00 +02:00
Erik Dubbelboer
34a61fe63f
Update linting ( #851 )
2020-07-17 14:22:28 +02:00
Erik Dubbelboer
cc9db3ab20
Try TravisCI Windows ( #828 )
...
* Try TravisCI Windows
* prefork is supported on windows with Reuseport=true
* Bit longer timeouts for tests
2020-06-06 15:57:38 +02:00
Erik Dubbelboer
439185eb57
Run cross compilation and race detector on the latest release only
2020-05-31 17:05:49 +02:00
Erik Dubbelboer
2f92c68a07
Add timeouts to tls Handshake
...
Fixes #813 which suggested the code.
2020-05-25 20:44:04 +02:00
Mike MacDermaid
32940977fb
allow the expect 100 continue workflow to deny requests ( #787 )
...
* allow the expect 100 continue workflow to deny requests
* suggested changes
* update booleans to reflect handler name change
2020-04-27 20:29:02 +02:00
Darío
402e095d4d
Fixed case when no hijacker is added but no-response is true ( #772 )
2020-04-07 09:35:05 +02:00
phuslu
b71c8c513c
Add support for NoDefaultDate option that excludes the sending of the Date header ( #758 )
2020-03-13 11:00:44 +01:00
Erik Dubbelboer
b0102c9eba
Support calling Serve multiple times on a Server ( #731 )
...
You can use the following methods in the handler to find out which
listener the connection is coming in on.
RequestCtx.IsTLS()
RequestCtx.LocalAddr()
RequestCtx.Request.Header.Host()
2020-01-23 18:30:36 +01:00
Andy Pan
59b28fe0e5
Resolve code issues from goreportcard.com ( #725 )
2020-01-12 12:57:42 +01:00
Erik Dubbelboer
958ed36194
Allow no response to be send when a connection is hijacked ( #712 )
...
* Allow no response to be send when a connection is hijacked
At the moment there is always a HTTP response before the connection gets
hijacked. This second option to Hijack() prevents this response from
being send.
Fixes: https://github.com/valyala/fasthttp/issues/698
* Add HijackSetNoResponse method instead
2019-12-29 11:34:55 +01:00
Erik Dubbelboer
39dd1045bb
Allow a body for GET requests ( #703 )
...
This means we can't skip parsing headers for GET requests anymore. This
can be seen as good as it also allows us to reject malformed GET
requests, something we didn't do before this. Performance also isn't
affect much:
benchmark old ns/op new ns/op delta
BenchmarkClientGetEndToEnd1Inmemory-16 640 641 +0.16%
BenchmarkClientGetEndToEnd10Inmemory-16 713 710 -0.42%
BenchmarkClientGetEndToEnd100Inmemory-16 732 749 +2.32%
BenchmarkClientGetEndToEnd1000Inmemory-16 759 774 +1.98%
BenchmarkClientGetEndToEnd10KInmemory-16 785 808 +2.93%
BenchmarkNetHTTPClientGetEndToEnd1Inmemory-16 5045 4954 -1.80%
BenchmarkNetHTTPClientGetEndToEnd10Inmemory-16 5806 6225 +7.22%
BenchmarkNetHTTPClientGetEndToEnd100Inmemory-16 7877 7998 +1.54%
BenchmarkNetHTTPClientGetEndToEnd1000Inmemory-16 16603 16559 -0.27%
2019-12-01 09:44:11 +01:00
Erik Dubbelboer
32793db72d
Run golangci-lint using a Github Action
2019-11-16 18:09:28 +01:00
Kevin Burns
f82a6460e9
Requests with incomplete bodies no longer cause log noise ( #682 )
...
* #660 Incorrect content length
* fix
* unexpected EOF is expected
* Prevent test from panicing should err ever be nil
2019-10-27 15:29:20 +08:00
Erik Dubbelboer
c3d82ca3a4
Speed up testing by running tests in parallel
2019-10-16 10:20:13 +02:00
Erik Dubbelboer
352ec7c83e
Use Fatal instead of Fatalf when no formatting used
2019-10-16 10:20:13 +02:00
Erik Dubbelboer
9dbe5fc77c
Don't allow spaces in request header keys
...
See: https://github.com/golang/go/commit/6e6f4aaf70c8b1cc81e65a26332aa9409de03ad8
Reject any non GET or HEAD requests with a 400.
We can't reject GET or HEAD requests with bad headers as we delay
parsing of these headers until the user asks for one. So in this case we
just ignore the header and don't return a value for it.
2019-10-16 10:20:13 +02:00
Marcelo Pires
ccaae97f5b
Support {readTimeout,maxBodySize,writeTimeout} per request based on the headers. ( #598 )
2019-07-12 14:42:07 +02:00
Maxim Lebedev
d3715c361c
⚡ Used Headers constants instead raw strings
2019-05-28 18:04:24 +03:00
Erik Dubbelboer
15dbe35bb5
Timing fixes ( #564 )
...
- Improved timing code to be much cleaner
- Add IdleTimeout
- Remove obsolete optimization (was fixed in Go 2 years ago: https://github.com/golang/go/issues/15133#issuecomment-271571395 )
2019-04-29 16:12:47 +03:00
Tiago Peczenyj
0558e349d7
fix context Err() issue ( #544 )
...
* fix context Err() issue
Co-Authored-By: peczenyj <tiago.peczenyj@gmail.com >
2019-02-16 10:53:21 +00:00
Erik Dubbelboer
51532b9517
Shutdown close channel returned by RequestCtx.Done
...
RequestCtx.Done() now returns a channel that will be closed when
Server.Shutdown() is called.
2019-02-02 12:23:32 +01:00
Erik Dubbelboer
9793e28938
Add test for ConnState
2019-01-03 22:23:27 +01:00
Erik Dubbelboer
efe4585c98
Make RequestCtx implement context.Context
...
fixes #459
2018-11-16 00:22:29 +08:00
Berezhnoy Pavel
e771b6fe43
#457 : allow to rewrite system error response ( #458 )
...
* #457 : allow to rewrite system error response
* #457 : review fixes
* #457 : more review issues fixed
2018-11-13 15:41:42 +03:00
Erik Dubbelboer
573be81328
Hopefully fix TestShutdownReuse flakiness
2018-10-14 10:18:21 +02:00
David Byttow
da9ba61e3b
Allows for empty content type by default. Fixes #214
2018-09-19 01:28:32 +03:00
Erik Dubbelboer
761869f3f8
Close the file before trying to rename in SaveMultipartFile
...
On Windows systems it is not possible to rename files that are opened.
2018-09-13 12:39:45 +08:00
Erik Dubbelboer
c6fd90e432
Don't suppresses TLS related errors
...
See https://github.com/valyala/fasthttp/issues/300
2018-09-05 20:07:23 +03:00