Erik Dubbelboer
b8b065b0d7
Don't unwrap io.LimitedReader
...
This is not needed anymore to trigger sendfile. The Go wrapper around
sendfile already does this: https://github.com/golang/go/blob/9d46ee5ac4acd6602692f70c5149a3f6db058558/src/net/sendfile_linux.go#L23-L33
2021-06-12 13:16:36 +02:00
Erik Dubbelboer
6233fbc08e
Fix header .Add functions ( #1036 )
...
These functions should take the headers that are handled differently
into account.
v1.26.0
2021-06-01 10:52:35 +02:00
Erik Dubbelboer
5bb5cfc9ca
Remove unused peekRawHeader
2021-05-26 09:09:50 +02:00
Sergio Andrés Virviescas Santana
7d13e18a4f
Add Request.TLS and try to avoid a new alloc if Request.Header is already allocated ( #1034 )
2021-05-26 09:06:37 +02:00
Sergio Andrés Virviescas Santana
b433ecfcbd
Make sure to reset the userValues always and at the exact time ( #1027 )
...
* Ensure reset userValues always that release RequestCtx
* Reset userValues after response write and hijack handler are executed
2021-05-22 17:23:41 +02:00
Erik Dubbelboer
a18c6322a2
Fix cookie panic
2021-05-21 12:11:09 +02:00
Erik Dubbelboer
f3e4118c5b
Don't recommend Go 1.13
2021-05-21 11:59:58 +02:00
Sergio Andrés Virviescas Santana
fa3e5d85f2
Run test with go 1.16.X ( #1028 )
...
* Run test with go 1.16.X
* Fix min required go version
* Add go tip
* Update .github/workflows/security.yml
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
v1.25.0
2021-05-17 10:45:11 +02:00
MoreFreeze
ffa0cabed8
Use proper content-type when it is not present ( #1023 )
...
Co-authored-by: liuchenxing <liuchenxing@bytedance.com >
2021-05-17 09:20:18 +02:00
Nícolas Barbosa
04cde74c41
feature: add ConvertRequest func ( #1024 )
...
* feature: add ConvertRequest func
To easy method to convert ctx.RequestCtx to http.Request
* chore: minor changes by code review #1024
2021-05-17 09:20:10 +02:00
Sergio Andrés Virviescas Santana
5898006f5b
Upgrade dependencies and tidy ( #1029 )
2021-05-17 09:12:49 +02:00
MoreFreeze
097fa05a69
Fix ignoreBody still set content length ( #1022 )
...
* Fix ignore body should not set content-length
* Add TestRequestReadNoBody
Co-authored-by: liuchenxing <liuchenxing@bytedance.com >
2021-05-14 10:08:51 +02:00
Juan Chan
b2f111bd98
Fix(adaptor): Fixed an issue where the adapter did not convert all ( #1021 )
...
values of the header successfully when converting the header.
2021-05-11 09:58:25 +02:00
Roman Khimov
19fcd40863
Fix chunked streaming ( #1015 )
...
* http: refactor out crlf reading function
Make it a bit simpler and make it reusable.
* streaming: fix chunked stream test
This test is supposed to check for stream unchunking, but it's not really
effective with that because chunks created by createChunkedBody() get wrapped
into another chunk by writeBodyStream(), so we end up with chunkedBody in
request handler although what we really want is plain body.
Deduplicate test and benchmark also.
* streaming: fix Read interface
It wasn't actually compatible with io.Reader as io.Reader _never_ returns n >
len(p) while this function easily did that for chunked payloads confusing its
users:
panic: runtime error: slice bounds out of range [:528] with capacity 512
goroutine 562 [running]:
io.ReadAll(0x9f4380, 0xc0003be1a0, 0xc0004fcd80, 0x0, 0x0, 0xc00086bc30, 0x46f99b)
/usr/lib64/go/1.16/src/io/io.go:634 +0x205
io/ioutil.ReadAll(...)
/usr/lib64/go/1.16/src/io/ioutil/ioutil.go:27
github.com/valyala/fasthttp.getChunkedTestEnv.func1(0xc001fdc680)
/home/rik/dev/fasthttp/streaming_test.go:108 +0x6c
github.com/valyala/fasthttp.(*Server).serveConn(0xc000416d80, 0xa034e8, 0xc0004da880, 0x0, 0x0)
/home/rik/dev/fasthttp/server.go:2219 +0x12ee
github.com/valyala/fasthttp.(*workerPool).workerFunc(0xc000148960, 0xc0003be160)
/home/rik/dev/fasthttp/workerpool.go:223 +0xba
github.com/valyala/fasthttp.(*workerPool).getCh.func1(0xc000148960, 0xc0003be160, 0x8b4ec0, 0xc0003be160)
/home/rik/dev/fasthttp/workerpool.go:195 +0x35
created by github.com/valyala/fasthttp.(*workerPool).getCh
/home/rik/dev/fasthttp/workerpool.go:194 +0x11f
It also returned len(p) in some cases where it read less than that.
2021-05-04 12:55:54 +02:00
Lauris BH
620f0c83ad
Add option for middleware to set custom remote address ( #1009 )
...
* Add option for middleware to set custom remote address
* Update Init2 to clear custom context remoteAddr
v1.24.0
2021-04-23 13:25:02 +02:00
Lauris BH
894272e578
Fix golangci-lint action ( #1010 )
2021-04-23 09:17:45 +02:00
Daniel Firsht
2a6f7db5bb
Adding support for securing error logs ( #1001 )
...
Co-authored-by: Daniel Firsht <firsht@amazon.com >
v1.23.0
2021-03-26 10:46:57 +01:00
Mikhail Faraponov
e61c9d5d3c
Improve Client/HostClient pooling when many HostClient structs created and removed during program execution ( #1000 )
...
* Update client.go
* Update client.go
2021-03-25 22:47:39 +01:00
Mike Faraponov
a5830066b6
Use bytes.IndexByte instead of bytes.Index for single byte lookup ( #999 )
...
* Update uri.go
* Update strings.go
2021-03-20 15:57:57 +01:00
blanet
860c345f10
Fix unexpected panic when calling Do of a PipelineClient ( #997 )
...
* fix: Unexpected panic for PipelineClient
PipelineClient would panic when calling `Do` with a nil Response as
the second parm
This commit fixes the unexpected panic by checking nil first before
setting fields for Response
* Add tests to ensure nil resp is valid for PipelineClient
2021-03-17 21:26:56 +01:00
Vladimir Shteinman
0cd7349686
ImmediateHeaderFlush when no body ( #995 )
2021-03-15 18:10:51 +01:00
kiyon
02e0722fb7
Add PipelineClient name ( #994 )
...
* Improve documentation about DelClientCookie which related with #951 .
* Add pipeline name
2021-03-15 17:46:16 +01:00
peakle
1a7995ba88
format err info ( #989 )
2021-03-05 17:39:17 +01:00
kiyon
f40ea7eb40
Improve socks proxy ( #990 )
...
* Improve documentation about DelClientCookie which related with #951 .
* use proxy.FromURL to support auth
2021-03-05 17:38:59 +01:00
kiyon
34fa9a603f
Add DisableHeaderNamesNormalizing to PipelineClient ( #991 )
...
* Improve documentation about DelClientCookie which related with #951 .
* Add DisableHeaderNamesNormalizing to PipelineClient
2021-03-05 17:38:46 +01:00
Erik Dubbelboer
4637395dd7
Update deps
v1.22.0
2021-02-26 12:04:52 +01:00
kiyon
c3cd5e1554
Export HostClient.connsCount ( #981 )
...
Export HostClient.connsCount
2021-02-25 13:57:48 +01:00
Seva Maltsev
a4b0703152
Implemented DisablePathNormalizing in PipelineClient ( #977 )
2021-02-24 20:48:34 +01:00
Mike Faraponov
0880335533
Update compress.go ( #978 )
...
Add compatibility with flate.Reader to reduce allocations of bufio.NewReader structs backed by default size slices.
2021-02-24 20:43:56 +01:00
Mike Faraponov
e7294d2f70
Update client.go ( #979 )
2021-02-24 20:42:24 +01:00
kiyon
62dfc528ef
Fix Client ms cleaner ( #975 )
...
* Improve documentation about DelClientCookie which related with #951 .
* Fix ms cleaner in Client
2021-02-22 20:19:50 +01:00
Erik Dubbelboer
3cd0862fbb
Streaming fixes ( #970 )
...
- Allow DisablePreParseMultipartForm in combination with
StreamRequestBody.
- Support streaming into MultipartForm instead of reading the whole body
first.
- Support calling ctx.PostBody() when streaming is enabled.
v1.21.0
2021-02-16 21:53:53 +01:00
Darío
1b61ca2e36
Added Protocol() as a replacement of hardcoded strHTTP11 ( #969 )
...
* Added Protocol() as a replacement of hardcoded strHTTP11
* Applied review changes
* Modify h.proto in parseFirstLine
2021-02-16 21:53:40 +01:00
ZhangYunHao
52a8ab65e2
fix s2b go vet warning ( #967 )
2021-02-12 10:47:38 +01:00
AlphaBaby
a88030b8fb
fix gracefilly shutdown bug, issue #958 ( #960 )
...
* fix gracefilly shutdown bug, issue #958
* fix golangci-lint
* add option: CloseOnShutdown into Sever
* Update server.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
* Update server.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
Co-authored-by: fujianhao3 <fujianhao3@jd.com >
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
v1.20.0
2021-02-07 21:13:36 +01:00
Erik Dubbelboer
1494fdc53b
Fix clientGetURLDeadline
...
Based on https://github.com/valyala/fasthttp/pull/962
Make sure req is always released and fix a race condition.
2021-02-07 20:25:33 +01:00
Kirill Danshin
0956208cc6
Add request body streaming. Fixes #622 ( #911 )
...
* Add request body streaming. Fixes #622
* Add test cases for StreamRequestBody
Co-authored-by: Kiyon <kiyonlin@163.com >
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
Co-authored-by: Fiber
2021-02-06 23:03:23 +03:00
Erik Dubbelboer
fbe6a2d470
Add fasthttp.GenerateTestCertificate and use in tests
...
Remove ssl-cert-snakeoil so our tests don't fail in 2025.
2021-02-06 11:47:11 +01:00
Erik Dubbelboer
838d3abc3d
Allow concurrent ServeTLS
2021-02-06 10:53:30 +01:00
Erik Dubbelboer
3cec26d42d
Allow stopping FS handler cleanup gorountine ( #942 )
...
* Allow stopping FS handler cleanup gorountine
* CleanStop
2021-02-06 10:22:14 +01:00
Erik Dubbelboer
ed1cedd51e
Fix race condition in Client.DoTimeout
2021-02-06 10:20:15 +01:00
kiyon
5661df8bbd
Improve documentation about DelClientCookie which related with #951 . ( #956 )
2021-01-27 17:18:23 +01:00
Mike Faraponov
b4b40e9363
Do not start connsCleaner on SetConnectionClosed requests. ( #950 )
...
* Update client.go
* Update client.go
2021-01-22 22:22:19 +01:00
Erik Dubbelboer
70e00dc4f3
Ignore empty Transfer-Encoding headers
...
Don't default to chunked. If we have a Content-Length header we have a fixed body.
2021-01-06 19:18:12 +01:00
anshul-jain-aws
6234776e7c
Use QueryString while constructing RequestURI instead of QueryArgs if parsedQueryArgs is set to false ( #937 )
v1.19.0
2021-01-02 21:14:25 +01:00
Erik Dubbelboer
245e7ecded
CloseIdleConnections should also close TLS connections
2020-12-31 11:37:29 +01:00
Erik Dubbelboer
bd3513389d
Always set Keepalive options
...
Different versions of Go have different defaults, so we just always set
what the user configured.
2020-12-26 17:01:19 +01:00
Erik Dubbelboer
4e63057c0f
Make argsKV more predictable
...
Fixes #932
2020-12-26 16:53:48 +01:00
Kirill Danshin
d0dfbd4494
fix issue #875 ( #909 )
...
* 🐞 panic in fs.go #824
* fix issue #875
Signed-off-by: Kirill Danshin <kirill@danshin.pro >
* improve issue 875
Co-authored-by: Fenny <fenny@gofiber.io >
* Update header.go
* Update header.go
Co-authored-by: Kirill Danshin <kirill@danshin.pro >
* remove foldReplacer
* Improve removeNewLines
Start replacing at the first character found, use bytes.Indexbyte to
make the function signature more logical. Both bytes.indexByte and
strings.IndexByte use exactly the same code:
https://github.com/golang/go/blob/0c703b37dffe74d3fffc04347884bb0ee2fba5b3/src/internal/bytealg/indexbyte_amd64.s#L8-L20
Co-authored-by: wernerr <rene.werner@verivox.com >
Co-authored-by: wernerr <rene@gofiber.io >
Co-authored-by: Fenny <fenny@gofiber.io >
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com >
v1.18.0
2020-12-09 16:59:57 +01:00
Daniel Kürner
ec4aa43642
(header) do case insensitive lookup of cookie header value ( #925 )
...
Since some proxies might send i.e. a lowercase cookie header value, let´s do the lookup in a case insensitive way
2020-12-08 17:26:25 +01:00