Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: add clean way to stop a no-content-length transfer from an HTTP2 Server #22604
With HTTP2 there is no more chunked encoding, instead it's built into the stream system. Now in many use cases the server may proxy responses back from other systems, or generate them on the fly, in which cases there is no content-length. It is possible that the proxying / processing breaks, and then it's not clear how to communicate the breakage to the client. If you just return the handler, the HTTP2 library will wrap it up like nothing happened and user will get truncated data.
With HTTP1, the common trick is to just hijack and close the connection. This works well.
A similar question for HTTP2 was asked here #14797
Would it be possible to expose the equivalent of a Hijack for HTTP2 streams, where one could explicitly abort the stream if needed?
What version of Go are you using (