blob: 855ef3e58733181e143597928d874d0180ad84f0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
---
title: 101 Switching Protocol
slug: Web/HTTP/Status/101
tags:
- HTTP
- HTTP 状态码
translation_of: Web/HTTP/Status/101
---
<div>{{HTTPSidebar}}</div>
<p>HTTP <code><strong>101 Switching Protocol</strong></code>(协议切换)状态码表示服务器应客户端升级协议的请求({{HTTPHeader("Upgrade")}}请求头)正在切换协议。</p>
<p>服务器会发送一个{{HTTPHeader("Upgrade")}}响应头来表明其正在切换过去的协议。<br>
该过程在协议升级机制(<a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism">Protocol upgrade mechanism</a>)中详细描述。</p>
<h2 id="状态">状态</h2>
<pre class="syntaxbox notranslate">101 Switching Protocol</pre>
<h2 id="示例">示例</h2>
<p>在使用 <a href="/en-US/docs/Web/API/WebSockets_API">WebSockets</a> 时会用到协议切换。</p>
<pre class="notranslate">HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade</pre>
<h2 id="相关协议">相关协议</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">Specification</th>
<th scope="col">Title</th>
</tr>
<tr>
<td>{{RFC("7231", "101 Switching Protocol" , "6.2.2")}}</td>
<td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</td>
</tr>
</tbody>
</table>
<h2 id="参见">参见</h2>
<ul>
<li><a href="/en-US/docs/Web/HTTP/Protocol_upgrade_mechanism">Protocol upgrade mechanism</a></li>
<li><a href="/en-US/docs/Web/API/WebSockets_API">WebSockets</a></li>
<li>{{HTTPHeader("Upgrade")}}</li>
<li>{{HTTPStatus("426")}} <code>Upgrade Required</code></li>
</ul>
|