net/http: should writeLoop flush data after writing the request? #33899
Labels
Milestone
Comments
It does this intentionally so requests with a slow/deferred Request.Body don't deadlock. I could dig through the git blame/history to link you to previous bugs with more detail, but you could too, so feel free to do so and add some notes here. I'm going to close this, as this seemed to just be a question and not a bug report. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Go are you using (
go version
)?1.12.9
Does this issue reproduce with the latest release?
Code review. Have question about the code
What operating system and processor architecture are you using (
go env
)?Code review. Have question about the code
go env
OutputWhat did you do?
writeLoop run wr.req.Request.write to send request,when it return err==nil it will run pc.bw.Flush() to flush buffered data.
There are two ways for wr.req.Request.write returning nil
waitForContinue return nil, the waitForContinue function will be waitForContinue, the only way waitForContinue returns false is when the persistConn close. In this case , there will no way to flush the buffered data
bw.Flush() and return nil. So it has flushed the buffered data.(And if bw) is nil, it won‘t need to flush
What did you expect to see?
writeLoop should not run Flush()
What did you see instead?
The text was updated successfully, but these errors were encountered: