New issue
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
net/http: http2 client return EOF #13598
Comments
/cc @bradfitz |
Indeed! Thanks for the bug report.
package main
import (
"io"
"log"
"net/http"
"os"
)
func main() {
res, err := http.Get("https://dav.box.com/")
if err != nil {
log.Fatal(err)
}
log.Printf("Res: %#v", res)
_, err = io.Copy(os.Stdout, res.Body)
if err != nil {
log.Fatal(err)
}
} With HTTP/2 enabled by default: (mix of error messages)
With HTTP/2 explicitly disabled:
|
Yes, I got same result. |
I found the problem. https://dav.box.com does not speak HTTP/2. But we advertise in our TLS connection that we speak "h2" but we never mention that we also speak "http/1.1", and Box's frontend recognizes ALPN or NPN enough to know that they can't handle "h2", so they hang up on us. The fix is to declare that we also speak "http/1.1" as a fallback. Easy fix. |
RFC 7301 defines the ALPN protocol "http/1.1". We weren't sending that, so at least one site (dav.box.com) was rejecting our connection, since they didn't support the only protocol we advertised ("h2"). Had we advertised nothing, they would've assumed http/1.1 implicitly. This CL also hooks up the verbose logging knob to the GODEBUG environment variable. Updates golang/go#13598 (fixed when this is copied into std) Change-Id: I6ea1231d0d0f0bc767caa0458237eefd943d9d3d Reviewed-on: https://go-review.googlesource.com/17754 Reviewed-by: Ian Lance Taylor <iant@golang.org>
I'm trying to connect to https://dav.box.com/ with golang. It seems that box.com provide http2 protocol. But go's http2 client retrun EOF always. I debugged little and I make sure this occur on h2 protocol in TLSNextProto. So currently I'm disabling h2 like below.
The text was updated successfully, but these errors were encountered: