-
Notifications
You must be signed in to change notification settings - Fork 18k
net/http: support HTTP/2 #6891
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
Comments
I've been working on this. It will be out of the main tree first but will eventually be included I'm sure. Owner changed to @bradfitz. Status changed to Accepted. |
This work has been coming along nicely. Currently at https://github.com/bradfitz/http2 |
@bradfitz will there be a public API that will allow us to create streams and send data to/receive data from them? |
Yes. |
Awesome, is there anything we can start playing around with yet? Or even a proposed API to review? :-) |
Go look at https://github.com/bradfitz/http2 ... I'm already using it. Also note the open pull request that you'd be interested in. |
Are you referring to the Pushhandler PR? If so, I'm not sure that's exactly what I'm looking for. I'm hoping to be able to manage streams myself from the client and/or server side, passing data back and forth over each stream. |
CL https://golang.org/cl/15823 mentions this issue. |
CL https://golang.org/cl/15828 mentions this issue. |
This enables HTTP/2 by default (for https only) if the user didn't configure anything in their NPN/ALPN map. If they're using SPDY or an alternate http2 or a newer http2 from x/net/http2, we do nothing and don't use the standard library's vendored copy of x/net/http2. Upstream remains golang.org/x/net/http2. Update #6891 Change-Id: I69a8957a021a00ac353f9d7fdb9a40a5b69f2199 Reviewed-on: https://go-review.googlesource.com/15828 Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Andrew Gerrand <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
CL https://golang.org/cl/16090 mentions this issue. |
This is the start of wiring up the HTTP/2 Transport. It is still disabled in this commit. This change does two main things: 1) Transport.RegisterProtocol now permits registering "http" or "https" (they previously paniced), and the semantics of the registered RoundTripper have been extended to say that the new sentinel error value (ErrSkipAltProtocol, added in this CL) means that the Transport's RoundTrip method proceeds as if the alternate protocol had not been registered. This gives us a place to register an alternate "https" RoundTripper which gets first dibs on using HTTP/2 if there's already a cached connection. 2) adds Transport.TLSNextProto, a map keyed by TLS NPN/ALPN protocol strings, similar in feel to the existing Server.TLSNextProto map. This map is the glue between the HTTP/1 and HTTP/2 clients, since we don't know which protocol we're going to speak (and thus which Transport type to use) until we've already made the TCP connection. Updates #6891 Change-Id: I7328c7ff24f52d9fe4899facabf7ecc5dcb989f3 Reviewed-on: https://go-review.googlesource.com/16090 Reviewed-by: Andrew Gerrand <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
CL https://golang.org/cl/16180 mentions this issue. |
CL https://golang.org/cl/16181 mentions this issue. |
This adds the http2 Transport method needed by https://golang.org/cl/16090 to glue the HTTP/1 Transport (net/http.Transport) to the http2.Transport without throwing away fresh TCP connections after the TLS handshake determines which NPN/ALPN protocol was selected. Updates golang/go#6891 Change-Id: Iba004c8b1a149a5ee6c755d9a3fc1b19856a4e47 Reviewed-on: https://go-review.googlesource.com/16180 Reviewed-by: Andrew Gerrand <[email protected]>
We decided to glue together the HTTP/1 and HTTP/2 Transports in the other direction, having the HTTP/1 code (net/http.Transport) start the flow. Remove the http2 Transport.Fallback for now, rather than leaving it half implemented. For background, see https://golang.org/cl/16090 Updates golang/go#6891 Change-Id: I511bc6d35a1a9a8e20010bd95ff694a894f42aa4 Reviewed-on: https://go-review.googlesource.com/16181 Reviewed-by: Andrew Gerrand <[email protected]>
CL https://golang.org/cl/16310 mentions this issue. |
Some polish and testing remains, but this should be the bulk of the Transport work that was remaining. There's one notable (but easy) TODO about sending WINDOW_UPDATE frames every few hundred MB or so, but this is a checkpoint. Updates golang/go#6891 Change-Id: Iced9850804bf2c069c75118895ee7c3750ba31b5 Reviewed-on: https://go-review.googlesource.com/16310 Reviewed-by: Blake Mizerany <[email protected]>
CL https://golang.org/cl/16693 mentions this issue. |
CL https://golang.org/cl/16692 mentions this issue. |
…ew dials For integration with the net/http.Transport. Updates golang/go#6891 Change-Id: I7a44e4c4259aa57cec1b54666c333b5fc519caf8 Reviewed-on: https://go-review.googlesource.com/16692 Reviewed-by: Blake Mizerany <[email protected]>
The GODEBUG option remains, for now, but only for turning it off. We'll decide what to do with it before release. This CL includes the dependent http2 change (https://golang.org/cl/16692) in the http2 bundle (h2_bundle.go). Updates #6891 Change-Id: If9723ef627c7ba4f7343dc8cb89ca88ef0fbcb10 Reviewed-on: https://go-review.googlesource.com/16693 Reviewed-by: Blake Mizerany <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
CL https://golang.org/cl/17046 mentions this issue. |
This CL adds skipped failing tests, showing differences between HTTP/1 and HTTP/2 behavior. They'll be fixed in later commits. Only a tiny fraction of the net/http tests have been split into their "_h1" and "_h2" variants. That will also continue. (help welcome) Updates #6891 Updates #13315 Updates #13316 Updates #13317 Change-Id: I16c3c381dbe267a3098fb266ab0d804c36473a64 Reviewed-on: https://go-review.googlesource.com/17046 Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Andrew Gerrand <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
CL https://golang.org/cl/17205 mentions this issue. |
CL https://golang.org/cl/17204 mentions this issue. |
Fixes found in the process of adding more A/B tests to net/http, comparing HTTP/1 and HTTP/2 behaviors. Most of the new tests are in Gerrit change Id9c45fad44cdf70ac9 in the "go" repo. Fixes golang/go#13315 Fixes golang/go#13316 Fixes golang/go#13317 Fixes other stuff found in the process too Updates golang/go#6891 (http2 support in general) Change-Id: I83b5bfb471047312c0dcb0a0b21d709008f34136 Reviewed-on: https://go-review.googlesource.com/17204 Reviewed-by: Andrew Gerrand <[email protected]>
This compares the behavior of server handlers and the net/http Transport in both HTTP/1 and HTTP/2 mode and verifies they're the same. This also moves some client<->server tests into clientserver_test.go. Many of them were in serve_test.go or transport_test.go but were basically testing both. h2_bundle.go is an update of the golang.org/x/net/http2 code from https://golang.org/cl/17204 (x/net git rev c745c36eab10) Fixes #13315 Fixes #13316 Fixes #13317 Fixes other stuff found in the process too Updates #6891 (http2 support in general) Change-Id: Id9c45fad44cdf70ac95d2b89e578d66e882d3cc2 Reviewed-on: https://go-review.googlesource.com/17205 Reviewed-by: Andrew Gerrand <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]>
CL https://golang.org/cl/17241 mentions this issue. |
And updates h2_bundle.go with the fix from x/net/http2. Fixes #13298 Updates #6891 Change-Id: Ia25f22fa10e2a64b9d59211269882681aa18c101 Reviewed-on: https://go-review.googlesource.com/17241 Run-TryBot: Brad Fitzpatrick <[email protected]> Reviewed-by: Andrew Gerrand <[email protected]>
CL https://golang.org/cl/17134 mentions this issue. |
Fixes golang/go#13397 Updates golang/go#6891 Change-Id: I1e4c7bfe60c6abf9a03f2888aa6abc3891c309e7 Reviewed-on: https://go-review.googlesource.com/17134 Reviewed-by: Ian Lance Taylor <[email protected]>
I'm happy with the state of HTTP/2 now. Closing this meta bug. |
@bradfitz I glanced quickly at the code but didn't see a way to hijack the connection and create my own streams. Is that possible yet? |
CL https://golang.org/cl/17300 mentions this issue. |
@ncdc, we're not adding new API in Go 1.6. We can consider PUSH_PROMISE APIs in golang.org/x/net/http2 first, and only move things into the standard library when it's baked long enough in x/net. There were old proposals here: bradfitz/http2#23 But we no longer use that repo. Let's move this conversation to #13443 |
This mirrors the same behavior and API from the server code to the client side: if TLSNextProto is nil, HTTP/2 is on by default for both. If it's non-nil, the user was trying to do something fancy and step out of their way. Updates #6891 Change-Id: Ia31808b71f336a8d5b44b985591d72113429e1d4 Reviewed-on: https://go-review.googlesource.com/17300 Reviewed-by: Ian Lance Taylor <[email protected]> Run-TryBot: Brad Fitzpatrick <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
The text was updated successfully, but these errors were encountered: