net/http: Excess found: excess = 2 url = / (zero-length body) in HEAD response #62015
Labels
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes
What did you do?
I'm writing a response to http HEAD request that contains chunked Transfer-Encoding.
The response as written contains additional "\r\n".
The program below demonstrates the behavior
Output:
Note the
Excess found: excess = 2 url = / (zero-length body)
If you add
res.TransferEncoding = nil
before writing the response, the test passes but the response comes withConnection: close
.Output:
It makes it impossible to use http.Response::Write to implement
https://www.rfc-editor.org/rfc/rfc9110.html#section-9.3.2
The code should write the readers and skip the body as specified.
The text was updated successfully, but these errors were encountered: