Commit Graph

22 Commits

Author SHA1 Message Date
Erik Dubbelboer 2272d532e1 Reimplement flushing support for fasthttpadaptor (#2081)
Use a simpler implementation, and do more tests.
Instead of https://github.com/valyala/fasthttp/pull/2069
2025-10-06 03:22:13 +02:00
Giovanni Rivera e04490f830 Add flushing support to fasthttpadaptor (#2054)
* Add flushing support to fasthttpadaptor

* refactor(fasthttphandler): Fix comment typos

* refactor(fasthttphandler): Fix early closing of net/http handler

* refactor(fasthttphandler): Apply requested changes

* refactor(fasthttphandler): Reduce memory allocations by using sync.Pool

* refactor(fasthttphandler): Fix improper releaseNetHTTPResponseWriter

* refactor(fasthttphandler): Add buffer sync.Pool with panic assert

* refactor(fasthttphandler): Fix hijacked-related response writer race condition

* refactor(fasthttphandler): Rename bufW to bufRW

* refactor(fasthttphandler): Ensure proper responseMutex use

* refactor(fasthttphandler): Specify minBufferSize to ensure reading 32 KiB chunks in streaming mode

* refactor(fasthttphandler): Fix release logic

* refactor(fasthttphandler): Fix handlerConn race condition

* refactor(fasthttphandler): Explicitly ignore handlerConn close error

* refactor(fasthttphandler): Use sync.Once, sync.Cond, and a single channel for mode management

* refactor(fasthttphandler): Remove commented code

* refactor(fasthttphandler): Add period to respect linter

* refactor(fasthttphandler): Remove return else clauses to respect lint
2025-09-11 17:36:02 +02:00
Sigmund Xia 夏天睿 65e989e8b8 Fix improper memory reuse in NewFastHTTPHandler (#1860)
* add test which will cause error

* rename test

* fix improper memory reuse in NewFastHTTPHandler

* move deep copy from VisitAll to f

* copy value string only for cookie
2024-09-10 20:05:52 +02:00
Oleksandr Redko 190204cf1a Upgrade golangci-lint to v1.56.2; fix gocritic issues (#1722) 2024-02-21 05:51:28 +01:00
gilwo aefd080674 adaptor ResponseWriter - adding Hijack method and pass proper fields (#1525)
* 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>
2024-02-17 14:51:38 +08:00
Oleksandr Redko f196617f55 chore: Use 'any' instead of 'interface{}' (#1666)
gofmt -w -r "interface{} -> any" -l .
2023-11-24 11:33:04 +01:00
Oleksandr Redko 934f04e330 Refactor golangci-lint config and remove redundant nolints (#1486)
* 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
2023-02-11 15:35:15 +08:00
kinggo bcf7e8e944 test: merge test in adaptor_test.go (#1381)
* test: merge test in adaptor_test.go

* Fix lint

Co-authored-by: Erik Dubbelboer <erik@dubbelboer.com>
2022-09-18 09:20:03 +02:00
Aoang a696949f6c Deprecate Go 1.15 (#1379)
* Dropping support for 1.15.

* Replaces Go 1.16 Deprecated functions

* Update test build flag

* Fix import sort and comment

* Update github.com/klauspost/compress to v1.15.9

https://github.com/klauspost/compress improved performance and changed Minimum version is 1.16, this should be the final supported release for Go 1.16 (https://github.com/klauspost/compress/commit/6d0019a95afa3221f7522d1f2eed0033b5e79470) .
2022-09-15 22:28:25 +03:00
Erik Dubbelboer 7a5afddf5b Use %v for errors and %q for strings (#1262)
Mostly in tests.
2022-04-01 18:11:16 +02:00
Erik Dubbelboer 9f2c63676d Lower go test time 2021-06-18 14:57:18 +02:00
Erik Dubbelboer 6233fbc08e Fix header .Add functions (#1036)
These functions should take the headers that are handled differently
into account.
2021-06-01 10:52:35 +02:00
Erik Dubbelboer 34a61fe63f Update linting (#851) 2020-07-17 14:22:28 +02:00
Erik Dubbelboer ef51a7e590 Fix fasthttpadaptor Content-Type detection
Make this in line with how net/http handles Content-Type.
2020-06-21 11:09:08 +02:00
Lovro Mažgon 8d8443d77c Forward context in fasthttpadaptor (#720)
* forward context in fasthttpadaptor

* run go fmt
2020-01-10 16:41:16 +01:00
Erik Dubbelboer 32793db72d Run golangci-lint using a Github Action 2019-11-16 18:09:28 +01:00
Maxim Lebedev d3715c361c Used Headers constants instead raw strings 2019-05-28 18:04:24 +03:00
Maxim Lebedev f544170d63 Added methods constants (#567)
*  Added methods constants

* 👌 Fixed methods comment due to review changes
2019-05-06 17:54:49 +02:00
Aliaksandr Valialkin 930362b9f8 go vet fix 2016-09-27 20:01:51 +03:00
Victor Gaydov 97d96cb3b7 Handle TransferEncoding in fasthttpadaptor (#124)
When incoming http.Request is constructed, "Transfer-Encoding" header
is removed, and http.Request.TransferEncoding is set instead.

This behaviour is now emulated in fasthttpadaptor.
2016-06-29 17:36:40 +03:00
Aliaksandr Valialkin 2af858a7da Follow-up for pull request #42: properly initialize Request.URL field 2016-01-28 11:31:53 +02:00
Aliaksandr Valialkin d53b8f0f3c Added net/http -> fasthttp converter for quick and easy switching to fasthttp 2016-01-06 17:11:43 +02:00