Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AutoCorrect files/zh-cn/web/http/headers/**/* #5881

Merged
merged 4 commits into from
May 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</table>

<div class="blockIndicator note">
<p><strong>注意:</strong> <a href="https://developer.mozilla.org/en-US/docs/Glossary/Client_hints">Client Hints</a>只能在安全源(通过TLS)上访问。所有安全的请求都应该持久化Accept-CH和Accept-CH-Lifetime头,以确保<a href="https://developer.mozilla.org/en-US/docs/Glossary/Client_hints">Client Hints</a>可靠地发送。</p>
<p><strong>注意</strong> <a href="https://developer.mozilla.org/en-US/docs/Glossary/Client_hints">Client Hints</a>只能在安全源(通过 TLS)上访问。所有安全的请求都应该持久化 Accept-CH 和 Accept-CH-Lifetime 头,以确保<a href="https://developer.mozilla.org/en-US/docs/Glossary/Client_hints">Client Hints</a>可靠地发送。</p>
</div>

<h2 id="语法">语法</h2>
Expand Down
4 changes: 2 additions & 2 deletions files/zh-cn/web/http/headers/accept-ch/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</table>

<div class="blockIndicator note">
<p><strong>注意:</strong> <a href="/en-US/docs/Glossary/Client_hints">Client Hints</a>只能在安全源(通过TLS)上访问。所有安全的请求都应该持久化Accept-CH和Accept-CH-Lifetime头,以确保<a href="/en-US/docs/Glossary/Client_hints">Client Hints</a>可靠地发送。</p>
<p><strong>注意</strong> <a href="/en-US/docs/Glossary/Client_hints">Client Hints</a>只能在安全源(通过 TLS)上访问。所有安全的请求都应该持久化 Accept-CH 和 Accept-CH-Lifetime 头,以确保<a href="/en-US/docs/Glossary/Client_hints">Client Hints</a>可靠地发送。</p>
</div>

<h2 id="语法">语法</h2>
Expand All @@ -40,7 +40,7 @@ <h2 id="例子">例子</h2>
</pre>

<div class="blockIndicator note">
<p><strong>注意:</strong>  牢记要根据所接受的Client Hints<a href="https://developer.mozilla.org/en-US/docs/Glossary/Client_hints#Varying_Client_Hints">更改响应</a>。</p>
<p><strong>注意</strong>  牢记要根据所接受的 Client Hints<a href="https://developer.mozilla.org/en-US/docs/Glossary/Client_hints#Varying_Client_Hints">更改响应</a>。</p>
</div>

<h2 id="浏览器兼容性">浏览器兼容性</h2>
Expand Down
6 changes: 3 additions & 3 deletions files/zh-cn/web/http/headers/accept-charset/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

<p><strong><code>Accept-Charset</code></strong> 请求头用来告知(服务器)客户端可以处理的字符集类型。 借助<a href="/en-US/docs/Web/HTTP/Content_negotiation">内容协商机制</a>,服务器可以从诸多备选项中选择一项进行应用, 并使用{{HTTPHeader("Content-Type")}} 应答头通知客户端它的选择。浏览器通常不会设置此项值,因为每种内容类型的默认值通常都是正确的,但是发送它会更有利于识别。</p>

<p>如果服务器不能提供任何可以匹配的字符集的版本,那么理论上来说应该返回一个 {{HTTPStatus("406")}} (Not Acceptable,不被接受)的错误码。但是为了更好的用户体验,这种方法很少采用,取而代之的是将其忽略。</p>
<p>如果服务器不能提供任何可以匹配的字符集的版本,那么理论上来说应该返回一个 {{HTTPStatus("406")}}(Not Acceptable,不被接受)的错误码。但是为了更好的用户体验,这种方法很少采用,取而代之的是将其忽略。</p>

<div class="note">
<p>在早期版本的HTTP/1.1协议中,规定了一个默认的字符集(ISO-8859-1)。但是现在情况不同了,目前每一种内容类型都有自己的默认字符集。</p>
<p>在早期版本的 HTTP/1.1 协议中,规定了一个默认的字符集 (ISO-8859-1)。但是现在情况不同了,目前每一种内容类型都有自己的默认字符集。</p>
</div>

<table class="properties">
Expand All @@ -44,7 +44,7 @@ <h2 id="指令">指令</h2>

