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
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee=Noneclosed_at=Nonecreated_at=<Date2015-03-27.17:58:30.172>labels= ['type-feature', 'library']
title='http package should support HTTP/2'updated_at=<Date2020-05-22.18:26:18.337>user='https://github.com/alex'
I'm happy to talk about bringing hyper's HTTP/2 layer into http.client. It's worth noting that at this point I have no current plans to build a server into hyper, though if there was interest in using hyper as a baseline then I could take a swing at it.
demianbrecht commented on Apr 3, 2015
demianbrechtmannequin
Mannequin
More actions
+1 to the adding the support for HTTP/2. I would personally like to see a few things happen before that though (which I've been putting some effort into as i can)
+ refactor http.client to cleanly separate transport from application protocol level
+ figure out some kind of adapter interface in order to facilitate swapping between 1.1 and 2 (This can start with a clean HTTP/1.1 interface)
+ full HTTP/1.1 support. Given (as i understand it) HTTP/2 is largely an extension of HTTP/1.1 it doesn't make much sense to me to implement the latter before the former.
Lukasa commented on Apr 3, 2015
Lukasamannequin
Mannequin
More actions
figure out some kind of adapter interface in order to facilitate swapping between 1.1 and 2 (This can start with a clean HTTP/1.1 interface)
I've been thinking about this a lot with hyper, and I'm about to start work on it (having just finished an alpha implementation of HTTP/1.1). My current plan is to try out a proxy object pattern, but you should feel free to use the hyper code as a leaping-off point for some experiments into how to do the swapping.
demianbrecht commented on Apr 3, 2015
demianbrechtmannequin
Mannequin
More actions
@cory: my own plan was to use your implementation as the baseline and add server support. If you take a crack at it that would be great!
LudovicGasc commented on Apr 13, 2015
LudovicGascmannequin
Mannequin
More actions
@demian.brecht: I don't know when, but certainly that we will add in aiohttp HTTP/2 support. If your implementation is enough modular, we could use some stuff like we did with urllib and HTTP/1 support.
Lukasa commented on Apr 13, 2015
Lukasamannequin
Mannequin
More actions
I spoke to some people after my PyCon talk about this, and agreed that it would be a good idea to split out the framing and HPACK stuff from hyper to make it easier for people like aiohttp to prototype.
The framing layer is already available from PyPI0 and on GitHub1, and I'm working on pulling the HPACK layer out right now2, which should be available later today.
socketpair commented on Jun 30, 2016
socketpairmannequin
Mannequin
More actions
Why not to use HTTP parser from Nginx ? I mean write binding using Cython.
Even if HTTP2 is a standard, it looks a little bit more complex than HTTP 1.1. It would be nice to start with a package on PyPI to keep fast evolution, and then wait until the API is stabilized before we put anything in the stdlib.
Or maybe we should start with a "subset" of HTTP2.
By the way, the issue title is "http package should support HTTP/2". Are you talking about the http client or client+server? I suggest to start with the client.
Lukasa commented on Jun 30, 2016
Lukasamannequin
Mannequin
More actions
It occurs to me that I should update this issue to mention that the HTTP/2 parser I spoke about above now exists, and has existed for some time, as hyper-h2. It's available on PyPI: https://pypi.python.org/pypi/h2
It's fully spec-compliant, and already used as the basis for HTTP/2 implementations in mitmproxy, Twisted, and hyper itself.
Is this something that will be considered for the next versions? It would be great to have at least the bare minimum requirements so that people can build the multiplexing themselves on top of that.
Thanks for replying so quickly. HTTP/2 in the stdlib would be useful for constrained systems where installing external dependencies is not an option. The current http client allowed me to implement keep alive, redirect cache and other features in a few lines of code https://github.com/MiSTer-devel/Downloader_MiSTer/blob/wip/src/downloader/http_gateway.py, so it would be great if one day that's also possible for HTTP/2 features.
HTTP/2 in the stdlib would be useful for constrained systems where installing external dependencies is not an option.
I totally understand the motivation of the ask, but we have to draw the line somewhere in terms of what we put in the stdlib. What's there to serve HTTP 1.1 is meant to help people who need a quick-and-dirty HTTP server, not something production-ready. And based on what I know about HTTP/2 it doesn't provide something that makes these sort of quick-and-dirty use-cases better such that we need to carry the burden to support the protocol.
Activity
alex commentedon Mar 27, 2015
The spec is available at https://http2.github.io/
vadmium commentedon Mar 28, 2015
This project may be of use for the client side of things: <https://github.com/lukasa/hyper\> (apparently MIT licensed).
Lukasa commentedon Mar 28, 2015
I'm happy to talk about bringing hyper's HTTP/2 layer into http.client. It's worth noting that at this point I have no current plans to build a server into hyper, though if there was interest in using hyper as a baseline then I could take a swing at it.
demianbrecht commentedon Apr 3, 2015
+1 to the adding the support for HTTP/2. I would personally like to see a few things happen before that though (which I've been putting some effort into as i can)
+ refactor http.client to cleanly separate transport from application protocol level
+ figure out some kind of adapter interface in order to facilitate swapping between 1.1 and 2 (This can start with a clean HTTP/1.1 interface)
+ full HTTP/1.1 support. Given (as i understand it) HTTP/2 is largely an extension of HTTP/1.1 it doesn't make much sense to me to implement the latter before the former.
Lukasa commentedon Apr 3, 2015
I've been thinking about this a lot with hyper, and I'm about to start work on it (having just finished an alpha implementation of HTTP/1.1). My current plan is to try out a proxy object pattern, but you should feel free to use the hyper code as a leaping-off point for some experiments into how to do the swapping.
demianbrecht commentedon Apr 3, 2015
@cory: my own plan was to use your implementation as the baseline and add server support. If you take a crack at it that would be great!
LudovicGasc commentedon Apr 13, 2015
@demian.brecht: I don't know when, but certainly that we will add in aiohttp HTTP/2 support. If your implementation is enough modular, we could use some stuff like we did with urllib and HTTP/1 support.
Lukasa commentedon Apr 13, 2015
I spoke to some people after my PyCon talk about this, and agreed that it would be a good idea to split out the framing and HPACK stuff from hyper to make it easier for people like aiohttp to prototype.
The framing layer is already available from PyPI0 and on GitHub1, and I'm working on pulling the HPACK layer out right now2, which should be available later today.
socketpair commentedon Jun 30, 2016
Why not to use HTTP parser from Nginx ? I mean write binding using Cython.
AFAIK, Nodejs already done that.
It is fast, and fully spec-compliant http-parser.
vstinner commentedon Jun 30, 2016
Even if HTTP2 is a standard, it looks a little bit more complex than HTTP 1.1. It would be nice to start with a package on PyPI to keep fast evolution, and then wait until the API is stabilized before we put anything in the stdlib.
Or maybe we should start with a "subset" of HTTP2.
By the way, the issue title is "http package should support HTTP/2". Are you talking about the http client or client+server? I suggest to start with the client.
Lukasa commentedon Jun 30, 2016
It occurs to me that I should update this issue to mention that the HTTP/2 parser I spoke about above now exists, and has existed for some time, as hyper-h2. It's available on PyPI: https://pypi.python.org/pypi/h2
It's fully spec-compliant, and already used as the basis for HTTP/2 implementations in mitmproxy, Twisted, and hyper itself.
brettcannon commentedon May 22, 2020
And now there's https://pypi.org/project/httpcore/ which wraps h2 and h11 into a single, low-level API.
theypsilon commentedon Jan 22, 2025
Is this something that will be considered for the next versions? It would be great to have at least the bare minimum requirements so that people can build the multiplexing themselves on top of that.
brettcannon commentedon Jan 22, 2025
Probably not. No one I know of is working on anything for inclusion into the stdlib for HTTP/2.
There are libraries on PyPI that you could use today.
theypsilon commentedon Jan 22, 2025
Thanks for replying so quickly. HTTP/2 in the stdlib would be useful for constrained systems where installing external dependencies is not an option. The current http client allowed me to implement keep alive, redirect cache and other features in a few lines of code https://github.com/MiSTer-devel/Downloader_MiSTer/blob/wip/src/downloader/http_gateway.py, so it would be great if one day that's also possible for HTTP/2 features.
brettcannon commentedon Jan 24, 2025
I totally understand the motivation of the ask, but we have to draw the line somewhere in terms of what we put in the stdlib. What's there to serve HTTP 1.1 is meant to help people who need a quick-and-dirty HTTP server, not something production-ready. And based on what I know about HTTP/2 it doesn't provide something that makes these sort of quick-and-dirty use-cases better such that we need to carry the burden to support the protocol.