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

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

net/http: Client does not support Hijack #28030

drewwells opened this issue Oct 5, 2018 · 4 comments
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@drewwells
Copy link

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 http.Client does not support Hijack() net/http: Client does not support Hijack Oct 5, 2018
@bradfitz
Copy link
Contributor

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?

@bradfitz bradfitz added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 5, 2018
@drewwells
Copy link
Author

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
Copy link
Contributor

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
Copy link
Author

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?

@agnivade agnivade removed the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Oct 14, 2019
@ALTree ALTree added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Dec 4, 2019
@ALTree ALTree added this to the Unplanned milestone Dec 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FeatureRequest NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

4 participants