This is one of the Node http events. Did the obvious Google Searches, didn't find much. What is it exactly?
-
Your link is to the documentation's TOC. – Ed S. Dec 11 '11 at 22:07
-
Whoops, sorry about that. Edited. – Randomblue Dec 11 '11 at 22:11
1 Answers
HTTP Upgrade is used to indicate a preference or requirement to switch to a different version of HTTP or to another protocol, if possible:
The Upgrade general-header allows the client to specify what additional communication protocols it supports and would like to use if the server finds it appropriate to switch protocols. The server MUST use the Upgrade header field within a 101 (Switching Protocols) response to indicate which protocol(s) are being switched.
Upgrade = "Upgrade" ":" 1#product
For example,
Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
The Upgrade header field is intended to provide a simple mechanism for transition from HTTP/1.1 to some other, incompatible protocol.
According to the IANA register, there are only 3 registered mentions of it (including one in the HTTP specification itself).
The other two are for:
Upgrading to TLS Within HTTP/1.1 (almost never used, not to be confused with HTTP over TLS, which defines HTTPS as widely used). This upgrade allows for a similar mechanism to STARTTLS in other protocols (e.g. LDAP, SMTP, ...) so as to be able to switch to TLS on the same port as the plain connection, after exchanging some of the application protocol messages, as opposed to having the entire HTTP exchange on top of SSL/TLS without it needing to know it's on top of TLS (the way HTTPS works).
Upgrading to WebSockets (still a draft).
-
-
@Bruno, How does custom Upgrade protocols work? E.g. if our server wants to support [`Upgrade: firepresence`](http://lucumr.pocoo.org/2012/9/24/websockets-101/) a custom protocol, how can we get the browser to send the Upgrade request? – Pacerier Mar 16 '15 at 13:45
-
@Pacerier I'm not sure. I guess you'd need to change the browser itself substantially (or write a plugin/extension for it if possible), a bit like what was done for websockets. – Bruno Mar 16 '15 at 13:55
-
@Bruno `preference or requirement` as per section 6.7: `Upgrade cannot be used to insist on a protocol change.` So instead of a preference or a requirement, it's more of a "hey, if you can, use these protocols because they're better". – Qix - MONICA WAS MISTREATED Jul 10 '16 at 01:47