<dl>
<dt><code>&lt;charset&gt;</code></dt>
<dd><code>诸如 utf-8</code> 或 <code>iso-8859-15的字符集。</code></dd>
<dd><code>诸如 utf-8</code> 或 <code>iso-8859-15 的字符集。</code></dd>
<dt><code>*</code></dt>
<dd><code>在这个消息头中未提及的任意其他字符集;'*'</code> 用来表示通配符。</dd>
<dt><code>;q=</code> (q-factor weighting)</dt>
Expand Down
6 changes: 3 additions & 3 deletions files/zh-cn/web/http/headers/accept-encoding/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@

<ul>
<li>要发送的数据已经经过压缩,再次进行压缩不会导致被传输的数据量更小。一些图像格式的文件会存在这种情况;</li>
<li>服务器超载,无法承受压缩需求导致的计算开销。通常,如果服务器使用超过80%的计算能力,微软建议不要压缩。</li>
<li>服务器超载,无法承受压缩需求导致的计算开销。通常,如果服务器使用超过 80% 的计算能力,微软建议不要压缩。</li>
</ul>

<p>只要 identity —— 表示不需要进行任何编码——没有被明确禁止使用(通过 identity;q=0 指令或是 *;q=0 而没有为 identity 明确指定权重值),则服务器禁止返回表示客户端错误的 {{HTTPStatus("406")}} Not Acceptable 响应。</p>

<div class="note"><strong>注意:</strong>
<div class="note"><strong>注意</strong>

<ul>
<li>
Expand Down Expand Up @@ -59,7 +59,7 @@ <h2 id="指令">指令</h2>

<dl>
<dt><code>gzip</code></dt>
<dd>表示采用 <a class="external external-icon" href="http://en.wikipedia.org/wiki/LZ77_and_LZ78#LZ77">Lempel-Ziv coding</a> (LZ77) 压缩算法,以及32位CRC校验的编码方式。</dd>
<dd>表示采用 <a class="external external-icon" href="http://en.wikipedia.org/wiki/LZ77_and_LZ78#LZ77">Lempel-Ziv coding</a> (LZ77) 压缩算法,以及 32 位 CRC 校验的编码方式。</dd>
<dt><code>compress</code></dt>
<dd>采用 <a class="external external-icon" href="http://en.wikipedia.org/wiki/LZW">Lempel-Ziv-Welch</a> (LZW) 压缩算法。</dd>
<dt><code>deflate</code></dt>
Expand Down
2 changes: 1 addition & 1 deletion files/zh-cn/web/http/headers/accept-patch/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
---
<div>{{HTTPSidebar}}</div>

<p>服务器使用 HTTP 响应头 <code><strong>Accept-</strong></code><strong><code>Patch</code></strong> 通知浏览器请求的媒体类型(media-type)可以被服务器理解。</p>
<p>服务器使用 HTTP 响应头 <code><strong>Accept-</strong></code><strong><code>Patch</code></strong> 通知浏览器请求的媒体类型 (media-type) 可以被服务器理解。</p>

<p><strong><code>Accept-Patch</code></strong> in response to any method means that PATCH is allowed on the resource identified by the Request-URI. Two common cases lead to this:</p>

Expand Down
8 changes: 4 additions & 4 deletions files/zh-cn/web/http/headers/accept-ranges/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
---
<div>{{HTTPSidebar}}</div>

<p>服务器使用 HTTP 响应头 <code><strong>Accept-Ranges</strong></code> 标识自身支持范围请求(partial requests)。字段的具体值用于定义范围请求的单位。</p>
<p>服务器使用 HTTP 响应头 <code><strong>Accept-Ranges</strong></code> 标识自身支持范围请求 (partial requests)。字段的具体值用于定义范围请求的单位。</p>

<p>当浏览器发现<code> Accept-Ranges </code>头时,可以尝试<em>继续</em>中断了的下载,而不是重新开始。</p>

Expand Down Expand Up @@ -33,10 +33,10 @@ <h2 id="指令">指令</h2>

<dl>
<dt><code>none</code></dt>
<dd>不支持任何范围请求单位,由于其等同于没有返回此头部,因此很少使用。不过一些浏览器,比如IE9,会依据该头部去禁用或者移除下载管理器的暂停按钮。</dd>
<dd>不支持任何范围请求单位,由于其等同于没有返回此头部,因此很少使用。不过一些浏览器,比如 IE9,会依据该头部去禁用或者移除下载管理器的暂停按钮。</dd>
<dt><code>bytes</code></dt>
<dd>
<p>范围请求的单位是 bytes (字节)。</p>
<p>范围请求的单位是 bytes(字节)。</p>
</dd>
</dl>

