Skip to content

http package should support HTTP/2 #67982

Open

Description

@alex
BPO 23794
Nosy @vstinner, @alex, @socketpair, @berkerpeksag, @vadmium, @swarmer, @sigmavirus24, @demianbrecht, @Lukasa, @raulcd, @dusek, @zengxs, @mayankasthana

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 = None
closed_at = None
created_at = <Date 2015-03-27.17:58:30.172>
labels = ['type-feature', 'library']
title = 'http package should support HTTP/2'
updated_at = <Date 2020-05-22.18:26:18.337>
user = 'https://github.com/alex'

bugs.python.org fields:

activity = <Date 2020-05-22.18:26:18.337>
actor = 'brett.cannon'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = ['Library (Lib)']
creation = <Date 2015-03-27.17:58:30.172>
creator = 'alex'
dependencies = []
files = []
hgrepos = []
issue_num = 23794
keywords = []
message_count = 12.0
messages = ['239424', '239447', '239457', '240019', '240021', '240022', '240612', '240614', '269578', '269580', '269581', '369627']
nosy_count = 14.0
nosy_names = ['vstinner', 'alex', 'socketpair', 'berker.peksag', 'martin.panter', 'anton.barkovsky', 'icordasc', 'demian.brecht', 'Lukasa', 'raulcd', 'fantix.king@gmail.com', 'dusek', 'zengxs', 'masthana']
pr_nums = []
priority = 'normal'
resolution = None
stage = 'needs patch'
status = 'open'
superseder = None
type = 'enhancement'
url = 'https://bugs.python.org/issue23794'
versions = ['Python 3.6']

Activity

  1. alex commented on Mar 27, 2015

    @alex
    MemberAuthor

    The spec is available at https://http2.github.io/

  2. added
    stdlibStandard Library Python modules in the Lib/ directory
    on Mar 27, 2015
  3. vadmium commented on Mar 28, 2015

    @vadmium
    Member

    This project may be of use for the client side of things: <https://github.com/lukasa/hyper\> (apparently MIT licensed).

  4. Lukasa commented on Mar 28, 2015

    Lukasamannequin
    Mannequin

    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.

  5. demianbrecht commented on Apr 3, 2015

    demianbrechtmannequin
    Mannequin

    +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.

  6. Lukasa commented on Apr 3, 2015

    Lukasamannequin
    Mannequin

    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.

  7. demianbrecht commented on Apr 3, 2015

    demianbrechtmannequin
    Mannequin

    @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!

  8. LudovicGasc commented on Apr 13, 2015

    LudovicGascmannequin
    Mannequin

    @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.

  9. Lukasa commented on Apr 13, 2015

    Lukasamannequin
    Mannequin

    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.

  10. socketpair commented on Jun 30, 2016

    socketpairmannequin
    Mannequin

    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.

  11. vstinner commented on Jun 30, 2016

    @vstinner
    Member

    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.

  12. Lukasa commented on Jun 30, 2016

    Lukasamannequin
    Mannequin

    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.

  13. brettcannon commented on May 22, 2020

    @brettcannon
    Member

    And now there's https://pypi.org/project/httpcore/ which wraps h2 and h11 into a single, low-level API.

  14. transferred this issue fromon Apr 10, 2022
  15. theypsilon commented on Jan 22, 2025

    @theypsilon

    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.

  16. brettcannon commented on Jan 22, 2025

    @brettcannon
    Member

    Is this something that will be considered for the next versions?

    Probably not. No one I know of is working on anything for inclusion into the stdlib for HTTP/2.

    It would be great to have at least the bare minimum requirements so that people can build the multiplexing themselves on top of that.

    There are libraries on PyPI that you could use today.

  17. theypsilon commented on Jan 22, 2025

    @theypsilon

    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.

  18. brettcannon commented on Jan 24, 2025

    @brettcannon
    Member

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions