You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently response handling occurs within the connection itself, but once we have response headers we should be handing off the body processing to the HTTP2Response object. This includes support for decoding gzip and other compressed bodies.
The text was updated successfully, but these errors were encountered:
The title of this issue states "Move response body handling into HTTP2Response", but the text says "hand off the body processing to the HTTPResponse object". So which did you mean? Given #3297, my understanding is that we'll have an HTTP2Response class that will subclass from BaseHTTPResponse. Is that right?
One subtlety compared to the HTTP/1.1 case with http.client is that today urllib3.connection.getresponse calls http.client.HTTPConnection.getresponse. From the content of the resulting http.client.HTTPResponse, it can create an urllib3.response.HTTPResponse (without inheritance). As a result, BaseHTTPResponse expects status, http version and headers when it's initialized. (Which provides a nice API: when urllib3.request returns a response, we can already inspect the headers and status code.)
For HTTP/2, if we completely move the current content of HTTP2Connection.getresponse in HTTP2Response, we won't be able to initialize the response with a status, http version and headers. Instead, I think HTTP2Connection.getresponse should start reading from the socket until it receives an h2.events.ResponseReceived event. At this point it will be able to build an HTTP2Response with status and headers and transfer the ownership of the state (socket, H2Connection, h2 lock and stream id) to HTTP2Response so that it can implement read() and stream().
To avoid ending up with two h2 event loops (one in HTTP2Connection and one in HTTP2Response), we could decide to have an object that owns the state and implement the h2 event loop, and it's that object that will be transferred between HTTP2Connection and HTTP2Response. The object will allow hiding some (but not all) specifics of the hyper-h2 API such as automatic flow control and decoding of headers. We could have one per multiplexed stream, and maybe call it ˋHTTP2Stream`
Currently response handling occurs within the connection itself, but once we have response headers we should be handing off the body processing to the HTTP2Response object. This includes support for decoding gzip and other compressed bodies.
The text was updated successfully, but these errors were encountered: