Commit Graph

13 Commits

Author SHA1 Message Date
Erik Dubbelboer 87f0fe1394 Update securego/gosec from 2.23.0 to 2.25.0 (#2161) 2026-03-20 07:27:24 +01:00
Erik Dubbelboer c2b317d47d Go 1.26 and golangci-lint updates (#2146)
Keep Go 1.24 compatibility for now (by not using `wg.Go()`).
2026-02-21 10:28:39 +01:00
Erik Dubbelboer 48f3a2f423 Fix panic when perIPConn.Close is called multiple times (#1993)
This happens when a perIPConn is idle and closed during
Server.Shutdown() and then again closed by the WorkerFunc returning.
2025-04-12 04:36:07 +02:00
Kirill 7c9c003d1d fix: type assertion to perIPTLSConn instead of erroneous perIPConn (#1863) 2024-09-21 16:39:36 +02:00
Juan Calderon-Perez 1fb3453165 Use Named Fields and Align Structures to Reduce Memory Usage (#1814)
* Use Named fields and Align Structures to Reduce Memory Usage

* Remove extra spaces
2024-08-02 22:26:52 +02:00
Erik Dubbelboer 105eb3bcd9 Add perIPTLSConn to support MaxConnsPerIP with tls connections
Otherwise calling RequestCtx.TLSConnectionState() will fail.

Fixes #1770
2024-04-29 15:17:14 +02:00
Moritz Poldrack d0f2727a4d get rid of some panics (#1526)
* 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
2023-03-30 03:38:28 +02:00
tyltr 404c8a8968 Chore (#1365)
* chore-1

* chore2
2022-08-29 07:51:37 +02:00
Aliaksandr Valialkin 57cbe65ddc scalability improvement: use per-server peripconn pool 2016-03-30 20:34:07 +03:00
Aliaksandr Valialkin d2db95337f Removed 'v interface{}' hack from structs managed via sync.Pool, since it has no sense 2015-12-23 11:39:40 +02:00
Aliaksandr Valialkin 8081e14ca0 Use perIPConn pool 2015-11-10 15:20:13 +02:00
Aliaksandr Valialkin a7fdc68be0 Enforce MaxConnsPerIP limit to connections served via Server.ServeConn() 2015-11-05 10:56:04 +02:00
Aliaksandr Valialkin 3eaecd9c6c Added ability to limit the number of concurrent client connections per ip 2015-11-02 15:09:45 +02:00