h2 icon indicating copy to clipboard operation
h2 copied to clipboard

Add support for HTTP/1 upgrades to h2

Open seanmonstar opened this issue 6 years ago • 3 comments

I'm not saying doing the HTTP/1 parts of the upgrade, but after someone has started an upgrade, there is no way to tell h2 to continue with it.

  • A way to encode and decode a SETTINGS frame as base64url.
    • Perhaps for encoding, this could just be part of the client::Builder. With some settings set on the builder, builder.as_base64(&self) -> String or something could allow someone to send the HTTP2-Settings header.
    • For decoding, perhaps it could be part of a new handshake method on the server::Builder: builder.handshake_upgrade(io, base64settings)
  • A way to tell the client and server that the stream 1 is half-closed, and a response is expected.
    • The client could also get a handshake_upgrade method that returns a triple of (Connection, SendRequest, ResponseFuture).
    • The suggested handshake_upgrade for the server could return a (Connection, SendResponse).

seanmonstar avatar Jan 29 '18 17:01 seanmonstar

Relevant part of the spec: http://httpwg.org/specs/rfc7540.html#discover-http

seanmonstar avatar Jan 29 '18 17:01 seanmonstar

Just for my own reference, the upgrade initiator would be https://github.com/hyperium/hyper/issues/1395 on hyper side, right?

lucab avatar Feb 06 '18 15:02 lucab

@lucab probably not that issue specifically in hyper, but for h2, it wouldn't matter what created the connection and did the HTTP/1 request and received the 101 response, but after that point, you'd hand the connection to h2.


FWIW, I have been working on this, and am close to a PR.

seanmonstar avatar Feb 06 '18 20:02 seanmonstar