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: Client does not support Hijack #28030

Open
drewwells opened this Issue Oct 5, 2018 · 4 comments

Comments

Projects
None yet
2 participants
@drewwells

drewwells commented Oct 5, 2018

Please answer these questions before submitting your issue. Thanks!

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

Go 1.11

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Applies to all architectures

What did you expect to see?

I expected to see a design plan for Hijack() of http.Response. I'm not an expert in the http package, but that seems to be the ideal place to do Hijacking. If there's still plans to discontinue ClientConn, then there needs to be an alternate way to Hijack() an http connection.

What did you see instead?

The issue was disregarded b/c it does not fit cleanly with http2: #8285 .

@bradfitz bradfitz changed the title from http.Client does not support Hijack() to net/http: Client does not support Hijack Oct 5, 2018

@bradfitz

This comment has been minimized.

Member

bradfitz commented Oct 5, 2018

You've described how you want to do something. What do you actually want to do? (i.e. http://xyproblem.info/)

In Go 1.12 the Transport's Response.Body will be writable in some cases (protocol upgrades like WebSockets, CONNECT requests, etc). Maybe that is what you're looking for?

@drewwells

This comment has been minimized.

drewwells commented Oct 6, 2018

I'm building an https_proxy that routes through an http server to determine a final http destination. After a target service is determined by the server https proxy dials to, this server hijacks the client connection, and connects to a destination.

@bradfitz

This comment has been minimized.

Member

bradfitz commented Oct 9, 2018

The typical answer for that (whether you're using CONNECT or any other request) is to dial your proxy directly and then https://golang.org/pkg/net/http/#Request.Write your request and https://golang.org/pkg/net/http/#ReadResponse the response.

But if you're using CONNECT requests or "Connection: upgrade", you'll be able to do bidirection requests with Go 1.12, assuming a few of these pending CLs get finished up, which I expect.

@drewwells

This comment has been minimized.

drewwells commented Oct 9, 2018

We're using Connect and TLS. Writing and Reading HTTP would be MITM, correct? I'm not familiar with Connection: upgrade would that involve writing our own protocol like websockets?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment