classification
Title: http package should support HTTP/2
Type: enhancement Stage: needs patch
Components: Library (Lib) Versions: Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Lukasa, alex, anton.barkovsky, berker.peksag, demian.brecht, dusek, fantix.king@gmail.com, icordasc, martin.panter, masthana, raulcd, socketpair, vstinner, zengxs
Priority: normal Keywords:

Created on 2015-03-27 17:58 by alex, last changed 2020-05-22 18:26 by brett.cannon.

Messages (12)
msg239424 - (view) Author: Alex Gaynor (alex) * (Python committer) Date: 2015-03-27 17:58
The spec is available at https://http2.github.io/
msg239447 - (view) Author: Martin Panter (martin.panter) * (Python committer) Date: 2015-03-28 01:16
This project may be of use for the client side of things: <https://github.com/lukasa/hyper> (apparently MIT licensed).
msg239457 - (view) Author: Cory Benfield (Lukasa) * Date: 2015-03-28 07:12
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.
msg240019 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-04-03 18:06
+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.
msg240021 - (view) Author: Cory Benfield (Lukasa) * Date: 2015-04-03 18:11
> 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.
msg240022 - (view) Author: Demian Brecht (demian.brecht) * (Python triager) Date: 2015-04-03 18:11
@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!
msg240612 - (view) Author: Ludovic Gasc (Ludovic.Gasc) * Date: 2015-04-13 14:30
@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.
msg240614 - (view) Author: Cory Benfield (Lukasa) * Date: 2015-04-13 14:35
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 PyPI[0] and on GitHub[1], and I'm working on pulling the HPACK layer out right now[2], which should be available later today.

[0]: https://pypi.python.org/pypi/hyperframe
[1]: https://github.com/Lukasa/hyperframe
[2]: https://github.com/Lukasa/hpack
msg269578 - (view) Author: Марк Коренберг (socketpair) * Date: 2016-06-30 12:23
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.
msg269580 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2016-06-30 12:37
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.
msg269581 - (view) Author: Cory Benfield (Lukasa) * Date: 2016-06-30 12:49
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.
msg369627 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2020-05-22 18:25
And now there's https://pypi.org/project/httpcore/ which wraps h2 and h11 into a single, low-level API.
History
Date User Action Args
2020-05-22 18:26:18brett.cannonsetnosy: - brett.cannon
2020-05-22 18:25:44brett.cannonsetmessages: + msg369627
2019-02-28 13:50:35Ludovic.Gascsetnosy: - Ludovic.Gasc
2019-02-28 01:20:20yan12125setnosy: - yan12125
2018-10-12 14:37:39masthanasetnosy: + masthana
2018-10-12 11:07:57anton.barkovskysetnosy: + anton.barkovsky
2018-07-27 02:05:31yan12125setnosy: + yan12125
2018-07-26 06:25:36zengxssetnosy: + zengxs
2016-06-30 12:49:00Lukasasetmessages: + msg269581
2016-06-30 12:37:23vstinnersetnosy: + vstinner
messages: + msg269580
2016-06-30 12:23:30socketpairsetnosy: + socketpair
messages: + msg269578
2016-06-30 09:11:29duseksetnosy: + dusek
2016-01-26 03:12:33fantix.king@gmail.comsetnosy: + fantix.king@gmail.com
2015-04-14 21:58:24raulcdsetnosy: + raulcd
2015-04-13 14:35:12Lukasasetmessages: + msg240614
2015-04-13 14:30:38Ludovic.Gascsetnosy: + Ludovic.Gasc
messages: + msg240612
2015-04-03 18:11:38demian.brechtsetmessages: + msg240022
2015-04-03 18:11:19Lukasasetmessages: + msg240021
2015-04-03 18:06:08demian.brechtsetnosy: + demian.brecht
messages: + msg240019
2015-03-28 12:34:26brett.cannonsetnosy: + brett.cannon
2015-03-28 07:12:36Lukasasetmessages: + msg239457
2015-03-28 01:21:09icordascsetnosy: + Lukasa
2015-03-28 01:16:19martin.pantersetnosy: + martin.panter
messages: + msg239447
2015-03-27 18:14:57icordascsetnosy: + icordasc
2015-03-27 18:01:27berker.peksagsetnosy: + berker.peksag
stage: needs patch
type: enhancement

versions: + Python 3.6
2015-03-27 17:58:30alexcreate