Commit Graph

1039 Commits

Author SHA1 Message Date
Xu Qiaolun ecb7cbdfb2 call the ConnState callbacks in Server.ServeConn 2018-08-30 15:20:32 +00:00
Xu Qiaolun c88d0992b4 vendor ConnState type in fasthttp package 2018-08-30 15:20:32 +00:00
徐乔伦 71b7e99093 fix test case error 2018-08-30 15:20:32 +00:00
徐乔伦 69613e6feb add support for http.ConnState
issue #205
2018-08-30 15:20:32 +00:00
Erik Dubbelboer 373357d2d4 Try the same formats as net/http for cookie expire
See: https://github.com/golang/go/blob/00379be17e63a5b75b3237819392d2dc3b313a27/src/net/http/cookie.go#L133-L135

Fixes #175
2018-08-29 22:55:21 +08:00
michael.kochegarov 19d2d06ab5 Configuration for automatic retry for idempotent calls 2018-08-29 22:26:04 +08:00
Erik Dubbelboer 2cc8e6be6d go fmt ./... 2018-08-29 20:26:12 +08:00
Kirill Danshin 57b1f46d15 Update LICENSE 2018-08-28 19:55:09 +00:00
Kirill Danshin 0821f75aea Update README.md 2018-08-27 22:23:26 +00: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 b174f54b12 Add method to get cookie from response 2018-08-27 21:46:32 +00:00
Erik Dubbelboer 7c74b1f431 Remove duplicate check
Is already checked at https://github.com/valyala/fasthttp/blob/4a16377d6e780cb75b91962ea2100d83f7452565/http.go#L1190
and https://github.com/valyala/fasthttp/blob/4a16377d6e780cb75b91962ea2100d83f7452565/http.go#L1244
2018-08-27 21:46:12 +00:00
Erik Dubbelboer 26aa8e51e8 Allow whitespace after chunk size
There seems to be servers/load balancers that insert whitespaces
between the chunk-size number and \r\n.
2018-08-27 21:42:46 +00:00
Erik Dubbelboer e277e51b15 Add support for ResponseHeader.Peek("Set-Cookie")
See: https://github.com/erikdubbelboer/fasthttp/issues/4
2018-08-27 21:42:16 +00:00
Erik Dubbelboer d689bfcde7 Copy file if rename fails (save multipart)
Renaming a file can fail when the two files are on different devices.
Just copy if rename fails for any reason. If rename fails because of
other reaons copy will either work or fail for the same reason as well
so we won't miss any errors after this.
2018-08-27 21:35:30 +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 fbf4b2d9cd Do not log ErrSmallBuffer for request headers
fasthttp returns a 431 error when the request headers are too large.
Most other HTTP servers do not log an error when the request header
exceeds the limit. When serving HTTP requests directly to browsers,
it is normal to occasionally hit the limit due to broken browsers
or broken sites linking to your resource. These issues are generally
outside of your control in the same way the already ignored errors are.
2018-08-27 21:30:11 +00:00
Sergio Andres Virviescas Santana 77385190fb Added atreugo micro-framework in README 2018-08-27 08:55:21 +00:00
Erik Dubbelboer 5b46f8ddc5 Added support for multiple TLS domains
See: https://github.com/erikdubbelboer/fasthttp/pull/24
2018-08-25 20:11:58 +03:00
Erik Dubbelboer 9b72466ae0 Stop random TestServerErrSmallBuffer failures
TestServerErrSmallBuffer had a small race condition where the test would
checkout the output of the logger after the client connection had been
served but before the worker had written the result to the logger.

This new code is also much faster as it doesn't actually use TCP but
just some in memory buffers.
2018-08-25 16:57:27 +03:00
Erik Dubbelboer d84d8ea604 Allow removal of the Server header in responses
his PR adds an option to the Server called `NoDefaultServerHeader` that
allows a user to indicate that neither the Server's `Name` field nor
the `defaultServerName` should be included in the Server's responses
as a `Server` header by default.

Now when `ResponseHeader.AppendBytes` is found to have an empty `server`
field, it simply skips the `Server` header. Previously that method
would write the `defaultServerName` when no value was found. The only
code paths that took advantage of that were ones originating from
`writeErrorResponse`, which now handles setting the server name
directly.

