sky
cc8ba4b5a3
Add a api DisableNoDefaultContentType to disable add default content type. ( #859 )
...
* Add api DisableNoDefaultContentType to disable add default contentype if no Content-Type header.
* Update test case.
* Update api name.
* Update header.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
2020-08-07 17:38:59 +02:00
Erik Dubbelboer
bcaa594b41
Remove unused raw header code
2020-05-31 15:49:37 +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
415e5fc531
Fix panic in header parser
2019-12-14 22:20:09 +01:00
Erik Dubbelboer
fd55658938
Improve multiline header parsing ( #708 )
...
- Replace tabs with spaces at line starts to match net/http
- Don't allow multi line header names. See: https://github.com/golang/go/issues/34702
2019-12-14 10:58:06 +01:00
tedli
6a8a72ac18
add extra checking of header buffer, to support multi line header value ( #123 ) ( #688 )
2019-12-14 09:45:35 +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
ZhangYunHao
707b1c1917
Format errors ( #679 )
...
* format errors
* Server is a type name
* Fix typo
2019-10-23 20:12:59 +08:00
Erik Dubbelboer
c3d82ca3a4
Speed up testing by running tests in parallel
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
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
Maxim Lebedev
d3715c361c
⚡ Used Headers constants instead raw strings
2019-05-28 18:04:24 +03:00
Maxim Lebedev
f544170d63
Added methods constants ( #567 )
...
* ✨ Added methods constants
* 👌 Fixed methods comment due to review changes
2019-05-06 17:54:49 +02:00
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
2f131ba2b2
Add RequestHeader.VisitAllInOrder
2018-12-27 02:05:20 +03:00
Erik Dubbelboer
63ea2d380f
Remove invalid test introduced in #378
...
Header normalization has been changed since pull request #378 was made.
These days header case doesn't matter when looking up headers.
2018-10-06 01:02:45 +08:00
Erik Dubbelboer
4dfc12997e
Add RequestHeader.RawHeaders()
2018-10-05 19:00:55 +03: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
Erik Dubbelboer
869903cf7a
Fix Cookie peek
...
See: https://github.com/valyala/fasthttp/issues/313
2018-09-13 12:42:54 +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
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
6ada75770c
Remove unreachable conditions
...
See: https://github.com/valyala/fasthttp/issues/238
2018-08-24 15:56:06 +03:00
Aliaksandr Valialkin
3246b4efb5
Issue #173 : improve error messages on headers parsing
2016-11-10 20:00:54 +02:00
Aliaksandr Valialkin
432960e479
Issue #188 : Add tests for empty header values' parsing
2016-10-13 16:17:09 +03:00
Aliaksandr Valialkin
45697fe30a
Issue #141 : do not urlencode cookies
...
https://tools.ietf.org/html/rfc6265 says nothing about cookies encoding.
2016-07-18 18:25:03 +03:00
Aliaksandr Valialkin
5c2b6256da
A follow-up test for the PR #135
2016-07-12 09:37:39 +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
ccf67b7c98
Issue #107 : make sure fasthttp supports arbitrary request methods including DELETE
2016-05-27 16:10:21 +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
33163198b1
sped up slow tests under 'go test -race'
2016-04-15 13:47:42 +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
bfa17b7ae9
do not copy Request and Cookie objects in tests
2016-03-28 17:17:05 +03:00
Aliaksandr Valialkin
c469d18819
Issue #72 : properly handle 'Connection: keep-alive, Upgrade' header
2016-03-22 19:47:59 +02:00
Aliaksandr Valialkin
38356e216e
Issue #64 : properly delete header values via Del call
2016-03-10 17:22:59 +02:00
Aliaksandr Valialkin
ad8f9d1f6f
Issue #57 : Exported AppendNormalizedHeaderKey
2016-02-25 21:28:13 +02:00
Aliaksandr Valialkin
b8f996c13f
Added more tests for keep-alive and non-keep-alive connections during HTTP/1.0 requests
2016-02-22 22:51:12 +02:00
Aliaksandr Valialkin
4a29aeb2bd
Added tests for HTTP/1.0 requests regarding 'Connection: close' handling
2016-02-22 18:18:50 +02:00
Aliaksandr Valialkin
d95ef5ab6c
Added a test for bufferStartEnd
2016-02-18 16:21:04 +02:00
Aliaksandr Valialkin
445fb8a9ae
header: skip trailing CRLFs after request/response bodies
2016-02-16 19:37:51 +02:00
Aliaksandr Valialkin
0458fee5cd
Issue #15 : make sure that io.EOF isn't returned on incomplete request/response
2016-02-05 13:22:03 +02:00
Aliaksandr Valialkin
52d4b7ca38
Issue #15 : document that io.EOF is returned from Read* calls on (Request|Response)(Header)? only if the reader is closed before the first byte read
2016-02-05 13:14:36 +02:00
Aliaksandr Valialkin
81b5321d14
Removed misleading ConnectionCloseReal method from RequestHeader
2016-01-17 00:43:34 +02:00
Aliaksandr Valialkin
224aecb81d
Added explicit test for keepalive and non-keepalive HTTP/1.0 response
2016-01-17 00:30:13 +02:00
Sebastian Schepens
fa88c5b853
Don't assume Content-Encoding: identity when request is 1xx, 204 or 304
2016-01-12 15:23:14 -03:00
Aliaksandr Valialkin
8a83396595
FS: added support for byte range requests
2016-01-05 14:05:07 +02:00
Aliaksandr Valialkin
da83f137b7
Added SetMultipartFormBoundary* to RequestHeader
2015-12-31 14:20:21 +02:00