Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is an http upgrade?

Tags:

http

node.js

This is one of the Node http events. Did the obvious Google Searches, didn't find much. What is it exactly?

like image 358
Randomblue Avatar asked Dec 11 '11 21:12

Randomblue


People also ask

What does HTTP upgrade do?

The HTTP Upgrade mechanism is used to establish HTTP/2 starting from plain HTTP. The client starts an HTTP/1.1 connection and sends an Upgrade: h2c header. If the server supports HTTP/2, it replies with HTTP 101 Switching Protocol status code. The HTTP Upgrade mechanism is used only for cleartext HTTP2 (h2c).

How to Upgrade HTTP to WebSocket?

Upgrading to a WebSocket connection The WebSocket() constructor does all the work of creating an initial HTTP/1.1 connection then handling the handshaking and upgrade process for you. Note: You can also use the "wss://" URL scheme to open a secure WebSocket connection.

What is upgrade connection to https?

HTTPS ensures that your customers are communicating with the intended site and not a fake version. With HTTPS, any information transmitted between the site's server and the site visitor's browser can't be altered or corrupted during transfer.

How WebSocket Upgrade works?

WebSocket is an upgraded, quick, and seamless protocol to use when one needs to establish constant client-server communication. Even if the data is continuously transmitted, WebSocket ensure the connection is intact and data is highly secured in the process.


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).

like image 65
Bruno Avatar answered Oct 01 '22 08:10

Bruno