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

Open
mitar opened this issue May 22, 2021 · 3 comments
Open

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

mitar opened this issue May 22, 2021 · 3 comments
Labels
Projects
Milestone

Comments

@mitar
Copy link

@mitar 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

@networkimprov networkimprov commented May 24, 2021

@neild
Copy link
Contributor

@neild 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
Author

@mitar 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 May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Proposals
Incoming
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants