Skip to content

HTTP Upgrade header#7367

Merged
ddbeck merged 2 commits intomdn:masterfrom
hamishwillee:HTTP_Upgrade
Dec 13, 2020
Merged

HTTP Upgrade header#7367
ddbeck merged 2 commits intomdn:masterfrom
hamishwillee:HTTP_Upgrade

Conversation

@hamishwillee
Copy link
Copy Markdown
Contributor

@hamishwillee hamishwillee commented Nov 16, 2020

HTTP upgrade header is HTTP1.1 (only) header that can be used to upgrade a connection to using another protocol - e.g. HTTP2. Mostly commonly it is used for upgrading an HTTP or HTTPS connection to a websocket. I just added a new page for this on MDN and it could use a BCD entry. Page is here: https://wiki.developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Upgrade

@ddbeck We've had some discussion about whether some headers are relevant; I'm still not certain of "all" the logic for making that decision, but I think this one is. At least it is clear what a browser must do to be compliant - it must switch to the supported protocol it has requested if it gets the switched protocol status from a server.

Anything that supports websockets probably supports this header and there is plenty of better evidence that this header is supported in Firefox and also in Chromium. However, I can't find any version information.

Feeling pretty useless, but decided to post this for discussion.

@github-actions github-actions bot added the data:http Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP label Nov 16, 2020
@hamishwillee
Copy link
Copy Markdown
Contributor Author

@ddbeck When you get a chance, could you look at this. Mostly I am confirming that this is reasonable to have in the BCD (at all). I can then perhaps do some experimentation to determine versions it might appear.

@ddbeck
Copy link
Copy Markdown
Contributor

ddbeck commented Nov 30, 2020

@hamishwillee when you say that anything that supports WebSockets should support this, are you saying that the browser should send an Upgrade header as part of creating session? My thinking here is this: if we can show that a browser will use this header of its own accord (without a web developer composing HTTP requests themselves—at which point they could use whatever headers they please), then I think we could have some compat data for it here. Otherwise, I think we should omit it.

@hamishwillee
Copy link
Copy Markdown
Contributor Author

hamishwillee commented Dec 1, 2020

when you say that anything that supports WebSockets should support this, are you saying that the browser should send an Upgrade header as part of creating session?

Yes, that is my understanding. Any system that supports web sockets via HTTP1.1 will create a normal HTTP connection then send UPGRADE to upgrade to a socket protocol. The "How it works" is extensively documented on MDN, and you can see it in the various points in the code on search.

This also how a system with an HTTP1.1 connection might upgrade to HTTP 2.0 (see here).

Anyway, sounds like this is worth having BCD for. Not sure how we'll work out how to verify this, and particular versions. Theoretically we could probably just copy the BCD for websockets, since this is main use case: https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API

@ddbeck
Copy link
Copy Markdown
Contributor

ddbeck commented Dec 9, 2020

@Elchi3 Do you have any thoughts on how we might confirm support for such a feature? I haven't reviewed much of the HTTP data and wanted to double check with you first.

@Elchi3
Copy link
Copy Markdown
Member

Elchi3 commented Dec 10, 2020

@Elchi3 Do you have any thoughts on how we might confirm support for such a feature? I haven't reviewed much of the HTTP data and wanted to double check with you first.

I think it is difficult and not worth spending cycles on.

I have more thoughts on this matter, you can find them in this thread from August 2019 (it is still valid): https://discourse.mozilla.org/t/bcd-and-want-digest-digest-http-headers/43340 (basically there are headers where browser support matters and also where it doesn't).

@hamishwillee
Copy link
Copy Markdown
Contributor Author

Thanks @Elchi3 . I've accepted the proposed changes.

I think this is a case where it is useful to state support, and doing that with "true" is better than nothing (i.e. option "3" in linked doc). More generally, if it isn't clear what support means OR we can't verify support because it depends on the server I lean towards option 4 or omitting the section altogether.

@ddbeck Ready to merge, or will do "option 4" if you just close this (indicating you think it isn't of value)

Copy link
Copy Markdown
Contributor

@ddbeck ddbeck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good enough for me. 👍

@ddbeck ddbeck merged commit 67563a8 into mdn:master Dec 13, 2020
@hamishwillee hamishwillee deleted the HTTP_Upgrade branch December 13, 2020 22:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data:http Compat data for HTTP features. https://developer.mozilla.org/docs/Web/HTTP

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants