waitress
waitress copied to clipboard
HTTP/2 support
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?
👍
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.
- 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.
- There are some assumptions made in the code right now that a single
HTTPChannelis 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) - 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
Linksupport 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.
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.
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 ??
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/
Newer link for h2: https://github.com/python-hyper/h2