Skip to content
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

fix closing of the http.Request.Body #2584

Merged
merged 2 commits into from
Jun 4, 2020
Merged

Conversation

marten-seemann
Copy link
Member

@marten-seemann marten-seemann commented Jun 2, 2020

Fixes #2551.

On the server side, the http.Request is consumed by the HTTP handler. The HTTP handler may close the body (it doesn't have to though). In any case, closing the stream is the wrong thing to do, since that closes the write side of the stream. All we want to do is cancel the stream (if the
EOF hasn't been read yet).

On the client side (for the http.Response) the same logic applies: When the application calls Body.Close(), all we want to do is cancel the stream (if the EOF hasn't been read yet).

On the server side, the http.Request is consumed by the HTTP handler.
The HTTP handler may close the body (it doesn't have to though). In any
case, closing the stream is the wrong thing to do, since that closes the
write side of the stream. All we want to do is cancel the stream (if the
EOF hasn't been read yet).
@codecov
Copy link

codecov bot commented Jun 2, 2020

Codecov Report

Merging #2584 into master will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #2584      +/-   ##
==========================================
- Coverage   86.28%   86.27%   -0.01%     
==========================================
  Files         122      122              
  Lines        9744     9738       -6     
==========================================
- Hits         8407     8401       -6     
  Misses        996      996              
  Partials      341      341              
Impacted Files Coverage Δ
http3/body.go 100.00% <100.00%> (ø)
http3/server.go 64.63% <100.00%> (-0.46%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c8e5bb5...83695e6. Read the comment docs.

@mholt
Copy link
Contributor

mholt commented Jun 2, 2020

Ah, you figured it out!! That's amazing! Would you like me to test as well? Let me know if I can do anything to help!

@marten-seemann marten-seemann merged commit 05514ab into master Jun 4, 2020
@marten-seemann marten-seemann deleted the http-body-fixes branch June 4, 2020 09:12
@marten-seemann marten-seemann mentioned this pull request Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

http3 post request with body failed
2 participants