Expand All @@ -55,7 +55,7 @@ <h2 id="规范">规范</h2>
</tr>
<tr>
<td>{{RFC("7233", "Accept-Ranges", "2.3")}}</td>
<td>超文本传输协议 (HTTP/1.1): 范围请求</td>
<td>超文本传输协议(HTTP/1.1): 范围请求</td>
</tr>
</tbody>
</table>
Expand Down
8 changes: 4 additions & 4 deletions files/zh-cn/web/http/headers/accept/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
---
<div>{{HTTPSidebar}}</div>

<p><strong><code>Accept</code></strong> 请求头用来告知(服务器)客户端可以处理的内容类型,这种内容类型用<a href="/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types">MIME类型</a>来表示。借助<a href="/en-US/docs/Web/HTTP/Content_negotiation">内容协商机制</a>, 服务器可以从诸多备选项中选择一项进行应用,并使用 {{HTTPHeader("Content-Type")}} 应答头通知客户端它的选择。浏览器会基于请求的上下文来为这个请求头设置合适的值,比如获取一个CSS层叠样式表时值与获取图片、视频或脚本文件时的值是不同的。</p>
<p><strong><code>Accept</code></strong> 请求头用来告知(服务器)客户端可以处理的内容类型,这种内容类型用<a href="/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types">MIME 类型</a>来表示。借助<a href="/en-US/docs/Web/HTTP/Content_negotiation">内容协商机制</a>, 服务器可以从诸多备选项中选择一项进行应用,并使用 {{HTTPHeader("Content-Type")}} 应答头通知客户端它的选择。浏览器会基于请求的上下文来为这个请求头设置合适的值,比如获取一个 CSS 层叠样式表时值与获取图片、视频或脚本文件时的值是不同的。</p>

<table class="properties">
<tbody>
Expand Down Expand Up @@ -37,12 +37,12 @@ <h2 id="指令">指令</h2>

<dl>
<dt><code>&lt;MIME_type&gt;/&lt;MIME_subtype&gt;</code></dt>
<dd>单一精确的 <a href="/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types">MIME </a>类型, 例如<code>text/html</code>.</dd>
<dd>单一精确的 <a href="/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types">MIME </a>类型例如<code>text/html</code>.</dd>
<dt><code>&lt;MIME_type&gt;/*</code></dt>
<dd>一类 MIME 类型, 但是没有指明子类。 <code>image/*</code> 可以用来指代 <code>image/png</code>, <code>image/svg</code>, <code>image/gif</code> 以及任何其他的图片类型。</dd>
<dd>一类 MIME 类型但是没有指明子类。 <code>image/*</code> 可以用来指代 <code>image/png</code>, <code>image/svg</code>, <code>image/gif</code> 以及任何其他的图片类型。</dd>
<dt><code>*/*</code></dt>
<dd>任意类型的 MIME 类型</dd>
<dt><code>;q=</code> (q因子权重)</dt>
<dt><code>;q=</code> (q 因子权重)</dt>
<dd>值代表优先顺序,用相对<a href="/en-US/docs/Glossary/Quality_values">质量价值</a>表示,又称作权重。</dd>
</dl>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
---
<div>{{HTTPSidebar}}</div>

<p><strong><code>Access-Control-Allow-Credentials</code></strong> 响应头表示是否可以将对请求的响应暴露给页面。返回true则可以,其他值均不可以。</p>
<p><strong><code>Access-Control-Allow-Credentials</code></strong> 响应头表示是否可以将对请求的响应暴露给页面。返回 true 则可以,其他值均不可以。</p>

<p>Credentials可以是 cookies, authorization headers 或 TLS client certificates。</p>
<p>Credentials 可以是 cookies, authorization headers 或 TLS client certificates。</p>

<p>当作为对预检请求的响应的一部分时,这能表示是否真正的请求可以使用credentials。注意简单的{{HTTPMethod("GET")}} 请求没有预检,所以若一个对资源的请求带了credentials,如果这个响应头没有随资源返回,响应就会被浏览器忽视,不会返回到web内容。</p>
<p>当作为对预检请求的响应的一部分时,这能表示是否真正的请求可以使用 credentials。注意简单的{{HTTPMethod("GET")}} 请求没有预检,所以若一个对资源的请求带了 credentials,如果这个响应头没有随资源返回,响应就会被浏览器忽视,不会返回到 web 内容。</p>

