Commit Graph

1202 Commits

Author SHA1 Message Date
ZhangYunHao 707b1c1917 Format errors (#679)
* format errors

* Server is a type name

* Fix typo
2019-10-23 20:12:59 +08:00
ZhangYunHao 18c619fb04 fasthttputil: add errInmemoryListenerClosed (#678)
* add errInmemoryListenerClosed

* Fix test error

* Expose ErrInmemoryListenerClosed

* rename
2019-10-22 15:55:44 +08:00
Erik Dubbelboer bf98e3b75b Use least total connections instead of round robin for lbclient (#673) 2019-10-20 07:09:42 +02:00
Erik Dubbelboer ec2e3965a4 Don't run TestClientNilResp in parallel 2019-10-19 22:34:56 +02:00
Erik Dubbelboer d428e1b05e Fix race condition in tests, fix URI bug
- Some tests can't be run in parallel.
- `URI` had a pointer to `RequestHeader` which was updated with
`RequestHeader.CopyTo` which resulted in the URI pointing to the wrong
`RequestHeader` causing bugs and race conditions.

The only reason `URI` contained a pointer to `RequestHeader` was to delay the
call to `RequestHeader.Host()` until really needed. But these days instead
of parsing all headers, `RequestHeader.Host()` uses
`RequestHeader.peekRawHeader()` which is rather fast. So we can remove the
pointer in `URI` and completely decouple the two structs improving code
quality and fixing the bug.

For some reason this results in faster code on average as well:
benchmark                                          old ns/op     new ns/op     delta
BenchmarkClientGetEndToEnd1Inmemory-8              1189          1369          +15.14%
BenchmarkClientGetEndToEnd10Inmemory-8             1143          1161          +1.57%
BenchmarkClientGetEndToEnd100Inmemory-8            1228          1236          +0.65%
BenchmarkClientGetEndToEnd1000Inmemory-8           1213          1213          +0.00%
BenchmarkClientGetEndToEnd10KInmemory-8            1362          1350          -0.88%
BenchmarkClientEndToEndBigResponse1Inmemory-8      139967        130070        -7.07%
BenchmarkClientEndToEndBigResponse10Inmemory-8     142233        131809        -7.33%
BenchmarkServerGet1ReqPerConn-8                    1726          1593          -7.71%
BenchmarkServerGet2ReqPerConn-8                    882           927           +5.10%
BenchmarkServerGet10ReqPerConn-8                   440           436           -0.91%
BenchmarkServerGet10KReqPerConn-8                  341           339           -0.59%
BenchmarkServerPost1ReqPerConn-8                   1728          1706          -1.27%
BenchmarkServerPost2ReqPerConn-8                   968           963           -0.52%
BenchmarkServerPost10ReqPerConn-8                  506           505           -0.20%
BenchmarkServerPost10KReqPerConn-8                 424           420           -0.94%
BenchmarkServerGet1ReqPerConn10KClients-8          1117          1051          -5.91%
BenchmarkServerGet2ReqPerConn10KClients-8          565           514           -9.03%
BenchmarkServerGet10ReqPerConn10KClients-8         390           387           -0.77%
BenchmarkServerGet100ReqPerConn10KClients-8        355           348           -1.97%
BenchmarkServerHijack-8                            339           348           +2.65%
BenchmarkServerMaxConnsPerIP-8                     326           325           -0.31%
BenchmarkServerTimeoutError-8                      24355         24180         -0.72%
2019-10-19 21:02:31 +02: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
Erik Dubbelboer 4ebe993965 Document PipeConns not being safe for concurrent use 2019-10-16 10:20:13 +02:00
rogercarter1 044d35e5ef fix 664 (#674) 2019-10-16 16:18:52 +08:00
Ian Leue ffcdb753b1 Allow client to disable path normalization (#672) 2019-10-11 14:20:29 +08:00
Erik Dubbelboer af531ad4c0 Move comment to now show up on godoc
Comments above the package statement show up at the top of
https://godoc.org/github.com/valyala/fasthttp
2019-10-03 14:08:17 +02:00
Erik Dubbelboer 28af1f13fe Fix previous commit 2019-10-02 22:40:15 +02:00
Vendin 5038ebcc55 Refactoring to reuse response status codes (#666)
* Refactoring to reuse response status codes

* add StatusCodeIsRedirect function

* update commentary for StatusCodeIsRedirect function
2019-10-02 22:04:37 +02:00
ZhangYunHao b1ca43febc Use 'go generate' in bytesconv.go (#663)
* Add bytesconv_table_gen.go
2019-09-28 14:55:31 +02:00
Erik Dubbelboer 97d51fbf75 go fmt ./... 2019-09-28 14:53:43 +02:00
Erik Dubbelboer e6a8bcfb0c Add go version to go.mod, test with 1.13.1
I chose 1.11 for the version in the go.mod file based on the information
in this issue: https://github.com/golang/go/issues/30791
2019-09-28 10:10:20 +02:00
Erik Dubbelboer 1d6a7e0493 The Authorization header should include the Basic keyword
Thanks to https://github.com/paween1980
2019-09-27 17:29:44 +02:00
Oleg Kovalov dc9b54dbdf Precompute default regexp (#662) 2019-09-25 20:56:31 +02:00
ZYunH be93fbd21b Add lowerhex 2019-09-20 06:33:34 +03:00
ZYunH 79bd450e0e Use 0xf instead of 15 2019-09-20 06:33:34 +03:00
ZYunH 91138eed5f Replace int2hexbyte with uppercase 2019-09-20 06:33:34 +03:00
ZYunH 9bc19f85e1 Replace hexCharUpeer with upperhex (#657) 2019-09-19 13:15:51 +02:00
Kirill Danshin d644da4382 Update README.md 2019-09-18 19:20:23 +03:00
ZYunH ae421163c5 Improve appendQuotedPath and AppendQuotedArg (#654)
* Update bytesconv.go
* Modify tests
* Remove unnecessary comments
* Update args_test.go
* Add test for appendQuotedPath
* Fix 11202 issue
* Fix some problems
2019-09-18 13:52:04 +02:00
Daniel Firsht ee8450036e Added option to disable path normalization (#649) 2019-09-18 08:56:18 +02:00
Erik Dubbelboer c6037ab3b4 Update fuzzit 2019-09-16 15:03:59 +02:00
Erik Dubbelboer 8b0b919f26 Fix FasthttpSocksDialer documentation v1.5.0 2019-09-13 21:47:26 +02:00
Erik Dubbelboer b29d896c75 Fix fuzzit for Go 1.13 2019-09-12 11:07:43 +02:00
Erik Dubbelboer ec83abee46 Also test with the new Go 1.13 2019-09-12 10:39:04 +02:00
Erik Dubbelboer 7e6a4c887b Update dependencies 2019-09-07 10:20:54 +02:00
Erik Dubbelboer e5e21db0c3 Reuse the socks5 dialer
Fixes https://github.com/valyala/fasthttp/issues/644
2019-09-07 10:13:56 +02:00
Kazushi Kitaya 8713335f54 Fix data race in fasthttputil.pipeConn (#645)
* add tests for fasthttputil.InmemoryListener
* fix data race in pipeConn
* update use of readDeadlineChLock
2019-09-04 17:57:51 +02:00
Nikolay Markov 4fa45fadd2 Propagating custom SkipBody value to allow explicitly skip body reading for responses (#647) 2019-09-04 17:54:12 +02:00
andrewheberle 8ce231e840 Add stub/wrapper for reuseport.Listen on Windows platforms (#638)
* Create Windows stub for reuseport.Listen
2019-08-30 12:22:25 +02:00
Erik Dubbelboer 1241ed7a91 Add fuzzit support (#634)
* Add fuzzit support

* Do local regression fuzz testing
2019-08-24 08:56:51 +02:00
Ian Leue d4833f60cb Use ipv6-compliant methodology for joining host port (#640)
* Use ipv6-compliant methodology for joining host port

* Fix change
2019-08-23 17:19:47 +03:00
ZYunH c5413ffda8 A faster s2b function (#637)
* Use pointer for smaller stack space
2019-08-19 10:45:03 +02:00
Mike Faraponov ce02b85a9c Add ability to set timeout for handshake (#631)
* Fixed issue with handshake timeout
2019-08-18 14:34:47 +02:00
Erik Dubbelboer 2edabf3b76 Add support for user:pass in URLs (#614)
Fixes #609
2019-08-18 11:23:33 +02:00
Ciprian Dorin Craciun 85217e0d5e Correctly handle NoDefaultContentType without setting an Content-Type value (#628)
If `NoDefaultContentType` is set, but no actual `Content-Type` header is set, do not send the wrong `Content-Type: ` header
2019-08-13 11:53:03 +02:00
Sergio Andrés Virviescas Santana b97bc32543 Update README (#621) 2019-08-02 17:09:28 +02:00
wencan 55ea350c55 Update README.md (#610)
add related project: kit-plugins
2019-07-17 10:12:00 +02:00
Marcelo Pires ccaae97f5b Support {readTimeout,maxBodySize,writeTimeout} per request based on the headers. (#598) 2019-07-12 14:42:07 +02:00
Erik Dubbelboer a0248ed3a1 Fix read timeout with nothing read
Fixes #605
2019-07-11 22:10:41 +02:00
Dair Aidarkhanov 1bd0404ced Removing redundant else statement from HeaderCookie (#596) v1.4.0 2019-07-03 23:40:48 +02:00
Rem 9ba4cef1ba Support SameSite value "None" cookie attribute (#581)
* Support SameSite value "None" cookie attribute

* Fix typo in CookieSameSiteNoneMode comment

* fix comment for SameSite None
2019-06-14 16:07:33 +02:00
losingle 9494955f8e ADD TimeoutWithCodeHandler support (#589)
* ADD TimeoutWithCodeHandler support

* FIX description
2019-06-06 17:17:40 +02:00
Maxim Lebedev d3715c361c Used Headers constants instead raw strings 2019-05-28 18:04:24 +03:00
Maxim Lebedev a4505cb573 Added headers keys constants 2019-05-28 18:04:24 +03:00