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: support HTTP/2 #6891

Closed
mikioh opened this issue Dec 4, 2013 · 25 comments
Closed

net/http: support HTTP/2 #6891

mikioh opened this issue Dec 4, 2013 · 25 comments

Comments

@mikioh
Copy link
Contributor

mikioh commented Dec 4, 2013

Just a thought, because it's a bit big and long-term stuff.

Hypertext Transfer Protocol version 2.0
http://tools.ietf.org/html/draft-ietf-httpbis-http2

HPACK - Header Compression for HTTP/2.0
http://tools.ietf.org/html/draft-ietf-httpbis-header-compression

Also it requires issue #6736.

Use cases would be the following:
- Server: 1.x, 2.0 and/or protocol agnostic
- Client: ditto
- Proxy (w/ traffic engineering): basic forward/reverse proxying, also traffic routing
and/or protocol bridging btw 1.x and 2.0
- QoX?: available to inject external queueing disciplines, frame scheduling and queue
management in between HTTP/2.0 framing and TLS layers
- Bearer: WebSocket over HTTP/2.0

Wow, I'm full.
@bradfitz
Copy link
Contributor

Comment 1:

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.

@mikioh
Copy link
Contributor Author

mikioh commented Aug 23, 2014

Comment 2:

yay

@bradfitz
Copy link
Contributor

Comment 3:

This work has been coming along nicely. Currently at https://github.com/bradfitz/http2

@ncdc
Copy link

ncdc commented Jan 7, 2015

@bradfitz will there be a public API that will allow us to create streams and send data to/receive data from them?

@bradfitz
Copy link
Contributor

bradfitz commented Jan 7, 2015

Yes.

@ncdc
Copy link

ncdc commented Jan 7, 2015

Awesome, is there anything we can start playing around with yet? Or even a proposed API to review? :-)

@bradfitz
Copy link
Contributor

bradfitz commented Jan 7, 2015

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.

@ncdc
Copy link

ncdc commented Jan 8, 2015

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.

@rsc rsc added this to the Unplanned milestone Apr 10, 2015
@gopherbot
Copy link

CL https://golang.org/cl/15823 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/15828 mentions this issue.

bradfitz added a commit that referenced this issue Oct 14, 2015
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 <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/16090 mentions this issue.

bradfitz added a commit that referenced this issue Oct 20, 2015
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 <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/16180 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/16181 mentions this issue.

bradfitz added a commit to golang/net that referenced this issue Oct 22, 2015
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 <adg@golang.org>
bradfitz added a commit to golang/net that referenced this issue Oct 22, 2015
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 <adg@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/16310 mentions this issue.

bradfitz added a commit to golang/net that referenced this issue Oct 27, 2015
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 <blake.mizerany@gmail.com>
@gopherbot
Copy link

CL https://golang.org/cl/16693 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/16692 mentions this issue.

bradfitz added a commit to golang/net that referenced this issue Nov 7, 2015
…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 <blake.mizerany@gmail.com>
bradfitz added a commit that referenced this issue Nov 7, 2015
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 <blake.mizerany@gmail.com>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/17046 mentions this issue.

bradfitz added a commit that referenced this issue Nov 19, 2015
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 <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/17205 mentions this issue.

@gopherbot
Copy link

CL https://golang.org/cl/17204 mentions this issue.

bradfitz added a commit to golang/net that referenced this issue Nov 25, 2015
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 <adg@golang.org>
bradfitz added a commit that referenced this issue Nov 25, 2015
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 <adg@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/17241 mentions this issue.

bradfitz added a commit that referenced this issue Nov 26, 2015
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 <bradfitz@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
@gopherbot
Copy link

CL https://golang.org/cl/17134 mentions this issue.

bradfitz added a commit to golang/net that referenced this issue Nov 30, 2015
Fixes golang/go#13397
Updates golang/go#6891

Change-Id: I1e4c7bfe60c6abf9a03f2888aa6abc3891c309e7
Reviewed-on: https://go-review.googlesource.com/17134
Reviewed-by: Ian Lance Taylor <iant@golang.org>
@bradfitz
Copy link
Contributor

bradfitz commented Dec 1, 2015

I'm happy with the state of HTTP/2 now. Closing this meta bug.

@bradfitz bradfitz closed this as completed Dec 1, 2015
@ncdc
Copy link

ncdc commented Dec 1, 2015

@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?

@gopherbot
Copy link

CL https://golang.org/cl/17300 mentions this issue.

@bradfitz
Copy link
Contributor

bradfitz commented Dec 1, 2015

@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
bradfitz/http2#34

But we no longer use that repo. Let's move this conversation to #13443

bradfitz added a commit that referenced this issue Dec 2, 2015
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 <iant@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@golang golang locked and limited conversation to collaborators Dec 1, 2016
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

5 participants