<p><code>Access-Control-Allow-Credentials</code> 头 工作中与{{domxref("XMLHttpRequest.withCredentials")}} 或Fetch API中的{{domxref("Request.Request()", "Request()")}} 构造器中的<code>credentials</code> 选项结合使用。Credentials必须在前后端都被配置(即the <code>Access-Control-Allow-Credentials</code> header 和 XHR 或Fetch request中都要配置)才能使带credentials的CORS请求成功。</p>
<p><code>Access-Control-Allow-Credentials</code> 头 工作中与{{domxref("XMLHttpRequest.withCredentials")}} 或 Fetch API 中的{{domxref("Request.Request()", "Request()")}} 构造器中的<code>credentials</code> 选项结合使用。Credentials 必须在前后端都被配置(即 the <code>Access-Control-Allow-Credentials</code> header 和 XHR 或 Fetch request 中都要配置)才能使带 credentials 的 CORS 请求成功。</p>

<table class="properties">
<tbody>
Expand All @@ -41,23 +41,23 @@ <h2 id="指令">指令</h2>

<dl>
<dt>true</dt>
<dd>这个头的唯一有效值(区分大小写)。如果不需要credentials,相比将其设为false,请直接忽视这个头。</dd>
<dd>这个头的唯一有效值(区分大小写)。如果不需要 credentials,相比将其设为 false,请直接忽视这个头。</dd>
</dl>

<h2 id="例子">例子</h2>

<p>允许credentials:</p>
<p>允许 credentials:</p>

<pre>Access-Control-Allow-Credentials: true</pre>

<p>使用带credentials的 <a href="/en-US/docs/Web/API/XMLHttpRequest">XHR</a> :</p>
<p>使用带 credentials 的 <a href="/en-US/docs/Web/API/XMLHttpRequest">XHR</a> :</p>

<pre class="brush: js">var xhr = new XMLHttpRequest();
xhr.open('GET', 'http://example.com/', true);
xhr.withCredentials = true;
xhr.send(null);</pre>

<p>使用带credentials的 <a href="/en-US/docs/Web/API/Fetch_API">Fetch</a> :</p>
<p>使用带 credentials 的 <a href="/en-US/docs/Web/API/Fetch_API">Fetch</a> :</p>

