Skip to content

HTTP/2 protocol support - #3793

Merged
PastelMobileSuit merged 2 commits into
masterfrom
http2
Aug 27, 2019
Merged

PastelMobileSuit merged 2 commits into
masterfrom
http2

Conversation

@PastelMobileSuit

Copy link
Copy Markdown
Contributor

This PR adds support for the HTTP/2 protocol to the internal client LFS uses for HTTP requests. With this change, the client will automatically use HTTP/2 if the server supports it, and otherwise will fall back to using HTTP/1.1.

/cc @andreynpetrov

@bk2204 bk2204 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great!

Comment thread lfshttp/client_test.go
srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
atomic.AddUint32(&calledSrv, 1)
assert.Equal(t, "GET", r.Method)
assert.Equal(t, "HTTP/1.1", r.Proto)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for testing that things still work with HTTP 1.1 here as well.

Comment thread lfshttp/client.go
tr.TLSClientConfig.RootCAs = getRootCAsForHost(c, host)
}

http2.ConfigureTransport(tr)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I love it when the fix is a single line.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's really nice! To be honest digging through trying to figure out how to get the httptest server to support the HTTP/2 protocol took significantly longer than actually adding HTTP/2 support to the client

Vendor the `golang.org/x/net` dependency. This will be used in a
future commit to add HTTP/2 transport support.

Note that due to the way go modules work, the `golang.org/x/sys`
dependency was updated as well when running `make vendor`.
This commit configures the internal client we use for all HTTP
requests in `git-lfs` to use the HTTP/2 protocol if supported by
the server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants