From d9477153a5813a96ed8839a64de569f5fc36602f Mon Sep 17 00:00:00 2001 From: Goryudyuma Date: Thu, 21 Jun 2018 18:29:52 +0900 Subject: [PATCH] fix benchmarker useable http/2 --- admin/benchmarker/request.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/admin/benchmarker/request.go b/admin/benchmarker/request.go index 4a3a7538..843f88e1 100644 --- a/admin/benchmarker/request.go +++ b/admin/benchmarker/request.go @@ -12,6 +12,7 @@ import ( "time" "github.com/PuerkitoBio/goquery" + "golang.org/x/net/http2" ) func getInitialize() { @@ -74,6 +75,9 @@ func httpsRequest(method string, path string, params url.Values) int { tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } + if err := http2.ConfigureTransport(tr); err != nil { + log.Fatalf("Failed to configure h2 transport: %s", err) + } req.Header.Set("Content-Type", "application/x-www-form-urlencoded") client := http.Client{Transport: tr} @@ -92,6 +96,9 @@ func httpsRequestDoc(method string, path string, params url.Values) *goquery.Doc tr := &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } + if err := http2.ConfigureTransport(tr); err != nil { + log.Fatalf("Failed to configure h2 transport: %s", err) + } req.Header.Set("Content-Type", "application/x-www-form-urlencoded") client := http.Client{Transport: tr}