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

net/http: Please support client-side Hijack #8285

Closed
gopherbot opened this issue Jun 25, 2014 · 2 comments
Closed

net/http: Please support client-side Hijack #8285

gopherbot opened this issue Jun 25, 2014 · 2 comments

Comments

@gopherbot
Copy link

With the deprecation notice at http://golang.org/pkg/net/http/httputil/#NewClientConn
it would be good to have client-side HTTP hijack support in a supported way.

Current RoundTripper etc force a request-reply cycle. I'm not sure what the ideal API
would look like; for my current use case, calling a hypothetical Response.Hijack before
reading Response.Body would be enough -- but I can see others arguing they'd like to be
in charge of reading the response headers too.

Related, it would be nice to be able to interact with the connection pool. Imagine
talking a back-and-forth protocol as a consequence of a HTTP request, concluding that
conversation, leaving the connection open, and letting the next HTTP request use it.
This applies both on the client and server side. (Ugly workarounds: a fake Listener for
server-side, that returns the previously-hijacked connections from Accept; for
client-side, a Dialer that does a non-blocking receive on a recycle channel first,
falling back to normal Dial if none are there -- this would duplicate the
connectMethodKey logic in net/http.)
@ianlancetaylor
Copy link
Contributor

Comment 1:

Labels changed: added repo-main, release-none.

@bradfitz bradfitz removed the new label Dec 18, 2014
@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@bradfitz
Copy link
Contributor

I have no plans of implementing this, so closing. http2 makes it even more complicated (what would it mean to hijack an http2 connection?)

@golang golang locked and limited conversation to collaborators Mar 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants