Commit Graph

18 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
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
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
Shawn 9b4a7e5bf4 fix http2 adapter (#1457) 2022-12-25 10:07:22 +01:00
Qing Moy af94725d11 Reduce slice growth in adaptor (#1356) 2022-08-16 10:28:42 +02:00
Aoang ea6052464e Add Go 1.19 Support (#1355)
* 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
2022-08-14 11:31:57 +02:00
Erik Dubbelboer 7a5afddf5b Use %v for errors and %q for strings (#1262)
Mostly in tests.
2022-04-01 18:11:16 +02:00
Nícolas Barbosa 04cde74c41 feature: add ConvertRequest func (#1024)
* feature: add ConvertRequest func

To easy method to convert ctx.RequestCtx to http.Request

* chore: minor changes by code review #1024
2021-05-17 09:20:10 +02:00
Juan Chan b2f111bd98 Fix(adaptor): Fixed an issue where the adapter did not convert all (#1021)
values of the header successfully when converting the header.
2021-05-11 09:58:25 +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
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
Zviad Metreveli 8b7405a861 add missing import 2016-01-27 19:07:56 -05:00
Zviad Metreveli 4fd339e8c5 fix fasthttpadaptor to work with http.ServeMux in Go 1.5 2016-01-27 19:02:42 -05:00
Aliaksandr Valialkin d53b8f0f3c Added net/http -> fasthttp converter for quick and easy switching to fasthttp 2016-01-06 17:11:43 +02:00