http3: respect request context while reading from the response body
Author: marten-seemannCreated Dec 14, 2023Updated Sep 21, 2026
Labelsbughelp wantedhttp3
The Go documentation for the request context says:
For an outgoing client request, the context controls the entire lifetime of a request and its response: obtaining a connection, sending the request, and reading the response headers and body.
The http.Response.Body therefore needs to return the context error as well. I confirmed that this is what HTTP/2 does.
Currently, we don't even pass the context to the body, and it's not clear to me how to correctly respect the context without spawning a new Go routine, since the Stream.Read call is blocking call.
Originally posted by @marten-seemann in https://github.com/quic-go/quic-go/pull/4203#discussion_r1426131710
Source: quic-go/quic-go