* Fix possible race condition on request ctx done #1662
* Fix possible race condition on request ctx done #1662
* Fix Comment
* fix remove the use of lock
* fix remove Comment
1. Reduce RequestHeader from 368 bytes to 360 bytes
2. Reduce Request from 816 bytes to 800 bytes
3. Reduce Response from 432 bytes to 416 bytes
4. Reduce Client from 312 bytes to 288 bytes
5. Reduce HostClient from 416 bytes to 392 bytes
6. Reduce PipelineClient from 176 bytes to 168 bytes
7. Reduce pipelineConnClient from 216 bytes to 208 bytes
8. Reduce Cookie from 232 bytes to 224 bytes
9. Reduce FS from 184 bytes to 160 bytes
10. Reduce fsHandler from 168 bytes to 160 bytes
11. Reduce ResponseHeader from 328 bytes to 320 bytes
12. Reduce headerScanner from 128 bytes to 120 bytes
13. Reduce TCPDialer from 104 bytes to 96 bytes
14. Reduce workerPool from 152 btyes to 144 btyes
* Don't allow \r in header names
From RFC 9112:
A sender MUST NOT generate a bare CR (a CR character not immediately
followed by LF) within any protocol elements other than the content.
A recipient of such a bare CR MUST consider that element to be invalid
or replace each bare CR with SP before processing the element or forwarding
the message.
net/http seems to completely error on this, so let's do the same.
Fixes https://github.com/valyala/fasthttp/issues/1785
* Validate the full header field
It's better to use an environment variable as they are more standard.
They way flags are parsed isn't standardized within the Go ecosystem.
Fixes: https://github.com/valyala/fasthttp/issues/1782
* fix: propagate body stream error to close function (#1743)
* feat: add address in ErrDialTimeout
* feat: add address in any `tryDial` error
* feat: use struct to wrap error with upstream info
* fix: lint
* fix: wrapped Error() method
* docs: add example to ErrDialWithUpstream
* feat: add address in ErrDialTimeout
* feat: add address in any `tryDial` error
* feat: use struct to wrap error with upstream info
* fix: lint
* fix: wrapped Error() method
* docs: add example to ErrDialWithUpstream
* docs: fix example for ErrDialWithUpstream
---------
Co-authored-by: Max Denushev <denushev@tochka.com>
* Implemented what was described by me in issue#1766.
* fixed linting isssues in fs.go with gofmt -e -d -s
---------
Co-authored-by: Raphael Habichler <raphael.habichler@bmd.at>
When using a url like http://example.com,/ URI will parse "example.com,"
as host. HostClient then splits this by "," into multiple addresses and
will connect to example.com. HostClient splitting the address by "," is
only for direct use, not for use with Client.
* fix: propagate body stream error to close function (#1743)
* fix: http test
* fix: close body stream with error in encoding functions
* fix: lint
---------
Co-authored-by: Max Denushev <denushev@tochka.com>
* feat:support zstd compress and uncompressed
* fix:real & stackless write using different pool to avoid get stackless.writer
* fix:zstd normalize compress level
* Change empty string checks to be more idiomatic (#1684)
* chore:lint fix and rebase with master
* chore:remove 1.18 test & upgrade compress version
* fix:error default compress level
* Fix lint
---------
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
* adding hijack method and pass proper fields
* adding hijack method and pass proper fields - adding tests
* improve hijack handling, use proper test for hijacking
* extend hijackhandler propogation to NewFastHTTPHandlerFunc
* align hijacking of fasthttp adaptor net request with fasthttp request, safe conn handling for proper release of resources and custom hijack handler for more controlled by hijacking implementation
* Implement actual behaviour of net/http Hijacker
---------
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
* Prevent request smuggling
Prevent request smuggling when fasthttp is behind a reverse proxy that
might interprets headers differently by being stricter. Should also
prevent request smuggling when fasthttp is used as the reverse proxy.
* Make header value comparison case-insensitive