sozu-proxy / sozu

Sōzu HTTP reverse proxy, configurable at runtime, fast and safe, built in Rust. It is awesome!
https://www.sozu.io/
GNU Affero General Public License v3.0
3k stars 187 forks source link

Initial H2 thought by geal #99

Open Geal opened 7 years ago

Geal commented 7 years ago

In gitlab by @Geal on Jan 11, 2017, 11:15

right now, the proxy supports HTTP, HTTPS, TCP, and Websockets. It can upgrade a connection between protocols, but the condition is always that the protocol is the same for client<->proxy and proxy<->backend connections.

With HTTP/2, we want to support different use cases, like:

And this should be working with protocol upgrades as well.

First thoughts:

Plan (for now):

Geal commented 6 years ago

depends on #257 and #258

Geal commented 6 years ago

RFC 7540 for HTTP/2: http://httpwg.org/specs/rfc7540.html RFC 7541 for HPACK (header compression): http://httpwg.org/specs/rfc7541.html

Parsing and generating the different frames should not be too hard. Handling the ALPN dance will be ok too. The stream state machine is well defined (there are still lots of details and failure cases to handle correctly). The complex part appears to be in flow control and stream priorities. About half the mentions of proxy specific behaviour are around the CONNECT HTTP method, which may not be really interesting to handle for now.

Geal commented 6 years ago

Parts of https://github.com/carllerche/h2 might be reusable. https://github.com/mlalic/hpack-rs is not really maintained. https://github.com/carllerche/bytes would be interesting for buffer handling, since it can work correctly with multiple subsets of the data: https://carllerche.github.io/bytes/bytes/struct.Bytes.html

Geal commented 5 years ago

development has started in the h2 branch. It is only plugged into the HTTPS Openssl proxy for now.

How to test

cf https://blog.cloudflare.com/tools-for-debugging-testing-and-using-http-2/

curl

curl --http2 -kv http://lolcatho.st:8443/

h2c

~/.go/bin/h2c connect lolcatho.st:8443
~/.go/bin/h2c get /

Compliance

We will need to test with h2spec

Current version is using the hpack crate, we might need to write a new one at some point

Related issues:

Geal commented 4 years ago

some things to keep in mind for this implementation: https://github.com/Netflix/security-bulletins/blob/master/advisories/third-party/2019-002.md

dlecan commented 3 years ago

With HTTP/3 coming, it’s high time to support http/2, isn’t it? Any idea when this support will be available?