Age | Commit message (Collapse) | Author | Files | Lines |
|
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>
|
|
|
|
|
|
|
|
* add support for custom dial function with timeouts
* fix linting
---------
Co-authored-by: Aviv Carmi <aviv@perimeterx.com>
|
|
gofmt -w -r "interface{} -> any" -l .
|
|
|
|
Fixes #1654
|
|
* Allow redirect URI path to not be normalized.
* Introduce DisableRedirectPathNormalizing field to Request
* Use field name as start of comment.
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
---------
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
|
|
Co-authored-by: chenyunfei.cs <chenyunfei.cs@bytedance.com>
|
|
A timeout of 0 should timeout immediately. When retrying requests the
timeout should be updated to reflect the already passed time
Fixes https://github.com/valyala/fasthttp/issues/1617
|
|
* feat: allow connection close for custom streams
* fix: avoid req access since might already be released
* fix: fix aloc test fails
* fix: race condition when clossing body stream
|
|
|
|
|
|
|
|
* Abstracts the RoundTripper interface and provides a default implementation for enhanced extensibility (#1601)
* test: Add custom transport test case (#1601)
* Make default RoundTripper implmention none public
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
---------
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
|
|
|
|
The Timeout functions don't use separate goroutines anymore and use
normaly deadlines. Because of that requests are terminated and don't
keep running in the background as before.
|
|
* Update client.go
fix client http SetReadDeadline/SetWriteDeadline Deadline is reused
* delete Deadline comments fix test singleEchoConn implement SetWriteDeadline/SetReadDeadline
* fix test SetReadDeadline/SetWriteDeadline none implement
---------
Co-authored-by: gaoping <gaoping1@wps.cn>
|
|
* add the functions to get host clients
* add concurrency for client's HostClient map
* delete test code
* add lock in once block
* fix the problem: HostClient maybe delete when pendingClientRequests > 0
* fix the problem: HostClient maybe delete when pendingClientRequests > 0
---------
Co-authored-by: wangzhengkai.wzk <wangzhengkai.wzk@alibaba-inc.com>
|
|
* add the functions to get host clients
* add concurrency for client's HostClient map
* delete test code
* add lock in once block
---------
Co-authored-by: wangzhengkai.wzk <wangzhengkai.wzk@alibaba-inc.com>
|
|
|
|
* 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>
|
|
* update some codes style
* update adaptor.go and client.go
* Update fasthttpproxy/http.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
---------
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
|
|
* client: simplify (*HostClient).do()
Remove an allocation in favour of deferring a call to release the
response.
* client: remove panic in dialAddr
Return an error instead of panicking if the user supplied a nonsensical
DialFunc.
* compression: remove panic on invalid compression level
If a compression level exceeding gzip's boundaries is provided, fasthttp
will panic. Instead it would be better to handle this error for them by
limiting it to the minimum or maximum value, depending on the direction
the user has exceeded the limits.
Clamp the value of gzip to always be between gzip.BestSpeed and
gzip.BestCompression.
* peripconn: remove panic on negative connection count
When a negative count is reached when unregistering a connection, a
panic is caused even though data-integrity is not at risk.
Replace the panic() with a simple clamp on the value to ensure the
value does not exceed it's expected lower bounds.
References: #1504
* compress: remove error on failed nonblocking writes
Since there is no way of handling or even logging non-critical errors in
stateless non-blocking writecalls, just drop them and hope the user
notices and tries again.
* workerPool: remove panic on redundant Start and Stop calls
Instead of panicking for invalid behaviour, it's preferable to just turn
the function into a noop.
* http: remove panic on invalid form boundary
* http: remove panic on negative reads
Since bufio already panics on negative reads, it is not necessary to do
so as well. If the length is zero and for some reason no error is
returned, readBodyIdentity and appendBodyFixedSize now errors in these
cases.
Link: https://github.com/golang/go/blob/851f6fd61425c810959c7ab51e6dc86f8a63c970/src/bufio/bufio.go#L246
* fs: remove panic on negative reader count
When a negative count is reached when unregistering a reader, a panic is
thrown even though data-integrity is not at risk.
Replace the panic() with a simple clamp on the value to ensure the
value does not exceed it's expected lower bounds.
* server: remove panic in favour of a segfault
Panicking with "BUG: " obscures the error. As the segfault causes a
panic anyway, just let the chaos unfold.
* server: remove panic in favour of returning an error
Writing on a timed-out response is not endangering data integrity and
just fails.
* chore: add comments to all panics
* chore: fix minor typo
|
|
|
|
|
|
|
|
* fix: Immediately return ErrTimeout if deadline is already reached.
* test: Added tests for negative timeout
---------
Co-authored-by: Igor Menshenin <igor@native.rent>
|
|
Signed-off-by: cui fliter <imcusg@gmail.com>
|
|
|
|
* Refactor golangci-lint config
- Use golangci-lint-action for GitHub workflow.
- Add additional golangci-lint run options.
- Remove unused nolint directives.
* Revert exclude-use-default option
|
|
See https://github.com/golang/go/wiki/CodeReviewComments#initialisms
and https://go.dev/doc/effective_go#mixed-caps
|
|
|
|
The getClientName() checks if !NoDefaultUserAgentHeader then returns the Client.Name field.
But it also saves it to atomic field clientName. This is not needed and logic can be simplified.
Previously the clientName vas a byte slice that was copied from c.Name and cached. See 02e0722fb73c6237818b8e5af55957eb919a7334
Fix #1458
|
|
|
|
* client.go Make addMissingPort() public
It's needed for those who creates the instance of the HostClient manually.
* client.go fix AddMissingPort()
Previously for IPv6 addresses the default port wasn't added.
The fix adding a test and optimization that should avoid itoa() call and reduce a memory usage
|
|
(#1436)
|
|
|
|
|
|
All conn implementations having a Handshake() error method are now seen
as a TLS conn and aren't wrapped in another tls.Client.
|
|
net/http doesn't use it either. Some servers have issues with this
preventing fasthttp from working:
https://github.com/valyala/fasthttp/issues/1364
https://github.com/valyala/fasthttp/issues/1296
https://github.com/valyala/fasthttp/issues/1335
https://github.com/valyala/fasthttp/issues/984
Also removed code that benchmarks crypto/tls as that has nothing to do
with fasthttp.
|
|
* Update Go Version to Go1.19.x And add cache
* Fix CI Line endings
* Update test CI Go Version to Go1.19.x And add cache
* Update Gosec Security Scanner CI to securego/gosec@v2.12.0
* Format comment
Go 1.19 adds support for links, lists, and clearer headings in doc comments. As part of this change, gofmt now reformats doc comments to make their rendered meaning clearer. See “Go Doc Comments” for syntax details and descriptions of common mistakes now highlighted by gofmt. As another part of this change, the new package go/doc/comment provides parsing and reformatting of doc comments as well as support for rendering them to HTML, Markdown, and text.
ref: https://tip.golang.org/doc/go1.19
ref: https://tip.golang.org/doc/comment
* Fix doc structure
|
|
Don't run requests in a separate Goroutine anymore. Instead use proper
conn deadlines to enforce timeouts.
- Also contains some linting fixes.
|
|
* use timeout insteadof read/writetimeout when timeout lower than read/writetimeout
* use deadtime; fix test timeout;
Co-authored-by: 徐焱 <xuyan4@staff.sina.com.cn>
|
|
|
|
* Update tlsClientHandshake
* Update client.go
* Update client.go
* Update client.go
* Update client.go
* Changes according to the review
|
|
Mostly in tests.
|
|
* Add Go 1.18 support
* fix Gosec Security Scanner
https://github.com/valyala/fasthttp/runs/5595618634?check_suite_focus=true
* fix https://github.com/securego/gosec/issues/469#issuecomment-1070608395 Gosec Github Action Doesn't Work at Go 1.18
* fix https://github.com/golangci/golangci-lint/pull/2438 golangci/golangci-lint Doesn't Work at Go 1.18
* fix golint unused
* fix golint: SA1019: netErr.Temporary is deprecated
* fix https://github.com/valyala/fasthttp/issues/1256
|