Fixes: https://github.com/valyala/fasthttp/issues/221
2018-08-25 16:00:48 +03:00
Kirill Danshin 4b420745b9 Merge branch 'master' of github.com:valyala/fasthttp 2018-08-25 02:15:25 +03:00
Kirill Danshin c661e13a56 .travis.yml: add 1.11 support, not droping 1.9.x just yet
Signed-off-by: Kirill Danshin <k@guava.by>
2018-08-25 02:13:16 +03:00
Erik Dubbelboer e3d61d58fd Add Server.Shutdown 2018-08-25 01:39:00 +03:00
Erik Dubbelboer cf6f6e7fca Read GET/HEAD body if it exists
Previously, GET/HEAD bodies were not read. The HTTP 1.1 specification
states:

"A server SHOULD read and forward a message-body on any request; if the
request method does not include defined semantics for an entity-body,
then the message-body SHOULD be ignored when handling the request.
I suspect this code is at fault."

This change reads the body on such request and continues the previous
behavior of returning a "Content-Length" of 0 to the application.

See: https://github.com/valyala/fasthttp/issues/159
2018-08-24 16:21:17 +03: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 6ada75770c Remove unreachable conditions
See: https://github.com/valyala/fasthttp/issues/238
2018-08-24 15:56:06 +03:00
Erik Dubbelboer 3f904e1492 Remove code that does nothing
connTime never changes so the statement does nothing.
2018-08-24 15:50:31 +03:00
Erik Dubbelboer 5576019a85 Fix bug that prevents custom user-agents 2018-08-24 15:31:04 +03:00
Erik Dubbelboer a58298a3a8 Fix doc for some time functions
They still said the return value would be truncated to the nearest
second which is false after ef10ed05a3.
2018-08-21 17:58:36 +03:00
Kirill Danshin 9730312fdb Merge pull request #369 from erikdubbelboer/trueargs
handle 't' and 'true' as bool in QueryArgs
2018-08-21 17:58:14 +03:00
Erik Dubbelboer 1e7885eb56 handle 't' and 'true' as bool in QueryArgs
See: https://github.com/erikdubbelboer/fasthttp/pull/46
2018-08-21 22:36:22 +08:00
Kirill Danshin 67064edf27 Merge pull request #364 from erikdubbelboer/pathnotfound
Added PathNotFound handle func for handling 404.
2018-08-18 03:20:51 +03:00
Kirill Danshin 94c5a94ec1 Merge pull request #243 from erikdubbelboer/pprof
Add pprofhandler, fix #235
2018-08-17 22:27:07 +03:00
Kirill Danshin dc5b83b915 fs/pathNotFound: do not overwrite user's status code
Signed-off-by: Kirill Danshin <k@guava.by>
2018-08-17 22:04:50 +03:00
Kirill Danshin 2a9f0d0a07 Merge pull request #380 from erikdubbelboer/clientfollowredirects
Use and InmemoryListener for TestClientFollowRedirects
2018-08-17 21:08:17 +03:00
Erik Dubbelboer 6fd423aac4 Use and InmemoryListener for TestClientFollowRedirects
Prevents travis-ci from throwing:
client_test.go:489: unexpected error: listen tcp4 127.0.0.1:55234: bind:
address already in use
2018-08-18 01:06:36 +08:00
Kirill Danshin 73977b0774 Merge pull request #379 from erikdubbelboer/coarsetime
Remove CoarseTime
2018-08-17 19:18:19 +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
Erik Dubbelboer 074e62ddb0 Add pprofhandler, fix #235
Similar to expvarhandler but for net/http/pprof
2018-08-17 17:04:14 +08:00
Erik Dubbelboer e3fd87a866 Added PathNotFound handle func for handling 404.
See https://github.com/erikdubbelboer/fasthttp/pull/10
2018-08-17 15:51:44 +08:00
Kirill Danshin 4a16377d6e Merge pull request #303 from chebyrash/master
Typo fixes
2018-08-13 23:18:55 +03:00
Kirill Danshin 8c70077e43 Merge branch 'master' of github.com:valyala/fasthttp 2018-08-13 01:53:56 +03:00
Kirill Danshin 21b8fa5920 ci: temporary disable goimports check
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2018-08-13 01:53:48 +03:00
Kirill Danshin b4967a0d49 Merge pull request #339 from phachon/master
Update README.md
2018-08-13 01:50:41 +03:00
Kirill Danshin bb3bb6295c Merge pull request #255 from rikvdh/patch-1
Remove iris from README, latest v6 removes fasthttp support
2018-08-13 01:49:28 +03:00
Kirill Danshin 78854f3794 ci: try yet another fix for goimports check
Signed-off-by: Kirill Danshin <kirill@danshin.pro>
2018-08-13 01:43:55 +03:00
Kirill Danshin 5edd8e0f2f Merge branch 'master' of github.com:valyala/fasthttp 2018-08-13 01:31:38 +03:00