Subject: Possible to support only HTTP/2 for "http" URIs? "https" URIs?

From: <[email-masked]>
Date: Wed, 16 Jul 2014 08:45:58 +0000

*Is it possible to support just HTTP/2 for "http" URIs?*

For example, consider the scenario where a server only wants to support clear-text HTTP version 2 (h2c) i.e. not allow/parse HTTP/1.x requests.

I believe it has the two following options, but please correct me if I am wrong.

a. "Upgrade"

If a HTTP/1.x request arrives _with_ an "Upgrade: h2c" header, do the following: Send "101 switching protocols".  Immediately send RST_STREAM/REFUSED_STREAM on stream 1 and _hope_ the client re-sends the request as an h2c request.

b. "Alt-Svc"

If a HTTP/1.x request arrives _without_ an "Upgrade: h2c" header, do the following: Send a "505 HTTP Version Not Supported" with an Alt-Svc header e.g. "Alt-Svc: h2c=82". It's up to the client to switch to h2c at the specified port.

*Is it possible to support just HTTP/2 for "https" URIs?*

I believe it's possible to support only HTTP version 2 (h2) by simply only negotiating for "h2" and rejecting all other requests.

This email message is intended only for the use of the named recipient. Information contained in this email message and its attachments may be privileged, confidential and protected from disclosure. If you are not the intended recipient, please do not read, copy, use or disclose this communication to others. Also please notify the sender by replying to this message and then delete it from your system.

---

From: Martin Thomson <[email-masked]>
Date: Wed, 16 Jul 2014 10:25:40 -0700

Almost.  You should use Upgrade instead of Alt-Svc.

I've added this to the FAQ:
https://github.com/http2/http2.github.io/commit/346e7da2dcde0082351d33203a8b7cd9670ae619

On 16 July 2014 01:45,  <[email-masked]> wrote:
> For example, consider the scenario where a server only wants to support
> clear-text HTTP version 2 (h2c) i.e. not allow/parse HTTP/1.x requests.
>
>
>
> If a HTTP/1.x request arrives _with_ an "Upgrade: h2c" header, do the
> following: Send “101 switching protocols”.  Immediately send
> RST_STREAM/REFUSED_STREAM on stream 1 and _hope_ the client re-sends the
> request as an h2c request.
>
>
>
> b. "Alt-Svc"
>
> If a HTTP/1.x request arrives _without_ an "Upgrade: h2c" header, do the
> following: Send a "505 HTTP Version Not Supported" with an Alt-Svc header
> e.g. "Alt-Svc: h2c=82". It’s up to the client to switch to h2c at the
> specified port.
>
>
>
>
>
> I believe it's possible to support only HTTP version 2 (h2) by simply only
> negotiating for "h2" and rejecting all other requests.
>
>
>
>
>
> This email message is intended only for the use of the named recipient.
> Information contained in this email message and its attachments may be
> privileged, confidential and protected from disclosure. If you are not the
> intended recipient, please do not read, copy, use or disclose this
> communication to others. Also please notify the sender by replying to this
> message and then delete it from your system.

---

From: <[email-masked]>
Date: Wed, 16 Jul 2014 19:50:13 +0000

Hi Martin-

> On Jul 16, 2014, at 19:25, "[email-masked]" <[email-masked]> wrote:
>

Why can't you also use Alt-Svc? I thought that was one of the purposes of Alt-Svc.  Specifically, what's wrong with my usage of Alt-Svc as I described it in option b) below? Did you mean that the sever could send Upgrade _and_ Alt-Svc with its 505 response to a http/1.x request?

> https://github.com/http2/http2.github.io/commit/346e7da2dcde0082351d33203a8b7cd9670ae619

Great. Thanks. I think that captures exactly what I was asking/thinking wrt "Upgrade".

-Keith

---

From: Martin Thomson <[email-masked]>
Date: Wed, 16 Jul 2014 13:24:10 -0700

On 16 July 2014 12:50,  <[email-masked]> wrote:
> Why can't you also use Alt-Svc?

Sure, and they are basically functionally equivalent in this regard.
Upgrade doesn't imply a new connection, potentially saving that setup
time (you can send Connection: close if you really want to close).