Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

proposal: x/net/http2: support http.Hijacker #46319

Closed
mitar opened this issue May 22, 2021 · 10 comments
Closed

proposal: x/net/http2: support http.Hijacker #46319

mitar opened this issue May 22, 2021 · 10 comments

Comments

@mitar
Copy link
Contributor

mitar commented May 22, 2021

What version of Go are you using (go version)?

go version go1.16.4 linux/amd64

Does this issue reproduce with the latest release?

Yes.

What did you do?

I wanted to use Websockets over HTTP2.

What did you expect to see?

That HTTP2 ResponseWriter supports Hijacker.

What did you see instead?

That it does not. Exploring this more, it looks like it is on purpose:

But since then, WebSockets over HTTP2 have been standardized and Firefox and Chromium supports that. Thus, I suggest that now HTTP2 ResponseWriter should supports Hijacker so that one can use Websockets over HTTP2. The server should also be able to specify using HTTP/2 SETTINGS parameter that it supports Websockets over HTTP2.

@seankhliao seankhliao changed the title Support Hijacker on HTTP2 ResponseWriter proposal: x/net/http2: support http.Hijacker May 22, 2021
@gopherbot gopherbot added this to the Proposal milestone May 22, 2021
@networkimprov
Copy link

cc @fraenkel @neild @bradfitz

@neild
Copy link
Contributor

neild commented May 24, 2021

The Hijacker interface takes over the TCP connection. HTTP/1 WebSocket connections start with an HTTP handshake after which the connection is passed to the WebSocket implementation.

WebSockets over HTTP/2 do not take over the TCP connection. Instead, the WebSocket protocol runs over an HTTP/2 stream. HTTP/2 permits multiple simultaneous streams on a TCP connection. HTTP/2 WebSockets need a way to read from and write to the HTTP/2 stream for a request, not a way to hijack the connection.

@mitar
Copy link
Contributor Author

mitar commented May 24, 2021

So a new type of interface, of exposing something like a TCP connection on top of HTTP/2?

Maybe I should rename this issue then to "support for WebSockets over HTTP/2". :-)

@ianlancetaylor ianlancetaylor added this to Incoming in Proposals (old) May 26, 2021
@rsc
Copy link
Contributor

rsc commented Nov 10, 2021

Talking to @bradfitz, it sounds like the HTTP/2 + WebSockets is defined in RFC 8441. And as @neild pointed out, it doesn't need to use Hijacker. So it seems like we should decline this proposal and add explicit WebSockets support instead.

It sounds like the latest Chrome (and presumably Edge) have support, as does Firefox, but perhaps not Safari.

@rsc
Copy link
Contributor

rsc commented Nov 10, 2021

This proposal has been added to the active column of the proposals project
and will now be reviewed at the weekly proposal review meetings.
— rsc for the proposal review group

@rsc rsc moved this from Incoming to Active in Proposals (old) Nov 10, 2021
@rsc rsc moved this from Active to Likely Decline in Proposals (old) Dec 1, 2021
@rsc
Copy link
Contributor

rsc commented Dec 1, 2021

Based on the discussion above, this proposal seems like a likely decline.
— rsc for the proposal review group

@mitar
Copy link
Contributor Author

mitar commented Dec 1, 2021

Just to be clear, should I open a new issue for "support for WebSockets over HTTP/2" or rename the title of this one?

@ianlancetaylor
Copy link
Contributor

@mitar Please open a new issue to avoid confusion. Thanks.

@mitar
Copy link
Contributor Author

mitar commented Dec 2, 2021

I have made #49918 as a followup to this issue.

@rsc rsc moved this from Likely Decline to Declined in Proposals (old) Dec 8, 2021
@rsc
Copy link
Contributor

rsc commented Dec 8, 2021

No change in consensus, so declined.
— rsc for the proposal review group

@rsc rsc closed this as completed Dec 8, 2021
@golang golang locked and limited conversation to collaborators Dec 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

No branches or pull requests

6 participants