Skip to content

Commit

Permalink
Enable HTTP/2 (#84)
Browse files Browse the repository at this point in the history
* Enable HTTP/2

Because we create a custom TLSClientConfig, we have to opt-in to HTTP/2.

Fixes #76

* Vendor golang.org/x/net

* Check error from http2.ConfigureTransport
  • Loading branch information
moorereason authored and davecheney committed Sep 28, 2016
1 parent 197b3b6 commit f1ba468
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "vendor/github.com/mattn/go-isatty"]
path = vendor/github.com/mattn/go-isatty
url = https://github.com/mattn/go-isatty
[submodule "vendor/golang.org/x/net"]
path = vendor/golang.org/x/net
url = https://go.googlesource.com/net
10 changes: 9 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"io/ioutil"
"log"
"mime"
"net"
"net/http"
"net/http/httptrace"
"net/url"
Expand All @@ -19,7 +20,7 @@ import (
"strings"
"time"

"net"
"golang.org/x/net/http2"

"github.com/fatih/color"
)
Expand Down Expand Up @@ -230,6 +231,13 @@ func visit(url *url.URL) {
ServerName: host,
InsecureSkipVerify: insecure,
}

// Because we create a custom TLSClientConfig, we have to opt-in to HTTP/2.
// See https://github.com/golang/go/issues/14275
err = http2.ConfigureTransport(tr)
if err != nil {
log.Fatalf("failed to prepare transport for HTTP/2: %v", err)
}
}

client := &http.Client{
Expand Down
1 change: 1 addition & 0 deletions vendor/golang.org/x/net
Submodule net added at f09c46

0 comments on commit f1ba468

Please sign in to comment.