<s>
The	O
Upgrade	B-Protocol
header	I-Protocol
field	O
is	O
an	O
HTTP	B-Protocol
header	I-Protocol
field	I-Protocol
introduced	O
in	O
HTTP/1.1	B-Protocol
.	O
</s>
<s>
In	O
the	O
exchange	O
,	O
the	O
client	O
begins	O
by	O
making	O
a	O
cleartext	O
request	O
,	O
which	O
is	O
later	O
upgraded	O
to	O
a	O
newer	O
HTTP	B-Protocol
protocol	I-Protocol
version	O
or	O
switched	O
to	O
a	O
different	O
protocol	O
.	O
</s>
<s>
The	O
client	O
can	O
then	O
send	O
a	O
new	O
request	O
with	O
the	O
appropriate	O
upgrade	B-Protocol
headers	I-Protocol
while	O
keeping	O
the	O
connection	O
open	O
.	O
</s>
<s>
One	O
use	O
is	O
to	O
begin	O
a	O
request	O
on	O
the	O
normal	O
HTTP	B-Protocol
port	O
but	O
switch	O
to	O
Transport	B-Protocol
Layer	I-Protocol
Security	I-Protocol
(	O
TLS	O
)	O
.	O
</s>
<s>
In	O
practice	O
such	O
use	O
is	O
rare	O
,	O
with	O
HTTPS	B-Protocol
being	O
a	O
far	O
more	O
common	O
way	O
to	O
initiate	O
encrypted	O
HTTP	B-Protocol
.	I-Protocol
</s>
<s>
The	O
server	O
returns	O
a	O
426	O
status	B-Protocol
code	I-Protocol
to	O
alert	O
legacy	O
clients	O
that	O
the	O
failure	O
was	O
client-related	O
(	O
400	O
level	O
codes	O
indicate	O
a	O
client	O
failure	O
)	O
.	O
</s>
<s>
Since	O
HTTP	B-Protocol
is	O
defined	O
on	O
a	O
hop	B-Protocol
basis	O
,	O
HTTP	B-Protocol
tunneling	I-Protocol
may	O
be	O
required	O
to	O
bypass	O
proxy	O
servers	O
.	O
</s>
<s>
WebSocket	B-Protocol
also	O
uses	O
this	O
mechanism	O
to	O
set	O
up	O
a	O
connection	O
with	O
a	O
HTTP	B-Protocol
server	O
in	O
a	O
compatible	O
way	O
.	O
</s>
<s>
The	O
WebSocket	B-Protocol
Protocol	O
has	O
two	O
parts	O
:	O
a	O
handshake	B-Protocol
to	O
establish	O
the	O
upgraded	O
connection	O
,	O
then	O
the	O
actual	O
data	O
transfer	O
.	O
</s>
<s>
First	O
,	O
a	O
client	O
requests	O
a	O
WebSocket	B-Protocol
connection	O
by	O
using	O
the	O
Upgrade	O
:	O
WebSocket	B-Protocol
and	O
Connection	O
:	O
Upgrade	B-Protocol
headers	I-Protocol
,	O
along	O
with	O
a	O
few	O
protocol-specific	O
headers	O
to	O
establish	O
the	O
version	O
being	O
used	O
and	O
set	O
up	O
a	O
handshake	B-Protocol
.	O
</s>
<s>
The	O
server	O
,	O
if	O
it	O
supports	O
the	O
protocol	O
,	O
replies	O
with	O
the	O
same	O
Upgrade	O
:	O
WebSocket	B-Protocol
and	O
Connection	O
:	O
Upgrade	B-Protocol
headers	I-Protocol
and	O
completes	O
the	O
handshake	B-Protocol
.	O
</s>
<s>
Once	O
the	O
handshake	B-Protocol
is	O
completed	O
successfully	O
,	O
data	O
transfer	O
begins	O
.	O
</s>
<s>
The	O
HTTP	B-Protocol
Upgrade	O
mechanism	O
is	O
used	O
to	O
establish	O
HTTP/2	B-Protocol
starting	O
from	O
plain	O
HTTP	B-Protocol
.	I-Protocol
</s>
<s>
The	O
client	O
starts	O
an	O
HTTP/1.1	B-Protocol
connection	O
and	O
sends	O
an	O
Upgrade	O
:	O
h2c	O
header	O
.	O
</s>
<s>
If	O
the	O
server	O
supports	O
HTTP/2	B-Protocol
,	O
it	O
replies	O
with	O
HTTP	B-Protocol
101	O
Switching	O
Protocol	O
status	B-Protocol
code	I-Protocol
.	O
</s>
<s>
The	O
HTTP	B-Protocol
Upgrade	O
mechanism	O
is	O
used	O
only	O
for	O
cleartext	O
HTTP2	B-Protocol
(	O
h2c	O
)	O
.	O
</s>
<s>
In	O
the	O
case	O
of	O
HTTP2	B-Protocol
over	O
TLS	O
(	O
h2	O
)	O
,	O
the	O
ALPN	B-Protocol
TLS	B-Protocol
protocol	I-Protocol
extension	O
is	O
used	O
instead	O
.	O
</s>
