Skip to content

Commit

Permalink
example/aws/proxyWithTLSClientCert: Use Transport.ForceAttemptHTTP2
Browse files Browse the repository at this point in the history
… to enable HTTP/2 (#4014)

This can remove `golang.org/x/net/http2` dependency.

This field was added at Go 1.13. This example file now required
Go 1.15+. So we can use this field safely.
Ref: https://golang.org/doc/go1.13#net/http
  • Loading branch information
y-yagi committed Jan 4, 2022
1 parent 619862d commit 29f6f92
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions example/aws/proxyWithTLSClientCert/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/s3"
"golang.org/x/net/http2"
)

// Example of creating an HTTP Client configured with a client TLS
Expand Down Expand Up @@ -52,10 +51,6 @@ func main() {
tr := defaultHTTPTransport()
tr.TLSClientConfig = tlsCfg

// re-enable HTTP/2 because modifing TLS config will prevent auto support
// for HTTP/2.
http2.ConfigureTransport(tr)

// Configure the SDK's session with the HTTP client with TLS client
// certificate support enabled. This session will be used to create all
// SDK's API clients.
Expand Down Expand Up @@ -120,5 +115,6 @@ func defaultHTTPTransport() *http.Transport {
IdleConnTimeout: 90 * time.Second,
TLSHandshakeTimeout: 10 * time.Second,
ExpectContinueTimeout: 1 * time.Second,
ForceAttemptHTTP2: true,
}
}

0 comments on commit 29f6f92

Please sign in to comment.