Chrome Canary does not offer HTTP/2

275 views Asked by At

I'm trying to implement a small HTTP/2 server in C# in order to get to know the protocol. I'm running Chrome's latest canary build (v 45.0.2436.5), however I can't seem to get the client to negotiate an upgrade to an HTTP/2 connection.

The RFC states the following:

A client that makes a request for an "http" URI without prior knowledge about support for HTTP/2 on the next hop uses the HTTP Upgrade mechanism (Section 6.7 of [RFC7230]). The client does so by making an HTTP/1.1 request that includes an Upgrade header field with the "h2c" token.

which lead me to believe that the first request should contain an Upgrade header, but it doesn't. This is the request I'm getting:

GET / HTTP/1.1
Host: 127.0.0.1:1234
Connection: keep-alive
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.3; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2436.5 Safari/537.36
HTTPS: 1
Accept-Encoding: gzip, deflate, sdch
Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4

Can anyone explain to me why this happens?

Thanks in advance for answers!

1

There are 1 answers

1
sbordet On BEST ANSWER

Chrome does not implement the HTTP/1.1 Upgrade to HTTP/2. It only implements HTTP/2 over TLS via ALPN.

The same is true for Firefox.

Browsers, in general, have preferred to use TLS because the IETF and the web in general are moving towards "everything TLS". Furthermore, using TLS gives a much higher rate of success in connection establishment. For these and other reasons no browser so far has implemented the clear-text upgrade mechanism (that is not required by the specification).

There are rumors that Internet Explorer 11 will support the HTTP/1.1 Upgrade to HTTP/2, but I'm not sure if it's already available.

Meanwhile there are other (command line) tools that can perform the HTTP/1.1 Upgrade to HTTP/2.

For example, nghttp2 or curl.

For Java, you can use Jetty's HttpClient as explained here.

I'm not aware of HTTP/2 C# clients, perhaps you can look at other implementations here.