aboutsummaryrefslogtreecommitdiff
path: root/streaming.go
AgeCommit message (Collapse)AuthorFilesLines
2023-11-24chore: Use 'any' instead of 'interface{}' (#1666)Gravatar Oleksandr Redko 1-1/+1
gofmt -w -r "interface{} -> any" -l .
2023-05-11Refactor by removing unnecessary else block (#1559)Gravatar Oleksandr Redko 1-10/+9
2023-04-05support response body stream (#1414)Gravatar Anthony-Dong 1-7/+12
* feat: support response body stream * style: add header interface * Update http.go Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com> * feat: support request、response、client stream * fix: close reader bug --------- Co-authored-by: fanhaodong.516 <fanhaodong.516@bytedance.com> Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2022-04-26Fix DoTimeout Streaming body bugv1.36.0Gravatar Erik Dubbelboer 1-0/+1
2021-12-05Add trailer support (#1165)Gravatar ichx 1-13/+12
* Add trailer support * fix issue and add documentation * remove redundant code * add error return for add/set trailer method * fix lint error * fix bad trailer error return issue and update bad content-length error * update errNonNumericChars * update errNonNumericChars * fix issue about error and fix typo
2021-05-04Fix chunked streaming (#1015)Gravatar Roman Khimov 1-19/+30
* 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-02-16Streaming fixes (#970)v1.21.0Gravatar Erik Dubbelboer 1-1/+10
- 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.
2021-02-06Add request body streaming. Fixes #622 (#911)Gravatar Kirill Danshin 1-0/+89
* 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