enabling HTTP/2 clients with some TLS settings using only stdlib?

113 views
Skip to first unread message

Jeff Hodges

unread,
Aug 28, 2016, 9:18:27 PM8/28/16
to golang-nuts
Hey, I've not been able to figure out how to enable HTTP/2 in a net/http client that needs some tls.Config settings in its Transport (like it's needs a specific root added at run time) using only the stdlib.

Is there a way to enable HTTP/2 on clients in the stdlib that I've missed?

(Related: I think this is blocking the creation of a test for http.ReverseProxy for https://github.com/golang/go/issues/16696 because my current formulation needs an InsecureSkipVerify setting)

Jeff Hodges

unread,
Aug 28, 2016, 9:22:38 PM8/28/16
to golang-nuts
Sample code:


Which when run on your local machine, will error with:

2016/08/28 18:21:14 Get https://www.google.com: malformed HTTP response "\x00\x00\x18\x04\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00d\x00\x04\x00\x10\x00\x00\x00\x05\x00\x00@\x00\x00\x06\x00\x00@\x00\x00\x00\x04\b\x00\x00\x00\x00\x00\x00\x0f\x00\x01\x00\x00\x1e\a\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01http2_handshake_failed"

exit status 1

Reply all
Reply to author
Forward
0 new messages