diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/http/methods/connect | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/http/methods/connect')
-rw-r--r-- | files/zh-cn/web/http/methods/connect/index.html | 85 |
1 files changed, 85 insertions, 0 deletions
diff --git a/files/zh-cn/web/http/methods/connect/index.html b/files/zh-cn/web/http/methods/connect/index.html new file mode 100644 index 0000000000..580b9b13f7 --- /dev/null +++ b/files/zh-cn/web/http/methods/connect/index.html @@ -0,0 +1,85 @@ +--- +title: CONNECT +slug: Web/HTTP/Methods/CONNECT +tags: + - 请求方法 + - 隧道 +translation_of: Web/HTTP/Methods/CONNECT +--- +<div>{{HTTPSidebar}}</div> + +<p>在 HTTP 协议中,<strong><code>CONNECT</code> </strong>方法可以开启一个客户端与所请求资源之间的双向沟通的通道。它可以用来创建隧道(tunnel)。</p> + +<p>例如,<strong><code>CONNECT</code> </strong>可以用来访问采用了 {{Glossary("SSL")}} ({{Glossary("HTTPS")}}) 协议的站点。客户端要求代理服务器将 TCP 连接作为通往目的主机隧道。之后该服务器会代替客户端与目的主机建立连接。连接建立好之后,代理服务器会面向客户端发送或接收 TCP 消息流。</p> + +<p><code>CONNECT</code> 是一个应用范围为点到点的方法。</p> + +<table class="properties"> + <tbody> + <tr> + <th scope="row">Request has body</th> + <td>No</td> + </tr> + <tr> + <th scope="row">Successful response has body</th> + <td>Yes</td> + </tr> + <tr> + <th scope="row">{{Glossary("Safe")}}</th> + <td>No</td> + </tr> + <tr> + <th scope="row">{{Glossary("Idempotent")}}</th> + <td>No</td> + </tr> + <tr> + <th scope="row">{{Glossary("Cacheable")}}</th> + <td>No</td> + </tr> + <tr> + <th scope="row">Allowed in <a href="/en-US/docs/Web/Guide/HTML/Forms">HTML forms</a></th> + <td>No</td> + </tr> + </tbody> +</table> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">CONNECT www.example.com:443 HTTP/1.1 +</pre> + +<h2 id="示例">示例</h2> + +<p>一些代理服务器在创建隧道时会要求进行身份验证。参见 {{HTTPHeader("Proxy-Authorization")}} 首部。</p> + +<pre class="line-numbers language-html">CONNECT server.example.com:80 HTTP/1.1 +Host: server.example.com:80 +Proxy-Authorization: basic aGVsbG86d29ybGQ=</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", "CONNECT", "4.3.6")}}</td> + <td>Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("http.methods.CONNECT")}}</p> + +<h2 id="相关内容">相关内容</h2> + +<ul> + <li>{{Glossary("Proxy server")}}</li> + <li>{{HTTPHeader("Proxy-Authorization")}}</li> +</ul> |