Commit Graph

152 Commits

Author SHA1 Message Date
Nikolay Markov 4fa45fadd2 Propagating custom SkipBody value to allow explicitly skip body reading for responses (#647) 2019-09-04 17:54:12 +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
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 1ee3b845b6 Fix Client.DoTimeout race condition 2019-05-23 13:15:14 +02:00
Erik Dubbelboer ea427d2f44 Fix nil Response support in Do* methods
Fixes #561
2019-04-11 19:30:20 +02:00
xuecai 10b98c2cdf add conn's address info in Response (#537)
* reset commit
* fix response copy bug; add tests;
2019-02-16 10:50:14 +00:00
Erik Dubbelboer e722d81dc9 Fix HostClient.MaxConns 2019-02-11 21:12:32 +01:00
Okunev Yu Dmitry fa7a110f3e An atomic approach for HostClient.MaxConns (#531)
An atomic approach for HostClient.MaxConns
2019-02-07 21:37:59 +00:00
Nikolay Markov 71e7652440 SkipBody is propagated to Response copy (#532) 2019-02-06 12:36:43 +03:00
xuecai 627d63dd25 change timer to public api #525 (#527)
* change acquireTimer and releaseTimer to public api
2019-02-03 19:16:39 +00:00
Erik Dubbelboer 5de7a833de Add warning to DoTimeout 2019-01-26 22:26:59 +01:00
Blless 1d2d99cba3 Add MaxIdemponentCallAttempts to fasthttp.Client (#484)
* Add MaxIdemponentCallAttempts to fasthttp.Client
2018-11-29 16:36:36 +06:30
amezghal abdelilah 8be35c8fb8 cleanup resources 2018-11-28 11:57:58 +06:30
amezghal abdelilah a3c314e4a3 cleanup 2018-11-28 11:57:58 +06:30
amezghal abdelilah 8388aaa0c6 check cleanup status using atomic 2018-11-28 11:57:58 +06:30
amezghal abdelilah 92e4256ef6 cleanup resources 2018-11-28 11:57:58 +06:30
amezghal abdelilah db09046f71 cleaup after timeout
Cleanup resources if there was a timeout
2018-11-28 11:57:58 +06:30
amezghal abdelilah 7b6cfd261a fix potential leak
cleanup in case of timeouts
2018-11-28 11:57:58 +06:30
amezghal abdelilah 80829ab6ff Make sure to always release resources
Make sure to always release resources in the event of timeout
2018-11-28 11:57:58 +06:30
zhaoxy 707bfb8c0e remove extra space 2018-11-23 12:40:08 +06:30
zhaoxy a26bbd1812 Remove the set read and write deadline optimization since golang has fixed it https://github.com/golang/go/issues/15133#issuecomment-271571395 2018-11-23 12:40:08 +06:30
zhaoxy 8a7123ed78 fix check failed 2018-11-23 12:40:08 +06:30
川宇 4570d12009 avoid empty pointer 2018-11-23 12:40:08 +06:30
川宇 c7d1f2a6d6 reset connection read and write deadline for reuse 2018-11-23 12:40:08 +06:30
Erik Dubbelboer fcaab424ca Don't retry client requests with ErrBodyTooLarge
Fixes #455
2018-11-12 13:23:42 +08:00
Erik Dubbelboer 8f4c5d5d1d Change HostClient.pendingRequest to an int32
atomic.AddUint64 needs a 64bit aligned address on x86, int32 is more
than enough and keeps the code more readable.

Fixes #451
2018-11-03 22:34:05 +08:00
Erik Dubbelboer aebec409b0 Only remove a HostClient from Client if it is unused 2018-11-01 19:05:53 +08:00
Erik Dubbelboer 192515395f Add Client.NoDefaultUserAgentHeader 2018-11-01 12:44:17 +08:00
Gabriel Pérez S 996610f021 Schema changes detection with HostClient
Related with the issue https://github.com/valyala/fasthttp/issues/244
2018-10-14 16:19:09 +03:00
Erik Dubbelboer d7688109a5 Reset all fields when releasing a clientConn
This fixes a bug where a previous read deadline timer would be reused
for a new connection preventing Client.ReadTimeout from working
properly.

See: https://github.com/valyala/fasthttp/pull/259
2018-09-01 13:20:36 +08:00
michael.kochegarov 19d2d06ab5 Configuration for automatic retry for idempotent calls 2018-08-29 22:26:04 +08:00
Erik Dubbelboer d3181922e1 Fix connsCleaner sleep time
Fixes: https://github.com/valyala/fasthttp/issues/308
2018-08-27 21:49:31 +00:00
Erik Dubbelboer 6c79939960 Fix Get/Post documentation
The functions don't append to dst, they overwrite.
2018-08-27 21:30:43 +00:00
Erik Dubbelboer 2f0f8a4824 Fix supported redirect status codes
Support the same redirect status codes as the golang standard library
does: https://github.com/golang/go/blob/15095be9fbe726d4a3ef43b68d2fbc83e6484ded/src/net/http/client.go#L419
2018-08-24 15:56:55 +03:00
Erik Dubbelboer 5576019a85 Fix bug that prevents custom user-agents 2018-08-24 15:31:04 +03:00
Kirill Danshin ef10ed05a3 deprecate CoarseTime and replace it with a shortcut implementation
Signed-off-by: Kirill Danshin <k@guava.by>
2018-08-17 18:12:21 +03:00
Kirill Danshin 4c7269ec2a Revert "Remove CoarseTime"
This reverts commit f2ddaffc31.
2018-08-17 15:32:15 +03:00
Erik Dubbelboer f2ddaffc31 Remove CoarseTime
It is not clear why @valyala introduced this coarse time. Benchmarks on
different systems show that the speedup is no where enough to justify
the added code complexity and bugs it seems to have introduced.

Mac:
BenchmarkCoarseTimeNow-8   	2000000000	         2.49 ns/op
0 B/op	       0 allocs/op
BenchmarkTimeNow-8         	500000000	         3.14 ns/op
0 B/op	       0 allocs/op

Ubuntu:
BenchmarkCoarseTimeNow-4   	300000000	         6.74 ns/op
0 B/op	       0 allocs/op
BenchmarkTimeNow-4         	100000000	        15.9 ns/op
0 B/op	       0 allocs/op

This reverts commit https://github.com/erikdubbelboer/fasthttp/commit/6309f42188ecb28ccf8ac58442739cdb43d75d9e
and https://github.com/erikdubbelboer/fasthttp/commit/32c72cde80f0c591604f825586d6a4bbbb39d9c5.

See: https://github.com/valyala/fasthttp/issues/271,
https://github.com/valyala/fasthttp/pull/269 and
https://github.com/valyala/fasthttp/issues/261.
2018-08-17 17:15:41 +08:00
xPushkin f24d00fcc6 A lot of typo fixes 2017-10-08 13:30:35 +01:00
Aliaksandr Valialkin bcdf16d04f Removed superflouos slashes from documentation 2017-09-12 13:15:04 +03:00
Aliaksandr Valialkin 9ffce8c687 client: properly extract tls ServerName from address without port 2017-04-26 17:57:12 +03:00
Aliaksandr Valialkin 32c72cde80 Export CoarseTimeNow and clarify that RequestCtx.Time() and RequestCtx.ConnTime() return time truncated to a second 2017-02-10 15:45:14 +02:00
Aliaksandr Valialkin 6309f42188 optimization: substitute time.Now() calls with coarse-grained time in hot paths 2017-02-09 23:59:06 +02:00
Aliaksandr Valialkin 1c39678a4d client: retry non-idempotent requests if the server closes idle keep-alive connection before receiving the next request
This case usually appears when working with Apache or nginx servers.
See http://httpd.apache.org/docs/2.4/mod/core.html#keepalivetimeout
and http://nginx.org/en/docs/http/ngx_http_core_module.html#keepalive_timeout
2016-11-28 11:50:36 +02:00
Aliaksandr Valialkin a965b01816 Added an example for LBClient 2016-10-21 14:53:44 +03:00
Aliaksandr Valialkin d18f43c48c Issue #191: Respect ServerName set in user-provided tls.Config 2016-10-20 15:26:25 +03:00
Aliaksandr Valialkin 4ca4d0ea09 Client, HostClient, PipelineClient: verify TLS server name 2016-10-12 19:49:23 +03:00
Aliaksandr Valialkin 07f692d02d Revert "Redirection support for Do(*Request, *Response)"
This breaks Get*() with redirects. DoFollowRedirects must be implemented
on top of Do() instead of hacking on internal doRequestFollowRedirects.

This reverts commit 6438022109.
2016-10-05 12:44:51 +03:00
Aliaksandr Valialkin 0509ba9f93 Revert "removing legacy doRequestFollowRedirects()"
This reverts commit 97e154e4cd.
2016-10-05 12:44:45 +03:00
Sick Yoon 97e154e4cd removing legacy doRequestFollowRedirects() 2016-10-05 12:37:18 +03:00