RobotsAndPencils/buford

Improve error message when not using http/2 client

Closed this issue · 3 comments

Hitting Apple with an HTTP/1.1 request results in the error malformed HTTP status code "client". (#26)

Importing golang.org/x/net/http2 (#27) means that GODEBUG=http2client=0 no longer disables http2. But if for some reason http2 isn't established, it would be nice to catch that sooner and report a friendly error.

Now that the http/2 library is a dependency (#27), Go 1.6 may not be a requirement. It may be possible to support Go 1.5.3 by removing the +build go1.6 build tag, but this will require testing.

http.Response.Proto is "HTTP/2.0" when it works. I'll have to investigate that error more closely to see if we can return a friendlier error.

I'd also like to improve the testing around this if possible. Setting Transport.TLSNextProto to a non nil empty map is the official way to disable HTTP/2.

Based on this, Go 1.6 will still be required.

https://github.com/golang/net/blob/master/http2/not_go16.go

var errTransportVersion = errors.New("http2: ConfigureTransport is only supported starting at Go 1.6")

yup. confirmed.

http2: ConfigureTransport is only supported starting at Go 1.6

however, there will be a compiler error in Go 1.5 before that happens:

../../push/service.go:139: undefined: http.StatusTooManyRequests