New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/http: Request Body error should not be ignored #7521
Labels
Milestone
Comments
Labels changed: added release-go1.3, repo-main. Owner changed to @bradfitz. Status changed to Accepted. |
Looks like Request.Write & transfer.go's WriteBody are fine, and properly return the error. Problem seems (at first glance) to be Transport: it writes in one goroutine and sends the correct error back on a channel (after marking the underlying conn as dead, so it won't be reused), but meanwhile another goroutine is reading the response, and gets a valid HTTP response from the server, so we return it. (And because the server didn't read the entire request body, it also notes that the connection is to be closed after the response, since it can't reuse that TCP connection....) We should also wait to know whether we finished writing the request before we return success to from the RoundTripper. |
In transfer.go on line 56 if there is an error and n == 0 error is ignored and t.Body is set to nil. Attached patch fixes this problem. Attachments:
|
This issue was closed by revision 2701dad. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: