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: Export http2Transport #14394

Closed
jtolds opened this issue Feb 18, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@jtolds
Copy link
Contributor

commented Feb 18, 2016

Hey folks!

The Go net/http library of course now supports HTTP2, and the library expects HTTP2 protocol negotiation to happen as part of the TLS handshake. This is great and fine and good and to be encouraged, yay encrypting everything.

One of the interesting challenges with the Go implementation is that this negotiation happens under the covers, and is an internal detail to the library, away from programmer control. I do agree that's also probably a good default.

Unfortunately, this means that there isn't a way to do the negotiation for HTTP2 using a different crypto stack (or a different transport type entirely). I'm sure the Go developers don't feel awesome about the cgo-using https://github.com/spacemonkeygo/openssl, but the current situation is that it's faster, supports more hardware accelerated encryption, and people use it. I'd love to fix all of those issues, but even if they were fixed, I still think it's useful to support an ecosystem of crypto libraries, instead of just the one, albeit excellent, crypto/tls.

We're interested in using HTTP2 except with our own initial negotiation (whether or not it's our OpenSSL bindings). It currently looks like the only options to do our own HTTP2 protocol negotiation (instead of using crypto/tls) are to fork net/http to add the following 3 lines of code, or to write our own implementation of HTTP2:

// I FEEL SO BAD ABOUT THIS FORK
type HTTP2Transport struct {
    http2Transport
}

Obviously I'd prefer a s/http2Transport/HTTP2Transport/g over this struct addition.

I realize asking for a type to be exported adds a burdensome support requirement for future library releases wrt backwards compatibility guarantees, but this makes all of the HTTP2 protocol infrastructure vastly more usable and reusable.

What are the chances of this happening?

@bradfitz

This comment has been minimized.

Copy link
Member

commented Feb 18, 2016

Read the top of the file where you found the code you want to export.

h2_bundle.go is an auto-generated private bundle of the already-public https://godoc.org/golang.org/x/net/http2 package.

@bradfitz bradfitz closed this Feb 18, 2016

@jtolds

This comment has been minimized.

Copy link
Contributor Author

commented Feb 18, 2016

Thanks! Don't know how I missed that!

@golang golang locked and limited conversation to collaborators Feb 28, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.