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

net/http: no error after reading from closed gzip HTTP/2 response body #56020

Closed
neild opened this issue Oct 4, 2022 · 1 comment
Closed
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@neild
Copy link
Contributor

neild commented Oct 4, 2022

When reading a gzipped response body (via an *http2.gzipReader), closing the body doesn't necessarily cause subsequent reads to fail because gzipReader.Close only closes the underlying response body. Buffered data in the gzip.Reader can still be read.

This causes the existing test TestTransportGzip to fail when run in HTTP/2 mode.

@neild neild added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 4, 2022
@neild neild added this to the Backlog milestone Oct 4, 2022
@gopherbot
Copy link

Change https://go.dev/cl/440555 mentions this issue: x/net/http2: gzipReader will reset zr to nil after closing body

WeiminShang added a commit to WeiminShang/net that referenced this issue Nov 16, 2022
The existing implementation does not reset gz.zr. After Close,
gzipReader closes underlying response body but buffered data can still
be read.

gzipReader on Close sets the gz.zerr to fs.ErrClosed so next Read after
Close will return it immediately.

Fixes golang/go#56020

Change-Id: I8a31e4c65656b9abc3023855b8e04342e1e77cbb
Reviewed-on: https://go-review.googlesource.com/c/net/+/440555
Reviewed-by: Damien Neil <dneil@google.com>
Run-TryBot: Damien Neil <dneil@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Reviewed-by: Than McIntosh <thanm@google.com>
@golang golang locked and limited conversation to collaborators Nov 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

2 participants