An answer from the app without a Content-Type reaches the client without one (closes #127)
check / check (push) Canceled after 0s

Go's server adds a Content-Type it guesses from the body when the
response's headers have no Content-Type key, which happened to some
of the app's answers and not others, as the first part of the body or
the headers went out first. When the app sends none, smallwebwaf now
sets the key with no value on the client's response, which sends none.

Model: opus-5-5
This commit is contained in:
2026-10-20 13:43:52 +00:00
parent 75f28ee0b5
commit 1e70698cfc
2 changed files with 42 additions and 0 deletions
+7
View File
@@ -421,6 +421,13 @@ func (rq *request) modifyResponse(res *http.Response) error {
return errResponseTooLarge
}
// Go's server adds a Content-Type it guesses from the body to a
// response whose headers have no Content-Type key. The key with no
// value sends none, as the app sent none.
if res.Header.Get("Content-Type") == "" {
rq.out.Header()["Content-Type"] = nil
}
res.Body = &responseBody{body: limitBody(res.Body, maxBytes), rq: rq}
rq.startClientResponseTimeout()