Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
|
|
* 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>
|
|
* Implement `GetRejectedConnectionsCount`
* Implement test for `GetRejectedConnectionsCount`
|
|
|
|
|
|
|
|
A few lines later we check if `s.ReduceMemoryUsage && hijackHandler == nil`
and call releaseWriter. We need to flush the buffer before returning it
to the pool to avoid the data getting lost.
|
|
gofmt -w -r "interface{} -> any" -l .
|
|
|
|
KeepHijackedConns is enabled. (#1629)
|
|
|
|
|
|
* fix:fasthttp server with tlsConfig
Signed-off-by: zhangweiyu <zhangweiyu2@huawei.com>
* fix:fasthttp server with tlsConfig
Signed-off-by: zhangweiyu <zhangweiyu2@huawei.com>
* Update server.go
Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
* fix:fasthttp server with tlsConfig
Signed-off-by: zhangweiyu <zhangweiyu2@huawei.com>
* fix:fasthttp server with tlsConfig
Signed-off-by: zhangweiyu <zhangweiyu2@huawei.com>
---------
Signed-off-by: zhangweiyu <zhangweiyu2@huawei.com>
Co-authored-by: zhangweiyu <zhangweiyu2@huawei.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
|
|
|
|
|
|
|
|
* 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
|
|
|
|
The serverName atomic.Value field is used as a cache. This is not needed and logic can be simplified.
See related #1458
|
|
|
|
|
|
|
|
|
|
|
|
sockets (#1432)
Make the code more succinct.
|
|
Co-authored-by: rocketlaunchr-cto <rocketlaunchr.cloud@gmail.com>
|
|
This was refactored out incorrectly in a previous change.
|
|
* fix(server): reset maxRequestBodySize to the server's config when HeaderReceived is set
* fix(server): reset writeTimeout
|
|
* 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
|
|
When calling closeIdleConns() also close new connections that haven't
received any data within 5 seconds.
Some applications open new connections but don't send anything and keep
them as keep-alive for potential future requests. We don't want to
keeping hanging on these when shutting down a server.
|
|
|
|
Header.SetCanonical() (#1311)
* Response.ContentEncoding(): store as field
The CE is not so often used for plain APIs responses and even not so often used for static files and on the fly compression.
But still it should be checked each time.
Also having a dedicated field getter and setter simplifies code
* header.go Use shorter Response.setNonSpecial() and Request.setNonSpecial() methods instead of SetCanonical()
The change should improve performance because the setSpecialHeader() call is omitted.
As a downside on adding a new basic header field all putHeader() must be replaced with a direct getter and setter.
|
|
* server.go Make code more clear
Inline isHTTP11 var.
Use direct Header.SetConnectionClose() and Header.ConnectionClose()
* server.go Use direct SetConnectionClose()
The SetCanonical(strConnection, strClose) call internally will anyway call SetConnectionClose().
The "Connection: close" will be printed in the ResponseHeader.AppendBytes()
* server.go Simplify connectionClose evaluation
The conn limit check merged into connectionClose evaluation.
This improves performance for most cases:
1. If the connectionClose already true then the conn limit check won't be performed.
2. The SetConnectionClose() was duplicated
3. First check conn limit and only then check for resp.connClose because most users don't close conns manually.
4. We may optimize more: If the resp.connClose = true then SetConnectionClose() not needed but as mentioned above this is a rare case.
|
|
|
|
Mostly in tests.
|
|
We have a RequestCtx pool per server so we only need to set it once.
This fixes a race codition where acquireCtx would assign .s while
.Done() is reading it. Even though acquireCtx would always set it to the
same, already assigned, value it would still trigger the race detector.
Fixes: https://github.com/valyala/fasthttp/issues/1261
|
|
* Require at least Go 1.15
* Fix StateActive state
* Don't panic when idle connections get closed
|
|
* 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
|
|
RequestCtx's are reused in a server specific pool, so no need to reset
it. This fixes a use after reset but when RequestCtx is use as context.
Fixes #1205
|
|
See: https://github.com/valyala/fasthttp/issues/1226
|
|
|
|
* fix(hijack): reuse RequestCtx
* fix(test/hijack): increase wait time
* fix(test/hijack): wait for all connections to finish to check responses
|
|
* fix(hijack): reset userValues after hijack handler execution
* feat: add test
* fix: typo
* fix(test): race condition
|
|
|
|
|