<pre class="brush: js">fetch(url, {
credentials: 'include'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@
---
<div>{{HTTPSidebar}}</div>

<p>响应首部 <strong><code>Access-Control-Allow-Headers</code></strong> 用于 {{glossary("preflight request")}} (预检请求)中,列出了将会在正式请求的 {{HTTPHeader("Access-Control-Request-Headers")}} 字段中出现的首部信息。</p>
<p>响应首部 <strong><code>Access-Control-Allow-Headers</code></strong> 用于 {{glossary("preflight request")}}(预检请求)中,列出了将会在正式请求的 {{HTTPHeader("Access-Control-Request-Headers")}} 字段中出现的首部信息。</p>

<p>简单首部,如 {{glossary("simple header", "simple headers")}}、{{HTTPHeader("Accept")}}、{{HTTPHeader("Accept-Language")}}、{{HTTPHeader("Content-Language")}}、{{HTTPHeader("Content-Type")}} (只限于解析后的值为 <code>application/x-www-form-urlencoded、</code><code>multipart/form-data </code>或 <code>text/plain 三种MIME类型(不包括参数)),它们始终是被支持的,不需要在这个首部特意列出。</code></p>
<p>简单首部,如 {{glossary("simple header", "simple headers")}}、{{HTTPHeader("Accept")}}、{{HTTPHeader("Accept-Language")}}、{{HTTPHeader("Content-Language")}}、{{HTTPHeader("Content-Type")}}(只限于解析后的值为 <code>application/x-www-form-urlencoded、</code><code>multipart/form-data </code>或 <code>text/plain 三种 MIME 类型(不包括参数)),它们始终是被支持的,不需要在这个首部特意列出。</code></p>

<p>如果请求中含有 {{HTTPHeader("Access-Control-Request-Headers")}} 字段,那么这个首部是必要的。</p>

Expand Down Expand Up @@ -42,17 +42,17 @@ <h2 id="指令">指令</h2>
<dd>可支持的请求首部名字。请求头会列出所有支持的首部列表,用逗号隔开。</dd>
</dl>

<p>注意以下这些特定的首部是一直允许的:{{HTTPHeader("Accept")}}, {{HTTPHeader("Accept-Language")}}, {{HTTPHeader("Content-Language")}}, {{HTTPHeader("Content-Type")}} (但只在其值属于 MIME 类型 <code>application/x-www-form-urlencoded</code>, <code>multipart/form-data</code> 或 <code>text/plain</code>中的一种时)。这些被称作{{Glossary("simple headers")}},你无需特意声明它们。</p>
<p>注意以下这些特定的首部是一直允许的:{{HTTPHeader("Accept")}}, {{HTTPHeader("Accept-Language")}}, {{HTTPHeader("Content-Language")}}, {{HTTPHeader("Content-Type")}}(但只在其值属于 MIME 类型 <code>application/x-www-form-urlencoded</code>, <code>multipart/form-data</code> 或 <code>text/plain</code>中的一种时)。这些被称作{{Glossary("simple headers")}},你无需特意声明它们。</p>

<p><strong><code>*</code> (wildcard)</strong></p>

<p>对于没有凭据的请求(没有HTTP cookie或HTTP认证信息的请求),值“ <code>*</code>”仅作为特殊的通配符值。 在具有凭据的请求中,它被视为没有特殊语义的文字标头名称“ *”。 请注意,{{HTTPHeader("Authorization")}}标头不能使用通配符,并且始终需要明确列出。</p>
<p>对于没有凭据的请求(没有 HTTP cookie 或 HTTP 认证信息的请求),值“ <code>*</code>”仅作为特殊的通配符值。 在具有凭据的请求中,它被视为没有特殊语义的文字标头名称“ *”。 请注意,{{HTTPHeader("Authorization")}}标头不能使用通配符,并且始终需要明确列出。</p>

<h2 id="示例">示例</h2>

<h3 id="自定义的请求头">自定义的请求头</h3>

<p>下面是 <code>Access-Control-Allow-Headers</code> 标头的一个示例。 它表明,除了CORS安全清单列出的请求标头外,对服务器的CORS请求还支持名为X-Custom-Header的自定义标头。</p>
<p>下面是 <code>Access-Control-Allow-Headers</code> 标头的一个示例。 它表明,除了 CORS 安全清单列出的请求标头外,对服务器的 CORS 请求还支持名为 X-Custom-Header 的自定义标头。</p>

<pre class="notranslate"><code>Access-Control-Allow-Headers: X-Custom-Header</code></pre>

Expand Down Expand Up @@ -112,7 +112,7 @@ <h2 id="浏览器兼容性">浏览器兼容性</h2>
<h2 id="有关兼容性的注意事项">有关兼容性的注意事项</h2>

<ul>
<li>在最新规范中提出的通配符(*),尚未被如下浏览器实现:
<li>在最新规范中提出的通配符 (*),尚未被如下浏览器实现:
<ul>
<li>Chromium: <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=615313">Issue 615313</a></li>
<li>Firefox: {{bug(1309358)}}</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ <h2 id="浏览器兼容性">浏览器兼容性</h2>
<h2 id="兼容性注解">兼容性注解</h2>

<ul>
<li>最新规范中提到的通配符值(*)尚未在以下浏览器中实现:
<li>最新规范中提到的通配符值 (*) 尚未在以下浏览器中实现
<ul>
<li>Chromium: <a href="https://bugs.chromium.org/p/chromium/issues/detail?id=615313">Issue 615313</a></li>
<li>Firefox: {{bug(1309358)}}</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ <h2 id="指令">指令</h2>
<dt>*</dt>
<dd>对于不需具备凭证(credentials)的请求,服务器会以“<code>*</code>”作为通配符,从而允许所有域都具有访问资源的权限。</dd>
<dt>&lt;origin&gt;</dt>
<dd>指定一个可以访问资源的URI。</dd>
<dd>指定一个可以访问资源的 URI。</dd>
</dl>

<h2 id="示例">示例</h2>
Expand All @@ -45,7 +45,7 @@ <h2 id="示例">示例</h2>

<pre>Access-Control-Allow-Origin: https://developer.mozilla.org</pre>

<h3 id="CORS和缓存">CORS和缓存</h3>
<h3 id="CORS和缓存">CORS 和缓存</h3>

<p>如果服务器未使用“<code>*</code>”,而是指定了一个域,那么为了向客户端表明服务器的返回会根据<code>Origin</code>请求头而有所不同,必须在{{HTTPHeader("Vary")}}响应头中包含<code>Origin</code>。</p>

Expand Down
Loading