We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
go version
go version go1.8.3 linux/amd64
go env
GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/home/slaskawi/go_path" GORACE="" GOROOT="/opt/go" GOTOOLDIR="/opt/go/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build176707533=/tmp/go-build -gno-record-gcc-switches" CXX="g++" CGO_ENABLED="1" PKG_CONFIG="pkg-config" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2"
Adding TLSClientConfig to http.Transport turns off HTTP/2 support. Here's an example:
TLSClientConfig
http.Transport
tr := &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, } c := http.Client{ Transport: tr, } url := "https://http2.golang.org/reqinfo" response, err := c.Get(url) if err != nil { log.Fatal(err) } fmt.Printf("is HTTP2: %v (%s)\n\n", response.ProtoAtLeast(2, 0), response.Proto) body, err := ioutil.ReadAll(response.Body) if err != nil { log.Fatal(err) } fmt.Println(string(body))
The code snipped above generates the following output:
is HTTP2: false (HTTP/1.1) ...
When I removed TLSClientConfig the situation went back to normal:
tr := &http.Transport{ //TLSClientConfig: &tls.Config{ // InsecureSkipVerify: true, //}, }
The response:
is HTTP2: true (HTTP/2.0) ...
Note that I had to remove entire TLSClientConfig. Removing only InsecureSkipVerify doesn't fix the problem.
InsecureSkipVerify
Adding TLSClientConfig to http.Transport with InsecureSkipVerify set to true should generate the following output:
true
I see the following output (which is wrong):
The text was updated successfully, but these errors were encountered:
This might be connected to #14391
Sorry, something went wrong.
The Transport documentation has the following:
To explicitly enable HTTP/2 on a transport, use golang.org/x/net/http2 and call ConfigureTransport.
Thanks a lot for the hint @fraenkel! That fixed the problem.
BTW are there any plans to make it work out of the box. Calling ConfigureTransport explicitly sounds a bit weird...
ConfigureTransport
No branches or pull requests
What version of Go are you using (
go version
)?go version go1.8.3 linux/amd64
What operating system and processor architecture are you using (
go env
)?GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/slaskawi/go_path"
GORACE=""
GOROOT="/opt/go"
GOTOOLDIR="/opt/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
CC="gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build176707533=/tmp/go-build -gno-record-gcc-switches"
CXX="g++"
CGO_ENABLED="1"
PKG_CONFIG="pkg-config"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
What did you do?
Adding
TLSClientConfig
tohttp.Transport
turns off HTTP/2 support. Here's an example:The code snipped above generates the following output:
When I removed
TLSClientConfig
the situation went back to normal:The response:
Note that I had to remove entire
TLSClientConfig
. Removing onlyInsecureSkipVerify
doesn't fix the problem.What did you expect to see?
Adding
TLSClientConfig
tohttp.Transport
withInsecureSkipVerify
set totrue
should generate the following output:What did you see instead?
I see the following output (which is wrong):
The text was updated successfully, but these errors were encountered: