rproxy: read the rest of a Connection: close visitor's body after an early answer (closes #373)
check / check (push) Waiting to run
check / check (push) Waiting to run
Go's server reads up to 256 KiB of a body left unread once the handler returns, but not a body with a declared length from a visitor that sent Connection: close. It closes that connection with the rest unread, and the visitor, still sending, gets a reset. rproxy now reads that rest itself, until the deadline already set on the connection, through a MaxBytesReader made with Go's own ResponseWriter. With more than 256 KiB left, that has Go's server tell the visitor it sends no more and wait 500 ms before it closes. Model: opus-5-5
This commit is contained in:
1 parent
c4bf76c966
commit
cb224bbb65
3 files changed
+139
-4
No files matched your search
@@ -169,6 +169,7 @@ func newWAFTransport() *http.Transport {
|
||||
// it writes the request's log line and sends its report.
|
||||
func (h *handler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
rq := h.newRequest(w, r)
|
||||
defer rq.readRestOfBody()
|
||||
defer rq.finish(r.Context())
|
||||
|
||||
if r.Method == http.MethodGet && r.URL.Path == waf.HealthPath {
|
||||
|
||||
Reference in new issue
Block a user