waitress icon indicating copy to clipboard operation
waitress copied to clipboard

HTTP/2 support

Open robertlagrant opened this issue 10 years ago • 7 comments
trafficstars

Just pulled from the spec readme:

At a high level, HTTP/2:

is binary, instead of textual is fully multiplexed, instead of ordered and blocking can therefore use one connection for parallelism uses header compression to reduce overhead allows servers to "push" responses proactively into client caches

Sounds awesome. Is it doable for waitress?

robertlagrant avatar Feb 19 '15 08:02 robertlagrant

👍

xetch avatar Jan 21 '17 09:01 xetch

There have been a couple of requests for this, and there was some interest in doing this for GSoC.

I wanted to quickly add some notes that may be helpful in the future for someone that wants to implement HTTP/2 in waitress, as well as expectations I have for what that implementation looks like, and what I'd like to see if this were to be implemented for waitress.

  1. Waitress is a pure Python implementation, if HTTP2 is added, I would accept it as a default option if and only if it too is a pyre Python implementation. I'd prefer not to have to rely on other libraries, but if they are Python only it's not that bad, but no C code at all.
  2. There are some assumptions made in the code right now that a single HTTPChannel is associated with zero or one currently executing task (multiple requests can be queued up, and in a loop a task will be used to answer those requests). To take advantage of the fact that HTTP/2 allows multiple requests to be executed at the same time, that limitation would need to be removed. This also means that we need limitations on how many threads can be used by a single HTTP connection (a similar request is made in #88 but that is limiting how many connections a single client can make)
  3. We would want to introduce some sort of API that allows HTTP/2 push to be used. I like the idea of making it something like Cloudflare's Link support whereby it does a secondary request for the resource to be pushed.

I am sure there is more, first things first is enabling full SSL support in waitress, as well as the negotiation support being available to negotiate for HTTP2 in SSL.

digitalresistor avatar Feb 20 '17 22:02 digitalresistor

I would accept it as a default option if and only if it too is a pyre Python implementation.

https://python-hyper.org/h2/en/stable/ is probably the leading candidate here for a waitress dependency.

mmerickel avatar Feb 20 '17 23:02 mmerickel

We would want to introduce some sort of API that allows HTTP/2 push to be used. I like the idea of making it something like Cloudflare's Link support whereby it does a secondary request for the resource to be pushed

What is Cloudflare's Link ??

https://python-hyper.org/h2/en/stable/ is probably the leading candidate here for a waitress dependency.

I'm learning about the implementation of WSGI from http://wsgi.readthedocs.io/en/latest/

Is it right start ?? or should I be starting by learning implementation of using h2 https://python-hyper.org/h2/en/stable/basic-usage.html#writing-your-server ??

har33sh avatar Feb 22 '17 00:02 har33sh

https://blog.cloudflare.com/http-2-server-push-with-multiple-assets-per-link-header/ https://blog.cloudflare.com/announcing-support-for-http-2-server-push-2/

digitalresistor avatar Feb 22 '17 03:02 digitalresistor

Newer link for h2: https://github.com/python-hyper/h2

robertlagrant avatar Oct 27 '22 13:10 robertlagrant