xuecai
ed3793a1e1
add tests for copyto ( #545 )
...
* add tests for copyto
* add HeaderCopy Test reflect.DeepEqual
2019-02-17 10:11:45 +00:00
Erik Dubbelboer
6647cb2885
Remove duplicate check
...
We already compare headers case insensitive so we don't need to compare
two different cases.
2019-02-09 11:29:47 +01:00
Shulhan
2f22f20f02
all: fix typo on comments
...
While at it wrap comments with long lines.
2019-01-30 21:50:28 +01:00
xuecai
4fb459a45e
fix args empty string be changed to boolen ( #502 )
...
Add support for empty args
2018-12-30 19:56:58 +01:00
Erik Dubbelboer
2f131ba2b2
Add RequestHeader.VisitAllInOrder
2018-12-27 02:05:20 +03:00
Erik Dubbelboer
5836521d82
Use case-insensitive header value comparison
...
Fixes #483
2018-11-29 17:45:35 +08:00
Erik Dubbelboer
598a52272a
No error response on keep-alive close
...
Don't return an error response if a keep-alive connection closes either
because the other side closed the connection or a read timeout occurs.
This will prevent net/http from printing
"Unsolicited response received on idle HTTP channel"
when a ReadTimeout is set on the fasthttp Server.
Fixes #465
2018-11-21 13:33:28 +06:30
Erik Dubbelboer
192515395f
Add Client.NoDefaultUserAgentHeader
2018-11-01 12:44:17 +08:00
Erik Dubbelboer
4dfc12997e
Add RequestHeader.RawHeaders()
2018-10-05 19:00:55 +03:00
Erik Dubbelboer
8dfc881b9e
Added Server.nextProtos
...
This implementation allows user to handle crypto/tls.Config.NextProtos to use their own handlers for the negotiated TLS protos like HTTP/2.
Workerpool where changed to adapt WorkerFunc to another conns server with ServeConn type and contains the Server structure which creates to check configured protos.
2018-10-05 16:35:59 +08:00
Erik Dubbelboer
b3b6b8cb28
Fix Request.connectionCloseFast bugs
...
See https://github.com/valyala/fasthttp/pull/265
and https://github.com/valyala/fasthttp/issues/220
and https://github.com/valyala/fasthttp/issues/264
2018-09-24 21:30:30 +08:00
David Byttow
da9ba61e3b
Allows for empty content type by default. Fixes #214
2018-09-19 01:28:32 +03:00
Oleg Kovalov
10a0540dfc
Remove redundant else statements
2018-09-14 10:00:13 +08:00
Erik Dubbelboer
869903cf7a
Fix Cookie peek
...
See: https://github.com/valyala/fasthttp/issues/313
2018-09-13 12:42:54 +08:00
Erik Dubbelboer
4d08c11c11
Remove RequestHeader.isGet
...
This small optimization is not worth the extra code complexity.
2018-09-13 12:36:16 +08:00
Erik Dubbelboer
7796335d5f
Do case insensitive comparisons for headers and cookies
2018-09-11 20:07:09 +03: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
Erik Dubbelboer
b174f54b12
Add method to get cookie from response
2018-08-27 21:46:32 +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
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
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
Kirill Danshin
4a16377d6e
Merge pull request #303 from chebyrash/master
...
Typo fixes
2018-08-13 23:18:55 +03:00
toyblocks
a84dc2dc0e
Add missing http methods
...
Add support for 'CONNECT', 'OPTIONS', 'TRACE' and 'PATCH'
2018-03-12 07:00:21 +09:00
xPushkin
f24d00fcc6
A lot of typo fixes
2017-10-08 13:30:35 +01:00
Aliaksandr Valialkin
52a0993b96
Issue #278 : more optimizations for normalizeHeaderKey
2017-07-11 10:17:57 +03:00
Aliaksandr Valialkin
952171f61b
Issue #278 : optimize normalizeHeaderKey a bit
...
Performance results on amd64:
name old time/op new time/op delta
NormalizeHeaderKeyCommonCase-4 43.3ns ± 0% 32.6ns ± 1% -24.80% (p=0.000 n=9+10)
NormalizeHeaderKeyLowercase-4 42.6ns ± 3% 32.6ns ± 1% -23.41% (p=0.000 n=10+10)
NormalizeHeaderKeyUppercase-4 43.5ns ± 1% 32.6ns ± 2% -25.03% (p=0.000 n=9+8)
Based on top of https://github.com/valyala/fasthttp/pull/279 .
2017-07-10 14:28:06 +03:00
Aliaksandr Valialkin
b154429ca9
Compress responses only if their content-type starts with text/ or application/
2017-05-17 17:10:29 +03:00
Perelandric
3580c93d02
Make SetMethod slice to zero before appending ( #234 )
...
SetMethod appended directly to the `h.method` slice without setting its
length to zero, so multiple calls would create an unexpected value.
2017-02-22 09:48:29 +02:00
Aliaksandr Valialkin
2ada93a6df
Document that the cookie passed to ResponseHeader.SetCookie may be re-used after the function returns
2017-01-18 19:20:47 +02:00
Aliaksandr Valialkin
ef299a95e2
Fixed TestServerErrSmallBuffer for go 1.6
2016-11-14 23:16:56 +02:00
Aliaksandr Valialkin
3246b4efb5
Issue #173 : improve error messages on headers parsing
2016-11-10 20:00:54 +02:00
Aliaksandr Valialkin
02fe9b8533
Issue #173 : return valid response instead of silently closing connection on request parsing errors
2016-11-10 18:09:23 +02:00
Clayton Anderson
1909d6a025
Fixed bug with quoted multipart form boundaries ( #135 )
2016-07-12 09:33:29 +03:00
Aliaksandr Valialkin
15c8282c3f
typo fix
2016-06-27 17:52:45 +03:00
Aliaksandr Valialkin
80e08dc9ef
Cross-reference Set* with Add* methods on RequestHeader and ResponseHeader
2016-06-27 17:48:32 +03:00
Aliaksandr Valialkin
661978870b
return StatusOK from an empty ResponseHeader.StatusCode()
2016-06-06 14:08:53 +03:00
Tracer Tong
ae8de36df0
Issue #107 ( #108 )
2016-05-27 18:54:11 +03:00
Aliaksandr Valialkin
3509bd8a7d
Issue #83 : Added ResponseHeader.DelClientCookie for instructing the client for removing the given cookie. Clarified ResponseHeader.DelCookie documentations
2016-04-29 14:40:55 +03:00
Aliaksandr Valialkin
2a12271406
Issue #83 : Added DelCookie* methods to RequestHeader and ResponseHeader
2016-04-24 22:34:33 +03:00
Aliaksandr Valialkin
12ba989984
Issue #69 : Added RequestHeader.Add and ResponseHeader.Add for adding multiple headers with the same key
2016-03-29 17:11:43 +03:00
Aliaksandr Valialkin
0c67179812
Added delAllArgsBytes helper
2016-03-29 16:30:07 +03:00
Aliaksandr Valialkin
0d43464f64
Renamed unsafeBytes2Str to b2s
2016-03-29 16:26:21 +03:00
Aliaksandr Valialkin
8b26017325
Renamed setArg to setArgBytes
2016-03-29 16:19:22 +03:00
Aliaksandr Valialkin
c469d18819
Issue #72 : properly handle 'Connection: keep-alive, Upgrade' header
2016-03-22 19:47:59 +02:00
Aliaksandr Valialkin
ca2c5535a3
do not write 'date' response header, since 'date' header is automatically generated
2016-03-11 11:05:32 +02:00
Aliaksandr Valialkin
e0eac18652
use 'switch string(key) {}' instead of 'switch { case bytes.Equal(key, ...) ... }'. This may improve switch statement's performance
2016-03-10 17:44:58 +02:00
Aliaksandr Valialkin
38356e216e
Issue #64 : properly delete header values via Del call
2016-03-10 17:22:59 +02:00
Aliaksandr Valialkin
8280b7a162
Moved empty noCopy struct to the top of container structs. See @stemar94 's comment at https://github.com/golang/go/issues/12884 for details
2016-03-06 00:17:08 +02:00
Aliaksandr Valialkin
9f43aa1601
Do not expose noCopy.Lock
2016-03-04 21:20:52 +02:00
Aliaksandr Valialkin
9fa69c74af
Embed noCopy struct into structs, which mustn't be copied
...
This should help `go vet` detecting invalid structs' copyings.
See https://github.com/golang/go/issues/8005#issuecomment-190753527 for details.
2016-03-04 16:57:24 +02:00