diff --git a/.prettierignore b/.prettierignore index 656b66a2d9a702..188c9e436fd8e5 100644 --- a/.prettierignore +++ b/.prettierignore @@ -94,6 +94,5 @@ build/ /files/zh-cn/web/api/**/*.md /files/zh-cn/web/css/**/*.md /files/zh-cn/web/html/**/*.md -/files/zh-cn/web/http/**/*.md /files/zh-cn/web/javascript/reference/**/*.md /files/zh-cn/web/svg/**/*.md diff --git a/files/zh-cn/web/http/basics_of_http/evolution_of_http/index.md b/files/zh-cn/web/http/basics_of_http/evolution_of_http/index.md index 3969a90d20ef48..623c7ea4c69fd9 100644 --- a/files/zh-cn/web/http/basics_of_http/evolution_of_http/index.md +++ b/files/zh-cn/web/http/basics_of_http/evolution_of_http/index.md @@ -31,9 +31,9 @@ GET /mypage.html 响应也极其简单的:只包含响应文档本身。 ```html - -这是一个非常简单的 HTML 页面 - + + 这是一个非常简单的 HTML 页面 + ``` 跟后来的版本不同,HTTP/0.9 的响应内容并不包含 HTTP 头。这意味着只有 HTML 文件可以传送,无法传输其他类型的文件。也没有状态码或错误代码。一旦出现问题,一个特殊的包含问题描述信息的 HTML 文件将被发回,供人们查看。 diff --git a/files/zh-cn/web/http/basics_of_http/identifying_resources_on_the_web/index.md b/files/zh-cn/web/http/basics_of_http/identifying_resources_on_the_web/index.md index 804a728c6ad17f..49efe7a29fa56f 100644 --- a/files/zh-cn/web/http/basics_of_http/identifying_resources_on_the_web/index.md +++ b/files/zh-cn/web/http/basics_of_http/identifying_resources_on_the_web/index.md @@ -50,18 +50,18 @@ urn:ietf:rfc:7230 - ![Protocol](mdn-url-protocol@x2.png) - : `http://`告诉浏览器使用何种协议。对于大部分 Web 资源,通常使用 HTTP 协议或其安全版本,HTTPS 协议。另外,浏览器也知道如何处理其他协议。例如, `mailto:` 协议指示浏览器打开邮件客户端;`ftp:`协议指示浏览器处理文件传输。常见的方案有: -| 方案 | 描述 | -| ----------- | --------------------------------------------------------------------- | -| data | [Data URIs](/zh-CN/docs/Web/HTTP/data_URIs) | -| file | 指定主机上文件的名称 | -| ftp | [文件传输协议](/zh-CN/docs/Glossary/FTP) | +| 方案 | 描述 | +| ----------- | ------------------------------------------------------------------ | +| data | [Data URIs](/zh-CN/docs/Web/HTTP/data_URIs) | +| file | 指定主机上文件的名称 | +| ftp | [文件传输协议](/zh-CN/docs/Glossary/FTP) | | http/https | [超文本传输 协议/安全的超文本传输协议](/zh-CN/docs/Glossary/HTTP) | -| mailto | 电子邮件地址 | -| ssh | 安全 shell | -| tel | 电话 | -| urn | 统一资源名称 | -| view-source | 资源的源代码 | -| ws/wss | (加密的)[WebSocket](/zh-CN/docs/WebSockets) 连接 | +| mailto | 电子邮件地址 | +| ssh | 安全 shell | +| tel | 电话 | +| urn | 统一资源名称 | +| view-source | 资源的源代码 | +| ws/wss | (加密的)[WebSocket](/zh-CN/docs/WebSockets) 连接 | ### 主机 diff --git a/files/zh-cn/web/http/basics_of_http/mime_types/index.md b/files/zh-cn/web/http/basics_of_http/mime_types/index.md index 8e2332a03fe1f9..507e4e5da526e7 100644 --- a/files/zh-cn/web/http/basics_of_http/mime_types/index.md +++ b/files/zh-cn/web/http/basics_of_http/mime_types/index.md @@ -141,9 +141,9 @@ HTML 并没有明确定义被用于{{HTMLElement("audio")}}和{{HTMLElement("vid | `audio/wave` `audio/wav` `audio/x-wav` `audio/x-pn-wav` | 音频流媒体文件。一般支持 PCM 音频编码 (WAVE codec "1") ,其他解码器有限支持(如果有的话)。 | | `audio/webm` | WebM 音频文件格式。Vorbis 和 Opus 是其最常用的解码器。 | | `video/webm` | 采用 WebM 视频文件格式的音视频文件。VP8 和 VP9 是其最常用的视频解码器。Vorbis 和 Opus 是其最常用的音频解码器。 | -| `audio/ogg` | 采用 OGG 多媒体文件格式的音频文件。Vorbis 是这个多媒体文件格式最常用的音频解码器。 | -| `video/ogg` | 采用 OGG 多媒体文件格式的音视频文件。常用的视频解码器是 Theora;音频解码器为 Vorbis。 | -| `application/ogg` | 采用 OGG 多媒体文件格式的音视频文件。常用的视频解码器是 Theora;音频解码器为 Vorbis。 | +| `audio/ogg` | 采用 OGG 多媒体文件格式的音频文件。Vorbis 是这个多媒体文件格式最常用的音频解码器。 | +| `video/ogg` | 采用 OGG 多媒体文件格式的音视频文件。常用的视频解码器是 Theora;音频解码器为 Vorbis。 | +| `application/ogg` | 采用 OGG 多媒体文件格式的音视频文件。常用的视频解码器是 Theora;音频解码器为 Vorbis。 | | `application/json` | application/json (MIME_type) | ### multipart/form-data diff --git a/files/zh-cn/web/http/browser_detection_using_the_user_agent/index.md b/files/zh-cn/web/http/browser_detection_using_the_user_agent/index.md index 528fafaff032a9..13409612ebe9fa 100644 --- a/files/zh-cn/web/http/browser_detection_using_the_user_agent/index.md +++ b/files/zh-cn/web/http/browser_detection_using_the_user_agent/index.md @@ -96,7 +96,7 @@ slug: Web/HTTP/Browser_detection_using_the_user_agent | 浏览器 | 规则 | 示例 | | ------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| Mozilla (Gecko, Firefox) | 注释中的 [**Mobile 或 Tablet 标记**](/zh-CN/docs/Gecko_user_agent_string_reference) | Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0 | +| Mozilla (Gecko, Firefox) | 注释中的 [**Mobile 或 Tablet 标记**](/zh-CN/docs/Gecko_user_agent_string_reference) | Mozilla/5.0 (Android; Mobile; rv:13.0) Gecko/13.0 Firefox/13.0 | | WebKit-based (Android, Safari) | 注释外的[**Mobile Safari 标记**](https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariWebContent/OptimizingforSafarioniPhone/OptimizingforSafarioniPhone.html#//apple_ref/doc/uid/TP40006517-SW3) | Mozilla/5.0 (Linux; U; Android 4.0.3; de-ch; HTC Sensation Build/IML74K) AppleWebKit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30 | | Blink-based (Chromium, Google Chrome, Opera 15+) | 注释外的[**Mobile Safari 标记**](https://developers.google.com/chrome/mobile/docs/user-agent) | Mozilla/5.0 (Linux; Android 4.4.2); Nexus 5 Build/KOT49H) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.117 Mobile Safari/537.36 OPR/20.0.1396.72047 | | Presto-based (Opera 12-) | 注释中的[**Opera Mobi/xyz 标记**](http://my.opera.com/community/openweb/idopera/)(Opera 12-) | Opera/9.80 (Android 2.3.3; Linux; Opera Mobi/ADR-1111101157; U; es-ES) Presto/2.9.201 Version/11.50 | diff --git a/files/zh-cn/web/http/caching/index.md b/files/zh-cn/web/http/caching/index.md index 8963c610602f17..66ed66fdd5f225 100644 --- a/files/zh-cn/web/http/caching/index.md +++ b/files/zh-cn/web/http/caching/index.md @@ -462,7 +462,7 @@ Cache-Control: max-age=31536000 共享缓存主要位于源服务器之前,旨在减少到源服务器的流量。 -因此,如果多个相同的请求同时到达共享缓存,中间缓存将代表自己将单个请求转发到源,然后源可以将结果重用于所有客户端。这称为***请求折叠***。 +因此,如果多个相同的请求同时到达共享缓存,中间缓存将代表自己将单个请求转发到源,然后源可以将结果重用于所有客户端。这称为**_请求折叠_**。 当请求同时到达时会发生请求折叠,因此即使响应中给出了 `max-age=0` 或 `no-cache`,它也会被重用。 diff --git a/files/zh-cn/web/http/compression/index.md b/files/zh-cn/web/http/compression/index.md index 470885111cdcab..2fa13629d64439 100644 --- a/files/zh-cn/web/http/compression/index.md +++ b/files/zh-cn/web/http/compression/index.md @@ -17,8 +17,8 @@ slug: Web/HTTP/Compression 每一种文件类型都会存有冗余,也就是*浪费的空间*。如果一个典型的文本文件存在 60% 的冗余的话,那么对于其他类型的文件,例如音频或视频文件来说,这个比率会更高。不同于文本文件,这些其他类型的媒体文件占据的空间也更大,所以很早就出现了回收这些浪费的空间的需求。工程师们设计了可以应用于特定用途的文件类型的经过优化的算法。用于文件的压缩算法可以大致分为两类: -- *无损压缩*。在压缩与解压缩的循环期间,不会对要恢复的数据进行修改。复原后的数据与原始数据是一致的(比特与比特之间一一对应)。对于图片文件来说,`gif` 或者 `png` 格式的文件就是采用了无损压缩算法。 -- *有损压缩*。在压缩与解压缩的循环期间,会对原始数据进行修改,但是会(希望)以用户无法觉察的方式进行。网络上的视频文件通常采用有损压缩算法,`jpeg` 格式的图片也是有损压缩。 +- _无损压缩_。在压缩与解压缩的循环期间,不会对要恢复的数据进行修改。复原后的数据与原始数据是一致的(比特与比特之间一一对应)。对于图片文件来说,`gif` 或者 `png` 格式的文件就是采用了无损压缩算法。 +- _有损压缩_。在压缩与解压缩的循环期间,会对原始数据进行修改,但是会(希望)以用户无法觉察的方式进行。网络上的视频文件通常采用有损压缩算法,`jpeg` 格式的图片也是有损压缩。 一些特定的文件格式既可以采用无损压缩算法,又可以采用有损压缩算法,例如 `webp`,并且有损压缩算法可以对压缩比率进行配置,当然这会导致压缩品质的不同。为了使一个站点获得更好的性能,理想情况是在保持可以接受的品质水准的前提下,压缩比率尽可能得高。对于图片来说,通过压缩工具生成的图片对于 Web 应用来说,优化程度可能依然不够高。一般建议选用在保持所要求的品质的前提下压缩比率尽可能高的工具。这里有[各种各样的工具](https://www.creativebloq.com/design/image-compression-tools-1132865)专门用来干这个。 diff --git a/files/zh-cn/web/http/connection_management_in_http_1.x/index.md b/files/zh-cn/web/http/connection_management_in_http_1.x/index.md index b70728711e5c31..1fb4341aa24105 100644 --- a/files/zh-cn/web/http/connection_management_in_http_1.x/index.md +++ b/files/zh-cn/web/http/connection_management_in_http_1.x/index.md @@ -5,7 +5,7 @@ slug: Web/HTTP/Connection_management_in_HTTP_1.x {{HTTPSidebar}} -连接管理是一个 HTTP 的关键话题:打开和保持连接在很大程度上影响着网站和 Web 应用程序的性能。在 HTTP/1.x 里有多种模型:*短连接*、*长连接*和 *HTTP 流水线*。 +连接管理是一个 HTTP 的关键话题:打开和保持连接在很大程度上影响着网站和 Web 应用程序的性能。在 HTTP/1.x 里有多种模型:_短连接_、*长连接*和 _HTTP 流水线_。 HTTP 的传输协议主要依赖于 TCP 来提供从客户端到服务器端之间的连接。在早期,HTTP 使用一个简单的模型来处理这样的连接。这些连接的生命周期是短暂的:每发起一个请求时都会创建一个新的连接,并在收到应答时立即关闭。 @@ -51,7 +51,7 @@ HTTP/1.0 里默认并不使用长连接。把 {{HTTPHeader("Connection")}} 设 > - 正确的实现流水线是复杂的:传输中的资源大小、多少有效的 [RTT](https://zh.wikipedia.org/wiki/來回通訊延遲) 会被用到以及有效带宽都会直接影响到流水线提供的改善。不知道这些的话,重要的消息可能被延迟到不重要的消息后面。这个重要性的概念甚至会演变为影响到页面布局!因此 HTTP 流水线在大多数情况下带来的改善并不明显。 > - 流水线受制于[队头阻塞(HOL)](https://zh.wikipedia.org/wiki/队头阻塞)问题。 > -> 由于这些原因,流水线已被 HTTP/2 中更好的算法——*多路复用*(multiplexing)所取代。 +> 由于这些原因,流水线已被 HTTP/2 中更好的算法——_多路复用_(multiplexing)所取代。 默认情况下,[HTTP](/zh-CN/docs/Web/HTTP) 请求是按顺序发出的。下一个请求只有在当前请求收到响应过后才会被发出。由于会受到网络延迟和带宽的限制,在下一个请求被发送到服务器之前,可能需要等待很长时间。 diff --git a/files/zh-cn/web/http/content_negotiation/index.md b/files/zh-cn/web/http/content_negotiation/index.md index a2ebca63f3388a..dffea6dacae449 100644 --- a/files/zh-cn/web/http/content_negotiation/index.md +++ b/files/zh-cn/web/http/content_negotiation/index.md @@ -5,7 +5,7 @@ slug: Web/HTTP/Content_negotiation {{HTTPSidebar}} -在 [HTTP](/zh-CN/docs/Glossary/HTTP) 协议中,***内容协商***是一种机制,用于为同一 URI 提供资源不同的{{Glossary("Representation header","表示")}}形式,以帮助用户代理指定最适合用户的表示形式(例如,哪种文档语言、哪种图片格式或者哪种内容编码)。 +在 [HTTP](/zh-CN/docs/Glossary/HTTP) 协议中,**_内容协商_**是一种机制,用于为同一 URI 提供资源不同的{{Glossary("Representation header","表示")}}形式,以帮助用户代理指定最适合用户的表示形式(例如,哪种文档语言、哪种图片格式或者哪种内容编码)。 > **备注:** 你可以在[来自 WHATWG 的维基页面](https://wiki.whatwg.org/wiki/Why_not_conneg)发现 HTTP 内容协商的一些缺点。HTML5 提供其他的选择来进行内容协商,例如 [`` 元素](/zh-CN/docs/Web/HTML/Element/source)。 @@ -97,7 +97,7 @@ HTTP/1.1 规范指定了一系列的标准标头用于启动服务端驱动型 服务端驱动型内容协商也有一些缺点:它不能很好的扩展。在协商机制中,每一个特性需要对应一个标头。如果想要使用屏幕大小、分辨率或者其他方面的特性,就需要创建一个新的 HTTP 标头。而且在每一次请求中都必须发送这些标头。在标头很少的时候,这并不是问题,但是随着数量的增多,消息的体积会导致性能的下降。带有精确信息的标头发送的越多,信息熵就会越大,也就准许了更多 HTTP 指纹识别行为,以及与此相关的隐私问题的发生。 -从 HTTP 协议制定之初,该协议就准许另外一种协商机制:*代理驱动型内容协商*,或称为*响应式协商*。在这种协商机制中,当面临不明确的请求时,服务器会返回一个页面,其中包含了可供选择的资源的链接。资源呈现给用户,由用户做出选择。 +从 HTTP 协议制定之初,该协议就准许另外一种协商机制:_代理驱动型内容协商_,或称为*响应式协商*。在这种协商机制中,当面临不明确的请求时,服务器会返回一个页面,其中包含了可供选择的资源的链接。资源呈现给用户,由用户做出选择。 ![客户端请求一个 URL,其中标头表示对内容类型的偏好。服务器有多个由 URL 表示的资源并发回多个响应,因此客户端可以选择应用了首选压缩算法的主体。](httpnego3.png) diff --git a/files/zh-cn/web/http/content_negotiation/list_of_default_accept_values/index.md b/files/zh-cn/web/http/content_negotiation/list_of_default_accept_values/index.md index 8209346148bcff..c83385bd25b67e 100644 --- a/files/zh-cn/web/http/content_negotiation/list_of_default_accept_values/index.md +++ b/files/zh-cn/web/http/content_negotiation/list_of_default_accept_values/index.md @@ -14,7 +14,7 @@ original_slug: Web/HTTP/Content_negotiation/Accept_默认值 | User Agent | Value | Comment | | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- | -| Firefox | `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` | 这个值可以通过 `network.http.accept.default` 参数来修改。 | +| Firefox | `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` | 这个值可以通过 `network.http.accept.default` 参数来修改。 | | Safari, Chrome | `application/xml,application/xhtml+xml,text/html;q=0.9, text/plain;q=0.8,image/png,*/*;q=0.5` | [source](http://www.newmediacampaigns.com/page/browser-rest-http-accept-headers) | | Safari 5 | `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8` | 这是对早期 `Accept` 头的改进,不再把 `image/png` 排在 `text/html` 之前。 | | Internet Explorer 8 | `image/jpeg, application/x-ms-application, image/gif, application/xaml+xml, image/pjpeg, application/x-ms-xbap, application/x-shockwave-flash, application/msword, */*` | 请参见 [IE and the Accept Header (IEInternals' MSDN blog)](http://blogs.msdn.com/b/ieinternals/archive/2009/07/01/ie-and-the-accept-header.aspx). | @@ -39,10 +39,10 @@ original_slug: Web/HTTP/Content_negotiation/Accept_默认值 | User Agent | Value | Comment | | -------------------------------- | -------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| Firefox 3.6 之前的版本 | _不支持 {{HTMLElement("video")}}_ | | +| Firefox 3.6 之前的版本 | _不支持 {{HTMLElement("video")}}_ | | | Firefox 3.6 及以上版本 | `audio/webm, audio/ogg, audio/wav, audio/*;q=0.9, application/ogg;q=0.7, video/*;q=0.6; */*;q=0.5` | 请参见[bug 489071](https://bugzilla.mozilla.org/show_bug.cgi?id=489071) | | Chrome | `*/*` | | -| Internet Explorer 8 或更早的版本 | _不支持 {{HTMLElement("video")}}_ | | +| Internet Explorer 8 或更早的版本 | _不支持 {{HTMLElement("video")}}_ | | ## audio 请求 @@ -52,7 +52,7 @@ original_slug: Web/HTTP/Content_negotiation/Accept_默认值 | ------------------------------ | -------------------------------------------------------------------------------------------- | --------------------------------------------------------------------- | | Firefox 3.6 及以上版本 | `audio/webm,audio/ogg,audio/wav,audio/*;q=0.9,application/ogg;q=0.7,video/*;q=0.6,*/*;q=0.5` | See [bug 489071](https://bugzilla.mozilla.org/show_bug.cgi?id=489071) | | Safari, Chrome | ? | | -| Internet Explorer 8 及更早版本 | _不支持 {{HTMLElement("audio")}}_ | | +| Internet Explorer 8 及更早版本 | _不支持 {{HTMLElement("audio")}}_ | | | Internet Explorer 9 | ? | | ## scripts 请求 diff --git a/files/zh-cn/web/http/cookies/index.md b/files/zh-cn/web/http/cookies/index.md index ef9092179b4a9f..ddeea914457270 100644 --- a/files/zh-cn/web/http/cookies/index.md +++ b/files/zh-cn/web/http/cookies/index.md @@ -95,7 +95,7 @@ Set-Cookie: id=a3fWa; Expires=Wed, 21 Oct 2015 07:28:00 GMT; Secure; HttpOnly #### Domain 属性 -`Domain` 指定了哪些主机可以接受 Cookie。如果不指定,该属性默认为同一 {{Glossary("host")}} 设置 cookie,*不包含子域名*。如果指定了 `Domain`,则一般包含子域名。因此,指定 `Domain` 比省略它的限制要少。但是,当子域需要共享有关用户的信息时,这可能会有所帮助。 +`Domain` 指定了哪些主机可以接受 Cookie。如果不指定,该属性默认为同一 {{Glossary("host")}} 设置 cookie,_不包含子域名_。如果指定了 `Domain`,则一般包含子域名。因此,指定 `Domain` 比省略它的限制要少。但是,当子域需要共享有关用户的信息时,这可能会有所帮助。 例如,如果设置 `Domain=mozilla.org`,则 Cookie 也包含在子域名中(如 `developer.mozilla.org`)。 @@ -187,7 +187,7 @@ Cookie 与特定域和方案(例如,`http` 或 `https`)相关联,如果 第三方服务器可以基于同一浏览器在访问多个站点时发送给它的 cookie 来建立用户浏览历史和习惯的配置文件。Firefox 默认情况下会阻止已知包含跟踪器的第三方 cookie。第三方 cookie(或仅跟踪 cookie)也可能被其他浏览器设置或扩展程序阻止。阻止 Cookie 会导致某些第三方组件(例如社交媒体窗口小部件)无法正常运行。 ->**备注:** 服务器可以(并且应该)设置 cookie [SameSite 属性](/zh-CN/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value)以指定是否可以将 cookie 发送到第三方站点。 +> **备注:** 服务器可以(并且应该)设置 cookie [SameSite 属性](/zh-CN/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value)以指定是否可以将 cookie 发送到第三方站点。 ### Cookie 相关规定 diff --git a/files/zh-cn/web/http/cors/index.md b/files/zh-cn/web/http/cors/index.md index c5d3d3406304de..f68f12a719ecbc 100644 --- a/files/zh-cn/web/http/cors/index.md +++ b/files/zh-cn/web/http/cors/index.md @@ -84,9 +84,9 @@ CORS 请求失败会产生错误,但是为了安全,在 JavaScript 代码层 ```js const xhr = new XMLHttpRequest(); -const url = 'https://bar.other/resources/public-data/'; +const url = "https://bar.other/resources/public-data/"; -xhr.open('GET', url); +xhr.open("GET", url); xhr.onreadystatechange = someHandler; xhr.send(); ``` @@ -147,11 +147,11 @@ Access-Control-Allow-Origin: https://foo.example ```js const xhr = new XMLHttpRequest(); -xhr.open('POST', 'https://bar.other/resources/post-here/'); -xhr.setRequestHeader('X-PINGOTHER', 'pingpong'); -xhr.setRequestHeader('Content-Type', 'application/xml'); +xhr.open("POST", "https://bar.other/resources/post-here/"); +xhr.setRequestHeader("X-PINGOTHER", "pingpong"); +xhr.setRequestHeader("Content-Type", "application/xml"); xhr.onreadystatechange = handler; -xhr.send('Arun'); +xhr.send("Arun"); ``` 上面的代码使用 `POST` 请求发送一个 XML 请求体,该请求包含了一个非标准的 HTTP `X-PINGOTHER` 请求标头。这样的请求标头并不是 HTTP/1.1 的一部分,但通常对于 web 应用很有用处。另外,该请求的 `Content-Type` 为 `application/xml`,且使用了自定义的请求标头,所以该请求需要首先发起“预检请求”。 diff --git a/files/zh-cn/web/http/csp/index.md b/files/zh-cn/web/http/csp/index.md index 755306e670a26a..cb51b0ad314283 100644 --- a/files/zh-cn/web/http/csp/index.md +++ b/files/zh-cn/web/http/csp/index.md @@ -165,7 +165,7 @@ Content-Security-Policy: default-src 'none'; style-src cdn.example.com; report-u `signup.html` 的 HTML 像这样: ```html - + diff --git a/files/zh-cn/web/http/headers/accept-ch-lifetime/index.md b/files/zh-cn/web/http/headers/accept-ch-lifetime/index.md index 6da26e6062c284..c49b6d73ac7e89 100644 --- a/files/zh-cn/web/http/headers/accept-ch-lifetime/index.md +++ b/files/zh-cn/web/http/headers/accept-ch-lifetime/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Accept-CH-Lifetime 服务器设置 **`Accept-CH-Lifetime`** 标头以指定{{HTTPHeader("Accept-CH")}}标头值的持久性,该值指定客户端应在后续请求中包括哪些[Client Hints](/zh-CN/docs/Glossary/Client_hints)标头。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | ? | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | ? | > **备注:** [Client Hints](/zh-CN/docs/Glossary/Client_hints)只能在安全源(通过 TLS)上访问。所有安全的请求都应该持久化 Accept-CH 和 Accept-CH-Lifetime 头,以确保[Client Hints](/zh-CN/docs/Glossary/Client_hints)可靠地发送。 diff --git a/files/zh-cn/web/http/headers/accept-ch/index.md b/files/zh-cn/web/http/headers/accept-ch/index.md index 5786c62b2c31c9..c3f9c6ff87c75d 100644 --- a/files/zh-cn/web/http/headers/accept-ch/index.md +++ b/files/zh-cn/web/http/headers/accept-ch/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Accept-CH **`Accept-CH`** 头由服务器设置,以指定客户端应在后续请求中应包含哪些客户端 [Client Hints](/zh-CN/docs/Glossary/Client_hints) 提示头。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | ? | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | ? | > **备注:** [Client Hints](/zh-CN/docs/Glossary/Client_hints) 只能在安全源(通过 TLS)上访问。所有安全的请求都应该持久化 Accept-CH 和 Accept-CH-Lifetime 头,以确保 [Client Hints](/zh-CN/docs/Glossary/Client_hints) 可靠地发送。 diff --git a/files/zh-cn/web/http/headers/accept-charset/index.md b/files/zh-cn/web/http/headers/accept-charset/index.md index e1ad882dd4d1d7..bbc885fc6c33ce 100644 --- a/files/zh-cn/web/http/headers/accept-charset/index.md +++ b/files/zh-cn/web/http/headers/accept-charset/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/Accept-Charset > **备注:** 在早期版本的 HTTP/1.1 协议中,规定了一个默认的字符集 (ISO-8859-1)。但是现在情况不同了,目前每一种内容类型都有自己的默认字符集。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 句法 diff --git a/files/zh-cn/web/http/headers/accept-encoding/index.md b/files/zh-cn/web/http/headers/accept-encoding/index.md index d6b80bd568e0f8..1941a8f98d50c9 100644 --- a/files/zh-cn/web/http/headers/accept-encoding/index.md +++ b/files/zh-cn/web/http/headers/accept-encoding/index.md @@ -18,9 +18,9 @@ HTTP 请求头 **Accept-Encoding** 会将客户端能够理解的内容编码方 > > - 另外两种编码方式—— bzip 和 bzip2 ——有时候也会用到,尽管并未在标准中出现。这两种方式实现了 UNIX 系统上的同名程序所采用的算法。注意第一种由于专利许可问题已经停止维护。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/accept-language/index.md b/files/zh-cn/web/http/headers/accept-language/index.md index 22a8d9e203095c..6847503e440881 100644 --- a/files/zh-cn/web/http/headers/accept-language/index.md +++ b/files/zh-cn/web/http/headers/accept-language/index.md @@ -11,10 +11,10 @@ slug: Web/HTTP/Headers/Accept-Language 如果服务器不能提供任何可以匹配的语言的版本,那么理论上来说应该返回一个 {{HTTPStatus("406")}}(Not Acceptable,不被接受)的错误码。但是为了更好的用户体验,这种方法很少被采用,取而代之的是将其忽略。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple header", "CORS-safelisted request-header")}} | yes | +| Header type | {{Glossary("Request header")}} | +| --------------------------------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple header", "CORS-safelisted request-header")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/accept-patch/index.md b/files/zh-cn/web/http/headers/accept-patch/index.md index 7ac8a7aa36a2a7..7bb375803986dc 100644 --- a/files/zh-cn/web/http/headers/accept-patch/index.md +++ b/files/zh-cn/web/http/headers/accept-patch/index.md @@ -15,9 +15,9 @@ A server receiving a PATCH request with an unsupported media type could reply wi > > - Two others content encoding, `bzip` and `bzip2`, are sometimes used, though not standard. They implement the algorithm used by these two UNIX programs. Note that the first one was discontinued due to patent licensing problems. -| 头部类型 | {{Glossary("Response header")}} | -| ---------------------------------------------------------------------- | ---------------------------------------- | -| {{Glossary("Forbidden header name")}}(禁止修改的 HTTP 头) | yes | +| 头部类型 | {{Glossary("Response header")}} | +| ----------------------------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}}(禁止修改的 HTTP 头) | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/accept-ranges/index.md b/files/zh-cn/web/http/headers/accept-ranges/index.md index da73a8cd92cc54..20563ba64082bb 100644 --- a/files/zh-cn/web/http/headers/accept-ranges/index.md +++ b/files/zh-cn/web/http/headers/accept-ranges/index.md @@ -7,11 +7,11 @@ slug: Web/HTTP/Headers/Accept-Ranges 服务器使用 HTTP 响应头 **`Accept-Ranges`** 标识自身支持范围请求 (partial requests)。字段的具体值用于定义范围请求的单位。 -当浏览器发现` Accept-Ranges `头时,可以尝试*继续*中断了的下载,而不是重新开始。 +当浏览器发现`Accept-Ranges`头时,可以尝试*继续*中断了的下载,而不是重新开始。 -| 头部类型 | {{Glossary("Response header")}} | -| ---------------------------------------------------------------------- | ---------------------------------------- | -| {{Glossary("Forbidden header name")}}(禁止修改的 HTTP 头) | 否 | +| 头部类型 | {{Glossary("Response header")}} | +| ----------------------------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}}(禁止修改的 HTTP 头) | 否 | ## 语法 diff --git a/files/zh-cn/web/http/headers/accept/index.md b/files/zh-cn/web/http/headers/accept/index.md index 44bc60508a8814..cc50dd90899404 100644 --- a/files/zh-cn/web/http/headers/accept/index.md +++ b/files/zh-cn/web/http/headers/accept/index.md @@ -7,10 +7,10 @@ slug: Web/HTTP/Headers/Accept **`Accept`** 请求头用来告知(服务器)客户端可以处理的内容类型,这种内容类型用[MIME 类型](/zh-CN/docs/Web/HTTP/Basics_of_HTTP/MIME_types)来表示。借助[内容协商机制](/zh-CN/docs/Web/HTTP/Content_negotiation), 服务器可以从诸多备选项中选择一项进行应用,并使用 {{HTTPHeader("Content-Type")}} 应答头通知客户端它的选择。浏览器会基于请求的上下文来为这个请求头设置合适的值,比如获取一个 CSS 层叠样式表时值与获取图片、视频或脚本文件时的值是不同的。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple header", "CORS-safelisted request-header")}} | yes | +| Header type | {{Glossary("Request header")}} | +| --------------------------------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple header", "CORS-safelisted request-header")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/access-control-allow-credentials/index.md b/files/zh-cn/web/http/headers/access-control-allow-credentials/index.md index f9c42052f99849..34f623017bb166 100644 --- a/files/zh-cn/web/http/headers/access-control-allow-credentials/index.md +++ b/files/zh-cn/web/http/headers/access-control-allow-credentials/index.md @@ -15,9 +15,9 @@ Credentials 可以是 cookies、authorization headers 或 TLS client certificate `Access-Control-Allow-Credentials` 标头需要与 {{domxref("XMLHttpRequest.withCredentials")}} 或 Fetch API 的 {{domxref("Request.Request()", "Request()")}} 构造函数中的 `credentials` 选项结合使用。Credentials 必须在前后端都被配置(即 `Access-Control-Allow-Credentials` header 和 XHR 或 Fetch request 中都要配置)才能使带 credentials 的 CORS 请求成功。 -| 头部类型 | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| 头部类型 | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -42,7 +42,7 @@ Access-Control-Allow-Credentials: true ```js var xhr = new XMLHttpRequest(); -xhr.open('GET', 'http://example.com/', true); +xhr.open("GET", "http://example.com/", true); xhr.withCredentials = true; xhr.send(null); ``` @@ -51,8 +51,8 @@ xhr.send(null); ```js fetch(url, { - credentials: 'include' -}) + credentials: "include", +}); ``` ## 规范 diff --git a/files/zh-cn/web/http/headers/access-control-allow-headers/index.md b/files/zh-cn/web/http/headers/access-control-allow-headers/index.md index dcb03fe38c74ed..6f662d2506fcfc 100644 --- a/files/zh-cn/web/http/headers/access-control-allow-headers/index.md +++ b/files/zh-cn/web/http/headers/access-control-allow-headers/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/Access-Control-Allow-Headers 如果请求中含有 {{HTTPHeader("Access-Control-Request-Headers")}} 字段,那么这个首部是必要的。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/access-control-allow-methods/index.md b/files/zh-cn/web/http/headers/access-control-allow-methods/index.md index 3ffbf6b26f87a7..488544acad48c2 100644 --- a/files/zh-cn/web/http/headers/access-control-allow-methods/index.md +++ b/files/zh-cn/web/http/headers/access-control-allow-methods/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Access-Control-Allow-Methods 响应首部 **`Access-Control-Allow-Methods`** 在对 {{glossary("preflight request")}}.(预检请求)的应答中明确了客户端所要访问的资源允许使用的方法或方法列表。 -| 报头类型 | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| 报头类型 | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/access-control-allow-origin/index.md b/files/zh-cn/web/http/headers/access-control-allow-origin/index.md index 14097309be463f..7db4922610ef9d 100644 --- a/files/zh-cn/web/http/headers/access-control-allow-origin/index.md +++ b/files/zh-cn/web/http/headers/access-control-allow-origin/index.md @@ -35,6 +35,7 @@ Access-Control-Allow-Origin: null - `` - : 指定一个来源(只能指定一个)。如果服务器支持多个来源的客户端,其必须以与指定客户端匹配的来源来响应请求。 - `null` + - : 指定来源为“null”。 > **备注:** `null` [不应该被使用](https://w3c.github.io/webappsec-cors-for-developers/#avoid-returning-access-control-allow-origin-null):“返回 `Access-Control-Allow-Origin: "null"` 似乎是安全的,但任何使用非分级协议(如 `data:` 或 `file:`)的资源和沙盒文件的 Origin 的序列化都被定义为‘null’。许多用户代理将授予这类文件对带有 `Access-Control-Allow-Origin: "null"` 头的响应的访问权,而且任何源都可以用 `null` 源创建一个恶意文件。因此,应该避免将 ACAO 标头设置为‘null’值。” diff --git a/files/zh-cn/web/http/headers/access-control-max-age/index.md b/files/zh-cn/web/http/headers/access-control-max-age/index.md index 96b2918d380d8c..7908284d4a1284 100644 --- a/files/zh-cn/web/http/headers/access-control-max-age/index.md +++ b/files/zh-cn/web/http/headers/access-control-max-age/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Access-Control-Max-Age The **`Access-Control-Max-Age`** 这个响应头表示 {{glossary("preflight request")}} (预检请求)的返回结果(即 {{HTTPHeader("Access-Control-Allow-Methods")}} 和{{HTTPHeader("Access-Control-Allow-Headers")}} 提供的信息)可以被缓存多久。 -| 报头类型 | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| 报头类型 | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/access-control-request-headers/index.md b/files/zh-cn/web/http/headers/access-control-request-headers/index.md index 515ce13b14f88a..d8f9133dd01ca2 100644 --- a/files/zh-cn/web/http/headers/access-control-request-headers/index.md +++ b/files/zh-cn/web/http/headers/access-control-request-headers/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Access-Control-Request-Headers 请求头 **`Access-Control-Request-Headers`** 出现于 {{glossary("preflight request")}}(预检请求)中,用于通知服务器在真正的请求中会采用哪些请求头。 -| 报头类型 | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| 报头类型 | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/access-control-request-method/index.md b/files/zh-cn/web/http/headers/access-control-request-method/index.md index e08933f2c23249..c7b05977174a8c 100644 --- a/files/zh-cn/web/http/headers/access-control-request-method/index.md +++ b/files/zh-cn/web/http/headers/access-control-request-method/index.md @@ -5,9 +5,9 @@ slug: Web/HTTP/Headers/Access-Control-Request-Method {{HTTPSidebar}}请求头 **`Access-Control-Request-Method`** 出现于 {{glossary("preflight request")}}(预检请求)中,用于通知服务器在真正的请求中会采用哪种 [HTTP 方法](/zh-CN/docs/Web/HTTP/Methods)。因为预检请求所使用的方法总是 {{HTTPMethod("OPTIONS")}} ,与实际请求所使用的方法不一样,所以这个请求头是必要的。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/age/index.md b/files/zh-cn/web/http/headers/age/index.md index b31431be5ebe6a..367fa10070ff49 100644 --- a/files/zh-cn/web/http/headers/age/index.md +++ b/files/zh-cn/web/http/headers/age/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Age Age 的值通常接近于 0。表示此对象刚刚从原始服务器获取不久;其他的值则是表示代理服务器当前的系统时间与此应答中的通用头 {{HTTPHeader("Date")}} 的值之差。 -| 报头类型 | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| 报头类型 | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/allow/index.md b/files/zh-cn/web/http/headers/allow/index.md index f1cc3b43ceb385..e552363d18b2ae 100644 --- a/files/zh-cn/web/http/headers/allow/index.md +++ b/files/zh-cn/web/http/headers/allow/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Allow 若服务器返回状态码 {{HTTPStatus("405")}} `Method Not Allowed`,则该首部字段亦需要同时返回给客户端。如果 `Allow` 首部字段的值为空,说明资源不接受使用任何 HTTP 方法的请求。这是可能的,比如服务器需要临时禁止对资源的任何访问。 -| Header type | {{Glossary("Entity header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Entity header")}} | +| ------------------------------------- | ----------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/authorization/index.md b/files/zh-cn/web/http/headers/authorization/index.md index 53465f01b548a7..94007cfc2c1f5b 100644 --- a/files/zh-cn/web/http/headers/authorization/index.md +++ b/files/zh-cn/web/http/headers/authorization/index.md @@ -78,7 +78,7 @@ Authorization: Digest username=, - `username*` - : 使用 RFC5987 中定义的扩展符号格式化的用户名。只有当名称无法在 `username` 中编码并且 `userhash` 设置为 `"false"` 时,才应使用此字段。 - `uri` - - : *有效的请求 URI*。有关更多信息,请参阅规范。 + - : _有效的请求 URI_。有关更多信息,请参阅规范。 - `realm` - : 请求的用户名/密码的 realm(同样,应该与所请求资源中对应的 {{HTTPHeader("WWW-Authenticate")}} 响应中的值相匹配)。 - `opaque` diff --git a/files/zh-cn/web/http/headers/cache-control/index.md b/files/zh-cn/web/http/headers/cache-control/index.md index 5d68778003cd19..9e212eb8b48929 100644 --- a/files/zh-cn/web/http/headers/cache-control/index.md +++ b/files/zh-cn/web/http/headers/cache-control/index.md @@ -7,10 +7,10 @@ slug: Web/HTTP/Headers/Cache-Control **`Cache-Control`** 通用消息头字段,被用于在 http 请求和响应中,通过指定指令来实现缓存机制。缓存指令是单向的,这意味着在请求中设置的指令,不一定被包含在响应中。 -| Header type | {{Glossary("General header")}} | -| ------------------------------------------------------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | +| Header type | {{Glossary("General header")}} | +| ------------------------------------------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/clear-site-data/index.md b/files/zh-cn/web/http/headers/clear-site-data/index.md index 169fd57a7e2f43..cd29e25e8aeb45 100644 --- a/files/zh-cn/web/http/headers/clear-site-data/index.md +++ b/files/zh-cn/web/http/headers/clear-site-data/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Clear-Site-Data **`Clear-Site-Data`** 响应头,表示清除当前请求网站有关的浏览器数据(cookie,存储,缓存)。它让 Web 开发人员对浏览器本地存储的数据有更多控制能力。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -33,6 +33,7 @@ Clear-Site-Data: "*" - `"cookies"` - : 表示服务端希望删除 URL 响应的所有 cookie。HTTP 身份验证凭据也会被清除。会影响整个主域,包括子域。所以 `https://example.com` 以及 `https://stage.example.com` 的 Cookie 都会被清除。 - `"storage"` + - : 表示服务端希望删除 URL 原响应的所有 DOM 存储。这包括存储机制,如 - localStorage (执行 `localStorage.clear`), @@ -43,6 +44,7 @@ Clear-Site-Data: "*" - WebSQL 数据库, - [FileSystem API data](/zh-CN/docs/Web/API/File_and_Directory_Entries_API), - Plugin data (Flash via [`NPP_ClearSiteData`](https://wiki.mozilla.org/NPAPI:ClearSiteData)). + - `"executionContexts"` - : 表示服务端希望浏览器重新加载本请求 ({{domxref("Location.reload")}}). - `"*"` (通配符) diff --git a/files/zh-cn/web/http/headers/connection/index.md b/files/zh-cn/web/http/headers/connection/index.md index ffdfba702c440b..306aa33ad62036 100644 --- a/files/zh-cn/web/http/headers/connection/index.md +++ b/files/zh-cn/web/http/headers/connection/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/Connection 除去标准的逐段传输(hop-by-hop)头({{HTTPHeader("Keep-Alive")}}, {{HTTPHeader("Transfer-Encoding")}}, {{HTTPHeader("TE")}}, {{HTTPHeader("Connection")}}, {{HTTPHeader("Trailer")}}, {{HTTPHeader("Upgrade")}}, {{HTTPHeader("Proxy-Authorization")}} and {{HTTPHeader("Proxy-Authenticate")}}),任何逐段传输头都需要在 Connection 头中列出,这样才能让第一个代理知道必须处理它们且不转发这些头。标准的逐段传输头也可以列出(常见的例子是 {{HTTPHeader("Keep-Alive")}},但这不是必须的)。 -| Header type | {{Glossary("General header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("General header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/content-disposition/index.md b/files/zh-cn/web/http/headers/content-disposition/index.md index a4d33ce0d425d0..11a15f97b0fdfa 100644 --- a/files/zh-cn/web/http/headers/content-disposition/index.md +++ b/files/zh-cn/web/http/headers/content-disposition/index.md @@ -53,9 +53,11 @@ Content-Disposition: form-data; name="fieldName"; filename="filename.jpg" ### 指令 - `name` + - : 后面是一个表单字段名的字符串,每一个字段名会对应一个子部分。在同一个字段名对应多个文件的情况下(例如,带有 [`multiple`](/zh-CN/docs/Web/HTML/Element/input#multiple) 属性的 {{HTMLElement("input","<input type=file>")}} 元素),则多个子部分共用同一个字段名。 如果 `name` 参数的值为 `'_charset_'`,意味着这个子部分表示的不是一个 HTML 字段,而是在未明确指定字符集信息的情况下各部分使用的默认字符集。 + - `filename` - : 后面是要传送的文件的初始名称的字符串。这个参数总是可选的,而且不能盲目使用:路径信息必须舍掉,同时要进行一定的转换以符合服务器文件系统规则。这个参数主要用来提供展示性信息。当与 `Content-Disposition: attachment` 一同使用的时候,它被用作"保存为"对话框中呈现给用户的默认文件名。 - `filename\*` diff --git a/files/zh-cn/web/http/headers/content-language/index.md b/files/zh-cn/web/http/headers/content-language/index.md index ec7abf17065182..c56d67f03f0fb6 100644 --- a/files/zh-cn/web/http/headers/content-language/index.md +++ b/files/zh-cn/web/http/headers/content-language/index.md @@ -11,11 +11,11 @@ slug: Web/HTTP/Headers/Content-Language 如果没有指明 `Content-Language`,那么默认地,文件内容是提供给所有语言的访问者使用的。多个语言标签也是合法的,同样的,这个首部还可以用来描述不同媒体类型的文件,而不单单局限于文本型文档。 -| Header type | {{Glossary("Entity header")}} | -| ------------------------------------------------------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | -| {{Glossary("Simple header", "CORS-safelisted request-header")}} | yes | +| Header type | {{Glossary("Entity header")}} | +| ------------------------------------------------------------------------- | ----------------------------- | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | +| {{Glossary("Simple header", "CORS-safelisted request-header")}} | yes | ## 语法 @@ -39,14 +39,14 @@ Content-Language: de-DE, en-CA 全局的 [`lang`](/zh-CN/docs/Web/HTML/Global_attributes/lang) 属性使用在 HTML 元素去表达全部的 [HTML](/zh-CN/docs/Web/HTML)文档或者部分的语言。 ```html - + ``` 不要使用这个 meta 元素去声明文档语言: ```html example-bad - + ``` ### 为资源指定目标访问者 diff --git a/files/zh-cn/web/http/headers/content-length/index.md b/files/zh-cn/web/http/headers/content-length/index.md index 4d3ec2675c7a3d..fb7cd2db341b8f 100644 --- a/files/zh-cn/web/http/headers/content-length/index.md +++ b/files/zh-cn/web/http/headers/content-length/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Content-Length **`Content-Length`** 是一个实体消息首部,用来指明发送给接收方的消息主体的大小,即用十进制数字表示的八位元组的数目。 -| Header type | {{Glossary("Entity header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Entity header")}} | +| ------------------------------------- | ----------------------------- | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/content-location/index.md b/files/zh-cn/web/http/headers/content-location/index.md index d7268f021fff51..5c68cae9efad39 100644 --- a/files/zh-cn/web/http/headers/content-location/index.md +++ b/files/zh-cn/web/http/headers/content-location/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Content-Location {{HTTPHeader("Location")}} 与 `Content-Location`是不同的,前者({{HTTPHeader("Location")}} )指定的是一个重定向请求的目的地址(或者新创建的文件的 URL),而后者( `Content-Location`)指向的是可供访问的资源的直接地址,不需要进行进一步的内容协商。Location 对应的是响应,而 Content-Location 对应的是要返回的实体。 -| Header type | {{Glossary("Entity header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Entity header")}} | +| ------------------------------------- | ----------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/content-range/index.md b/files/zh-cn/web/http/headers/content-range/index.md index 93624201fddf40..60628c70da0b6e 100644 --- a/files/zh-cn/web/http/headers/content-range/index.md +++ b/files/zh-cn/web/http/headers/content-range/index.md @@ -7,10 +7,10 @@ slug: Web/HTTP/Headers/Content-Range 在 HTTP 协议中,响应首部 **`Content-Range`** 显示的是一个数据片段在整个文件中的位置。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/content-security-policy-report-only/index.md b/files/zh-cn/web/http/headers/content-security-policy-report-only/index.md index a9841a848d1156..27f0c5b8a3a677 100644 --- a/files/zh-cn/web/http/headers/content-security-policy-report-only/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy-report-only/index.md @@ -81,11 +81,11 @@ Content-Security-Policy-Report-Only: default-src 'none'; style-src cdn.example.c `signup.html`的 html 如下: ```html - + Sign Up - + ... Content ... diff --git a/files/zh-cn/web/http/headers/content-security-policy/base-uri/index.md b/files/zh-cn/web/http/headers/content-security-policy/base-uri/index.md index 0a65f20b00d596..5f5355d307f7a3 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/base-uri/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/base-uri/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: base-uri' +title: "CSP: base-uri" slug: Web/HTTP/Headers/Content-Security-Policy/base-uri --- @@ -44,7 +44,7 @@ Content-Security-Policy: base-uri ; ### Meta tag 配置 ```html - + ``` ### Apache 配置 @@ -66,12 +66,10 @@ add_header Content-Security-Policy "base-uri 'self';" 假如你的域名不是 `example.com`,那么将 {{HTMLElement("base")}} 元素的 `href` 属性值设置成 `https://example.com` 会违反 CSP 策略。 ```html example-bad - - + + -// Error: Refused to set the document's base URI to 'http://example.com/' -// because it violates the following Content Security Policy -// directive: "base-uri 'self'" + ``` ## 规范 diff --git a/files/zh-cn/web/http/headers/content-security-policy/block-all-mixed-content/index.md b/files/zh-cn/web/http/headers/content-security-policy/block-all-mixed-content/index.md index 37c74b894d2c50..93012db074bf29 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/block-all-mixed-content/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/block-all-mixed-content/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: block-all-mixed-content' +title: "CSP: block-all-mixed-content" slug: Web/HTTP/Headers/Content-Security-Policy/block-all-mixed-content --- diff --git a/files/zh-cn/web/http/headers/content-security-policy/child-src/index.md b/files/zh-cn/web/http/headers/content-security-policy/child-src/index.md index 3c72c77005b368..083b2351db25b5 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/child-src/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/child-src/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: child-src' +title: "CSP: child-src" slug: Web/HTTP/Headers/Content-Security-Policy/child-src --- diff --git a/files/zh-cn/web/http/headers/content-security-policy/connect-src/index.md b/files/zh-cn/web/http/headers/content-security-policy/connect-src/index.md index 17ce67d5b3db9a..f2f70d9642ccbd 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/connect-src/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/connect-src/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: connect-src' +title: "CSP: connect-src" slug: Web/HTTP/Headers/Content-Security-Policy/connect-src --- @@ -76,7 +76,8 @@ Content-Security-Policy: connect-src https://example.com/ navigator.sendBeacon("https://not-example.com/", { /* … */ }); - + ``` ## 规范 diff --git a/files/zh-cn/web/http/headers/content-security-policy/default-src/index.md b/files/zh-cn/web/http/headers/content-security-policy/default-src/index.md index db3cf55469415d..28f31ab2026ce7 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/default-src/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/default-src/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: default-src' +title: "CSP: default-src" slug: Web/HTTP/Headers/Content-Security-Policy/default-src --- @@ -19,8 +19,8 @@ slug: Web/HTTP/Headers/Content-Security-Policy/default-src - {{CSP("style-src")}} - {{CSP("worker-src")}} -| CSP 版本 | 1 | -| -------- | ---------------------------------------- | +| CSP 版本 | 1 | +| -------- | ------------------------------- | | 指令类型 | {{Glossary("Fetch directive")}} | ## 语法 @@ -42,12 +42,14 @@ Content-Security-Policy: default-src ; - `mail.example.com:443:`匹配对 mail.example.com 上的 443 端口号的访问。 - `https://store.example.com`: 匹配对使用了 https: 的 store.example.com 的访问。 - \ + - : 协议名如'http:' 或者 'https:'。**必须带有冒号,不要有单引号**。同时你还可以指定数据协议(data schema)(不推荐使用)。 - - `data:` 允许 [`data:` URIs](/zh-CN/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) 作为内容的源*。这是不安全的。攻击者可以注入任意 data: URI。不要轻易使用这种形式的源,尤其是脚本,绝对不要使用。 + - `data:` 允许 [`data:` URIs](/zh-CN/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) 作为内容的源。这是不安全的。攻击者可以注入任意 data: URI。不要轻易使用这种形式的源,尤其是脚本,绝对不要使用。 - `mediastream:` 允许 [`mediastream:` URIs](/zh-CN/docs/Web/API/MediaStream_API) 作为内容的源。 - `blob:` 允许 [`blob:` URIs](/zh-CN/docs/Web/API/Blob) 作为内容的源。 - `filesystem:` 允许 [`filesystem:` URIs](/zh-CN/docs/Web/API/FileSystem) 作为内容的源。 + - `'self'` - : 指向与要保护的文件所在的源,包括相同的 URL scheme 与端口号。必须有单引号。一些浏览器会特意排除 blob 与 filesystem。需要设定这两种内容类型的站点可以在 Data 属性中进行设定。 - `'unsafe-inline'` diff --git a/files/zh-cn/web/http/headers/content-security-policy/font-src/index.md b/files/zh-cn/web/http/headers/content-security-policy/font-src/index.md index f57469a1ac0406..eb0a597a49baf6 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/font-src/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/font-src/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: font-src' +title: "CSP: font-src" slug: Web/HTTP/Headers/Content-Security-Policy/font-src --- diff --git a/files/zh-cn/web/http/headers/content-security-policy/form-action/index.md b/files/zh-cn/web/http/headers/content-security-policy/form-action/index.md index 0f9fb0439a38ba..57e1a24ed2a50b 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/form-action/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/form-action/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: form-action' +title: "CSP: form-action" slug: Web/HTTP/Headers/Content-Security-Policy/form-action --- @@ -9,10 +9,10 @@ HTTP {{HTTPHeader("Content-Security-Policy")}} (CSP) 的 **`form-action`** 指 > **警告:** 在表单提交之后, `form-action` 指令是否应该阻止重定向仍有待讨论,各个浏览器对于此行为的实现也不尽相同(例如,Chrome 63 会阻止重定向,而 Firefox 57 则不会)。 -| CSP version | 2 | -| ------------------------------------- | ------------------------------------------------ | -| Directive type | {{Glossary("Navigation directive")}} | -| {{CSP("default-src")}} fallback | No. 未设定时允许任何值。 | +| CSP version | 2 | +| ------------------------------- | ------------------------------------ | +| Directive type | {{Glossary("Navigation directive")}} | +| {{CSP("default-src")}} fallback | No. 未设定时允许任何值。 | ## 语法 @@ -28,7 +28,7 @@ Content-Security-Policy: form-action ; ### meta 标签配置 ```html - + ``` ### Apache 服务器配置 @@ -50,15 +50,14 @@ add_header Content-Security-Policy "form-action 'none';" 将 {{HTMLElement("form")}} 元素的 action 设置为内联 JavaScript 会违反 CSP 规则。 ```html example-bad - +
- - + +
-// Error: Refused to send form data because it violates the following -// Content Security Policy directive: "form-action 'none'". + ``` ## 规范 diff --git a/files/zh-cn/web/http/headers/content-security-policy/frame-ancestors/index.md b/files/zh-cn/web/http/headers/content-security-policy/frame-ancestors/index.md index ddebf4c9c3e66b..f34d3cbbe3fbbb 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/frame-ancestors/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/frame-ancestors/index.md @@ -54,12 +54,14 @@ Content-Security-Policy: frame-ancestors ; - `mail.example.com:443`: 匹配所有对于 mail.example.com 在 443 端口的访问意图。 - `https://store.example.com`: 匹配所有使用 https:访问 store.example.com 的意图。 - \ + - : 一个 schema 配置,比如'http:'或'https:'。注意,冒号是必要的。你同样也可以指定一个 data schema(但并不推荐)。 - '`data:`' 允许 [`data:` URIs](/zh-CN/docs/Web/HTTP/Basics_of_HTTP/Data_URIs) 作为内容源。_这是不安全的,攻击者可以用此来注入恶意代码。请谨慎使用,并不要令其作用于脚本。_ - `'mediastream:'` 允许 [`mediastream:` URIs](/zh-CN/docs/Web/API/MediaStream_API) 作为内容源。 - `'blob:'` 允许 [`blob:` URIs](/zh-CN/docs/Web/API/Blob) 作为内容源。 - `'filesystem:'` 允许 [`filesystem:` URIs](/zh-CN/docs/Web/API/FileSystem) 作为内容源。 + - `'self'` - : 指向一个该受保护文档所在的源,包含同样的 URL schema 和端口号。必须用单引号设置。有些浏览器会从源指令中排`除 blob`和`filesystem`。需要允许这些内容类型的站点可以通过 Data 属性指定它们。 - `'none'` diff --git a/files/zh-cn/web/http/headers/content-security-policy/index.md b/files/zh-cn/web/http/headers/content-security-policy/index.md index b818b70d93f12b..2a62c57843953e 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Content-Security-Policy 如需更多信息,请查阅[Content Security Policy (CSP)](/zh-CN/docs/Web/HTTP/CSP)。 -| 头部类型 | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| 头部类型 | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -24,6 +24,7 @@ Content-Security-Policy: ; 通过获取指令来控制某些可能被加载的确切的资源类型的位置。 - {{CSP("child-src")}} + - : **child-src**:为 [Web Workers](/zh-CN/docs/Web/API/Web_Workers_API) 和其他内嵌浏览器内容(例如用 {{HTMLElement("frame")}} 和 {{HTMLElement("iframe")}} 加载到页面的内容)定义合法的源地址。 > **警告:** 如果开发者希望管控内嵌浏览器内容和 web worker 应分别使用 {{CSP("frame-src")}} 和 {{CSP("worker-src")}} 指令,来相对的取代 **`child-src`**。 diff --git a/files/zh-cn/web/http/headers/content-security-policy/sandbox/index.md b/files/zh-cn/web/http/headers/content-security-policy/sandbox/index.md index c4a67af9d6543d..058cbea75288e3 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/sandbox/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/sandbox/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: sandbox' +title: "CSP: sandbox" slug: Web/HTTP/Headers/Content-Security-Policy/sandbox --- diff --git a/files/zh-cn/web/http/headers/content-security-policy/script-src-elem/index.md b/files/zh-cn/web/http/headers/content-security-policy/script-src-elem/index.md index 76942856c6ec3c..6bfec8420901b1 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/script-src-elem/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/script-src-elem/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: script-src-elem' +title: "CSP: script-src-elem" slug: Web/HTTP/Headers/Content-Security-Policy/script-src-elem --- diff --git a/files/zh-cn/web/http/headers/content-security-policy/upgrade-insecure-requests/index.md b/files/zh-cn/web/http/headers/content-security-policy/upgrade-insecure-requests/index.md index dce9566d8bdbd6..45dc909f7d2763 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/upgrade-insecure-requests/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/upgrade-insecure-requests/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: upgrade-insecure-requests' +title: "CSP: upgrade-insecure-requests" slug: Web/HTTP/Headers/Content-Security-Policy/upgrade-insecure-requests --- @@ -30,15 +30,15 @@ Content-Security-Policy: upgrade-insecure-requests; 一旦将上述头部设置在计划从 HTTP 迁移到 HTTPS 的 example.com 域名上,非跳转 (non-navigational) 的不安全资源请求会自动升级到 HTTPS(包括第当前域名以及第三方请求)。 ```html - - + + ``` 这些 URL 在请求发送之前都会被改写成 HTTPS,也就意味着不安全的请求都不会发送出去。注意,如果请求的资源在 HTTPS 情况下不可用,则该请求将失败,其也不能回退到 HTTP。 ```html - - + + ``` Navigational upgrades to third-party resources brings a significantly higher potential for breakage, these are not upgraded: diff --git a/files/zh-cn/web/http/headers/content-security-policy/worker-src/index.md b/files/zh-cn/web/http/headers/content-security-policy/worker-src/index.md index af643d2d8e67d0..c1ae59140a6918 100644 --- a/files/zh-cn/web/http/headers/content-security-policy/worker-src/index.md +++ b/files/zh-cn/web/http/headers/content-security-policy/worker-src/index.md @@ -1,5 +1,5 @@ --- -title: 'CSP: worker-src' +title: "CSP: worker-src" slug: Web/HTTP/Headers/Content-Security-Policy/worker-src --- diff --git a/files/zh-cn/web/http/headers/content-type/index.md b/files/zh-cn/web/http/headers/content-type/index.md index 91c584382f594f..3bde2c4dc07ff6 100644 --- a/files/zh-cn/web/http/headers/content-type/index.md +++ b/files/zh-cn/web/http/headers/content-type/index.md @@ -11,10 +11,10 @@ slug: Web/HTTP/Headers/Content-Type 在请求中 (如{{HTTPMethod("POST")}} 或 {{HTTPMethod("PUT")}}),客户端告诉服务器实际发送的数据类型。 -| Header type | {{Glossary("Entity header")}} | -| ------------------------------------------------------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | +| Header type | {{Glossary("Entity header")}} | +| ------------------------------------------------------------------------- | ----------------------------- | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | ## 句法 @@ -40,8 +40,8 @@ Content-Type: multipart/form-data; boundary=something ```html
- - + +
``` diff --git a/files/zh-cn/web/http/headers/cross-origin-embedder-policy/index.md b/files/zh-cn/web/http/headers/cross-origin-embedder-policy/index.md index d3e30aaba604d4..9e70e09724362b 100644 --- a/files/zh-cn/web/http/headers/cross-origin-embedder-policy/index.md +++ b/files/zh-cn/web/http/headers/cross-origin-embedder-policy/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Cross-Origin-Embedder-Policy HTTP **`Cross-Origin-Embedder-Policy`** (COEP) 响应标头可防止文档加载未明确授予文档权限 (通过 [CORP]() 或者 [CORS](/zh-CN/docs/Web/HTTP/CORS)) 的任何跨域资源。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -53,7 +53,7 @@ if (crossOriginIsolated) { If you enable COEP using `require-corp` and have a cross origin resource that needs to be loaded, it needs to support [CORS](/zh-CN/docs/Web/HTTP/CORS) and you need to explicitly mark the resource as loadable from another origin to avoid blockage from COEP. For example, you can use the [`crossorigin`](/zh-CN/docs/Web/HTML/Attributes/crossorigin) attribute for this image from a third-party site: ```html - + ``` ## 规范 diff --git a/files/zh-cn/web/http/headers/cross-origin-resource-policy/index.md b/files/zh-cn/web/http/headers/cross-origin-resource-policy/index.md index d44b8d870940f4..851e9b18b5f96b 100644 --- a/files/zh-cn/web/http/headers/cross-origin-resource-policy/index.md +++ b/files/zh-cn/web/http/headers/cross-origin-resource-policy/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Cross-Origin-Resource-Policy **`Cross-Origin-Resource-Policy`** 响应头会指示浏览器阻止对指定资源的无源跨域/跨站点请求。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/date/index.md b/files/zh-cn/web/http/headers/date/index.md index ae358f2cee7382..c5a598e9206a56 100644 --- a/files/zh-cn/web/http/headers/date/index.md +++ b/files/zh-cn/web/http/headers/date/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Date **`Date`** 是一个通用首部,其中包含了报文创建的日期和时间。 -| Header type | {{Glossary("General header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("General header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/device-memory/index.md b/files/zh-cn/web/http/headers/device-memory/index.md index 1d542116d1de5c..ec361f7003ec7e 100644 --- a/files/zh-cn/web/http/headers/device-memory/index.md +++ b/files/zh-cn/web/http/headers/device-memory/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Device-Memory **`Device-Memory`** 是一个跟 [Device Memory API](/zh-CN/docs/Web/API/Device_Memory_API) 相关的请求头,它跟 [Client Hints](/zh-CN/docs/Glossary/Client_hints) 请求头的作用相似,用来表示客户端设备内存的近似大小。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | ? | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | ? | > **备注:** Client Hints are accessible only on secure origins (via TLS). Server has to opt in to receive `Device-Memory` header from the client by sending {{HTTPHeader("Accept-CH")}} and {{HTTPHeader("Accept-CH-Lifetime")}} response headers. diff --git a/files/zh-cn/web/http/headers/digest/index.md b/files/zh-cn/web/http/headers/digest/index.md index d72bc8bf1fee6a..229116fb94b9f2 100644 --- a/files/zh-cn/web/http/headers/digest/index.md +++ b/files/zh-cn/web/http/headers/digest/index.md @@ -15,9 +15,9 @@ slug: Web/HTTP/Headers/Digest - 完全不包含在消息体中中 (例如,在一个 [`HEAD`](/zh-CN/docs/Web/HTTP/Methods/HEAD) 请求的响应中) - 部分包含在消息体中 (例如,在一个 [range request](/zh-CN/docs/Web/HTTP/Range_requests) 的响应中)。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/dnt/index.md b/files/zh-cn/web/http/headers/dnt/index.md index 2f37aeeee1ee01..709c4b96a5c443 100644 --- a/files/zh-cn/web/http/headers/dnt/index.md +++ b/files/zh-cn/web/http/headers/dnt/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/DNT 请求首部 **`DNT`** (**D**o **N**ot **T**rack) 表明了用户对于网站追踪的偏好。它允许用户指定自己是否更注重个人隐私还是定制化内容。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/dpr/index.md b/files/zh-cn/web/http/headers/dpr/index.md index bf85cf28ef1fee..87ba548558380c 100644 --- a/files/zh-cn/web/http/headers/dpr/index.md +++ b/files/zh-cn/web/http/headers/dpr/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/DPR **`DPR`**请求头是“ [客户端提示”](/zh-CN/docs/Glossary/Client_hints)消息头,它代表客户端设备的像素比 ({{Glossary("DPR")}}),该比例是与每个 CSS 像素相对应的物理设备像素的数量。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | ? | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | ? | > **备注:** Client Hints are accessible only on secure origins (via TLS). Server has to opt in to receive `DPR` header from the client by sending {{HTTPHeader("Accept-CH")}} and {{HTTPHeader("Accept-CH-Lifetime")}} response headers. diff --git a/files/zh-cn/web/http/headers/early-data/index.md b/files/zh-cn/web/http/headers/early-data/index.md index 9b2c0f9d61593b..022e2f476dca9b 100644 --- a/files/zh-cn/web/http/headers/early-data/index.md +++ b/files/zh-cn/web/http/headers/early-data/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Early-Data **`Early-Data`** 头(header)由某个中间者设置来表示请求已在 TLS early data 中传送,且表示 某个中间者理解 {{HTTPStatus("425", "425 (Too Early)")}} 状态码。**`Early-Data`** 头(header)不由请求的发起者设置 (例如,浏览器)。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/etag/index.md b/files/zh-cn/web/http/headers/etag/index.md index 48d5a4712a60ea..8286df2faedd5a 100644 --- a/files/zh-cn/web/http/headers/etag/index.md +++ b/files/zh-cn/web/http/headers/etag/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/ETag 如果给定 URL 中的资源更改,则*一定*要生成新的 `ETag` 值。比较这些 `ETag` 能快速确定此资源是否变化。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/expect-ct/index.md b/files/zh-cn/web/http/headers/expect-ct/index.md index 1e731b0b99d813..1607bf62b40a49 100644 --- a/files/zh-cn/web/http/headers/expect-ct/index.md +++ b/files/zh-cn/web/http/headers/expect-ct/index.md @@ -43,14 +43,19 @@ Expect-CT: report-uri="", ## 指令 - `max-age` + - : 该指令指定接收到 `Expect-CT` 标头后的秒数,在此期间用户代理应将收到消息的主机视为已知的 `Expect-CT` 主机。 如果缓存接收到的值大于它可以表示的值,或者如果其随后的计算溢出,则缓存将认为该值为 2147483648(2 的 31 次幂)或其可以表示的最大正整数。 + - `report-uri=""` {{optional_inline}} + - : 该指令指定用户代理报告 `Expect-CT` 错误的 URI。 当和 `enforce` 指令共同存在时,这种配置被称为“强制执行和报告”配置,示意用户代理既应该强制遵守证书透明度政策,也应当报告违规行为。 + - `enforce` {{optional_inline}} + - : 该指令示意用户代理应强制遵守证书透明度政策(而不是只报告合规性),并且用户代理应拒绝违反证书透明度政策的之后连接。 当 `enforce` 指令和 `report-uri` 指令共同存在时,这种配置被称为“强制执行和报告”配置,示意用户代理既应该强制遵守证书透明度政策,也应当报告违规行为。 diff --git a/files/zh-cn/web/http/headers/expect/index.md b/files/zh-cn/web/http/headers/expect/index.md index a9d06d51d1b7f4..3730c100366c86 100644 --- a/files/zh-cn/web/http/headers/expect/index.md +++ b/files/zh-cn/web/http/headers/expect/index.md @@ -16,9 +16,9 @@ slug: Web/HTTP/Headers/Expect 常见的浏览器不会发送 `Expect` 消息头,但是其他类型的客户端如 cURL 默认会这么做。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/expires/index.md b/files/zh-cn/web/http/headers/expires/index.md index 6f53db7fed1d16..56a55fce4aca3f 100644 --- a/files/zh-cn/web/http/headers/expires/index.md +++ b/files/zh-cn/web/http/headers/expires/index.md @@ -9,10 +9,10 @@ slug: Web/HTTP/Headers/Expires 如果在{{HTTPHeader("Cache-Control")}}响应头设置了 "max-age" 或者 "s-max-age" 指令,那么 `Expires` 头会被忽略。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/forwarded/index.md b/files/zh-cn/web/http/headers/forwarded/index.md index 79f94a7d15b3e9..faf48605d17e6b 100644 --- a/files/zh-cn/web/http/headers/forwarded/index.md +++ b/files/zh-cn/web/http/headers/forwarded/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/Forwarded 这个消息首部会被用来进行调试和统计,以及生成基于位置的定制化内容,按照设计的目的,它会暴露一定的隐私和敏感信息,比如客户端的 IP 地址。所以在应用此消息首部的时候,需要将用户的隐私问题考虑在内。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -24,11 +24,13 @@ Forwarded: by=; for=; host=; proto= ## 指令 - \ + - : 一个 identifier 显示了在使用代理的过程中被修改或者丢失的信息。它们可以是以下几种形式: - 一个 IP 地址(V4 或 V6,端口号可选,ipv6 地址需要包含在方括号里面,同时用引号括起来), - 语意不明的标识符(比如 "\_hidden" 或者 "\_secret"), - 或者是 "unknown",当当前信息实体不可知的时候(但是你依然想要说明请求被进行了转发)。 + - by=\ - : 该请求进入到代理服务器的接口。 - for=\ diff --git a/files/zh-cn/web/http/headers/from/index.md b/files/zh-cn/web/http/headers/from/index.md index 49eb64d7a38910..b280279794a0cb 100644 --- a/files/zh-cn/web/http/headers/from/index.md +++ b/files/zh-cn/web/http/headers/from/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/From > **警告:** 不可以将 From 首部用于访问控制或者身份验证。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/host/index.md b/files/zh-cn/web/http/headers/host/index.md index 0e2004794b8e80..c4a0beef7f5434 100644 --- a/files/zh-cn/web/http/headers/host/index.md +++ b/files/zh-cn/web/http/headers/host/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/Host 所有 HTTP/1.1 请求报文中必须包含一个`Host`头字段。对于缺少`Host`头或者含有超过一个`Host`头的 HTTP/1.1 请求,可能会收到{{HTTPStatus("400")}}(Bad Request)状态码。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/if-match/index.md b/files/zh-cn/web/http/headers/if-match/index.md index 1eb1db4b5758b5..d438459db10c8d 100644 --- a/files/zh-cn/web/http/headers/if-match/index.md +++ b/files/zh-cn/web/http/headers/if-match/index.md @@ -14,9 +14,9 @@ slug: Web/HTTP/Headers/If-Match - 对于 {{HTTPMethod("GET")}} 和 {{HTTPMethod("HEAD")}} 方法,搭配 {{HTTPHeader("Range")}}首部使用,可以用来保证新请求的范围与之前请求的范围是对同一份资源的请求。如果 ETag 无法匹配,那么需要返回 {{HTTPStatus("416")}} (Range Not Satisfiable,范围请求无法满足) 响应。 - 对于其他方法来说,尤其是 {{HTTPMethod("PUT")}}, `If-Match` 首部可以用来避免[更新丢失问题](https://www.w3.org/1999/04/Editing/#3.1)。它可以用来检测用户想要上传的不会覆盖获取原始资源之后做出的更新。如果请求的条件不满足,那么需要返回 {{HTTPStatus("412")}} (Precondition Failed,先决条件失败) 响应。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/if-modified-since/index.md b/files/zh-cn/web/http/headers/if-modified-since/index.md index e1e81be5631f09..a8d0214ca1d7d9 100644 --- a/files/zh-cn/web/http/headers/if-modified-since/index.md +++ b/files/zh-cn/web/http/headers/if-modified-since/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/If-Modified-Since 最常见的应用场景是来更新没有特定 {{HTTPHeader("ETag")}} 标签的缓存实体。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/if-none-match/index.md b/files/zh-cn/web/http/headers/if-none-match/index.md index 65134495dd3e26..c6c844fb6c1e7a 100644 --- a/files/zh-cn/web/http/headers/if-none-match/index.md +++ b/files/zh-cn/web/http/headers/if-none-match/index.md @@ -18,9 +18,9 @@ slug: Web/HTTP/Headers/If-None-Match - 采用 {{HTTPMethod("GET")}} 或 {{HTTPMethod("HEAD")}} 方法,来更新拥有特定的{{HTTPHeader("ETag")}} 属性值的缓存。 - 采用其他方法,尤其是 {{HTTPMethod("PUT")}},将 `If-None-Match` used 的值设置为 \* ,用来生成事先并不知道是否存在的文件,可以确保先前并没有进行过类似的上传操作,防止之前操作数据的丢失。这个问题属于[更新丢失问题](https://www.w3.org/1999/04/Editing/#3.1)的一种。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/if-range/index.md b/files/zh-cn/web/http/headers/if-range/index.md index e4837aed46665b..0789c0f65c4ccc 100644 --- a/files/zh-cn/web/http/headers/if-range/index.md +++ b/files/zh-cn/web/http/headers/if-range/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/If-Range **`If-Range`** 头字段通常用于断点续传的下载过程中,用来自从上次中断后,确保下载的资源没有发生改变。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/if-unmodified-since/index.md b/files/zh-cn/web/http/headers/if-unmodified-since/index.md index 5a301211fdccf8..418225755ede59 100644 --- a/files/zh-cn/web/http/headers/if-unmodified-since/index.md +++ b/files/zh-cn/web/http/headers/if-unmodified-since/index.md @@ -12,9 +12,9 @@ HTTP 协议中的 **`If-Unmodified-Since`** 消息头用于请求之中,使得 - 与 non-{{Glossary("safe")}} 方法如 {{HTTPMethod("POST")}} 搭配使用,可以用来[优化并发控制](https://en.wikipedia.org/wiki/Optimistic_concurrency_control),例如在某些 wiki 应用中的做法:假如在原始副本获取之后,服务器上所存储的文档已经被修改,那么对其作出的编辑会被拒绝提交。 - 与含有 {{HTTPHeader("If-Range")}} 消息头的范围请求搭配使用,用来确保新的请求片段来自于未经修改的文档。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/keep-alive/index.md b/files/zh-cn/web/http/headers/keep-alive/index.md index b363ec95e806b0..c0d3464710a485 100644 --- a/files/zh-cn/web/http/headers/keep-alive/index.md +++ b/files/zh-cn/web/http/headers/keep-alive/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Keep-Alive > **备注:** 需要将 The {{HTTPHeader("Connection")}} 首部的值设置为 "keep-alive" 这个首部才有意义。同时需要注意的是,在 HTTP/2 协议中, {{HTTPHeader("Connection")}} 和 {{HTTPHeader("Keep-Alive")}} 是被忽略的;在其中采用其他机制来进行连接管理。 -| Header type | {{Glossary("General header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("General header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -22,6 +22,7 @@ Keep-Alive: parameters ## 指令 - _parameters_ + - : 一系列用逗号隔开的参数,每一个参数由一个标识符和一个值构成,并使用等号 (`'='`) 隔开。下述标识符是可用的: - `timeout`:指定了一个空闲连接需要保持打开状态的最小时长(以秒为单位)。需要注意的是,如果没有在传输层设置 keep-alive TCP message 的话,大于 TCP 层面的超时设置会被忽略。 diff --git a/files/zh-cn/web/http/headers/large-allocation/index.md b/files/zh-cn/web/http/headers/large-allocation/index.md index da973984e4e184..2058f7af5ca20b 100644 --- a/files/zh-cn/web/http/headers/large-allocation/index.md +++ b/files/zh-cn/web/http/headers/large-allocation/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Large-Allocation [WebAssembly](/zh-CN/docs/WebAssembly) 或者 asm.js 会使用比较大的连续内存空间。例如,对于一些复杂的游戏,其申请的空间将会非常大,甚至会达到 1GB。`Large-Allocation` 告诉浏览器其将要加载的页面可能需要申请一个大的连续内存空间,浏览器依据该头部可能会单独启动一个专有的进程用于处理该页面。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -43,11 +43,13 @@ Large-Allocation: 500 - `Large-Allocation` 报头由于非`non-GET 请求而直接忽略` - : 当一个 {{HTTPMethod("POST")}} 请求用语加载文档,that load cannot currently be redirected into a new process. This error is displayed when loading a document with a `Large-Allocation` header with a non-GET HTTP method. This could be caused due to the document being loaded by a form submission, for example. - A `Large-Allocation` header was ignored due to the presence of windows which have a reference to this browsing context through the frame hierarchy or {{domxref("window.opener")}}. + - : This error means that the document was not loaded at the top level of an user-opened or noopener-opened tab or window. It can occur in these situations: - The document with the `Large-Allocation` header was loaded in an {{HTMLElement("iframe")}}. Firefox cannot move an iframe into a new process currently, so the document must load in the current process. - The document with the `Large-Allocation` header was loaded in a window which was opened by {{domxref("window.open()")}}, `` or other similar methods without `rel="noopener"` or the `"noopener"` feature being set. These windows must remain in the same process as their opener, as they can communicate, meaning that we cannot allow them to switch processes. - The document with the `Large-Allocation header` has opened another window with {{domxref("window.open()")}}, `` or other similar methods without `rel="noopener"` or the `"noopener"` feature being set. This is for the same reason as above, namely that they can communicate and thus we cannot allow them to switch processes. + - `Large-Allocation` 报头由于 文档在加载过程没有被加载而直接忽略 - : Firefox has moved to a [multiprocess architecture](/zh-CN/docs/Mozilla/Firefox/Multiprocess_Firefox), and this architecture is required in order to support the `Large-Allocation` header. Some [legacy Addons](/zh-CN/docs/Mozilla/Add-ons/SDK) can prevent Firefox from using this new, faster, multiprocess architecture. If you have one of these Addons installed, then we will continue to use the old single process architecuture for compatibility, and cannot handle the `Large-Allocation` header. - 由于`Large-Allocation`头部,此页面应将被加载到新进程中,但是在非 Win32 平台上禁用此选项。 diff --git a/files/zh-cn/web/http/headers/last-modified/index.md b/files/zh-cn/web/http/headers/last-modified/index.md index a45a6946ba613b..009b6085fc6967 100644 --- a/files/zh-cn/web/http/headers/last-modified/index.md +++ b/files/zh-cn/web/http/headers/last-modified/index.md @@ -7,10 +7,10 @@ slug: Web/HTTP/Headers/Last-Modified **`Last-Modified`** 是一个响应首部,其中包含源头服务器认定的资源做出修改的日期及时间。它通常被用作一个验证器来判断接收到的或者存储的资源是否彼此一致。由于精确度比 {{HTTPHeader("ETag")}} 要低,所以这是一个备用机制。包含有 {{HTTPHeader("If-Modified-Since")}} 或 {{HTTPHeader("If-Unmodified-Since")}} 首部的条件请求会使用这个字段。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/location/index.md b/files/zh-cn/web/http/headers/location/index.md index ad8a949d22d92b..c42dbca0cf0802 100644 --- a/files/zh-cn/web/http/headers/location/index.md +++ b/files/zh-cn/web/http/headers/location/index.md @@ -18,9 +18,9 @@ slug: Web/HTTP/Headers/Location [`Location`](/zh-CN/docs/Web/HTTP/Headers/Location) 与 `Content-Location`是不同的,前者([`Location`](/zh-CN/docs/Web/HTTP/Headers/Location) )指定的是一个重定向请求的目的地址(或者新创建的文件的 URL),而后者( `Content-Location`)指向的是经过内容协商后的资源的直接地址,不需要进行进一步的内容协商。Location 对应的是响应,而 Content-Location 对应的是要返回的实体。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/permissions-policy/autoplay/index.md b/files/zh-cn/web/http/headers/permissions-policy/autoplay/index.md index 679cab57477dd9..5460eeffb3a4f7 100644 --- a/files/zh-cn/web/http/headers/permissions-policy/autoplay/index.md +++ b/files/zh-cn/web/http/headers/permissions-policy/autoplay/index.md @@ -1,5 +1,5 @@ --- -title: 'Permissions-Policy: autoplay' +title: "Permissions-Policy: autoplay" slug: Web/HTTP/Headers/Permissions-Policy/autoplay --- diff --git a/files/zh-cn/web/http/headers/permissions-policy/camera/index.md b/files/zh-cn/web/http/headers/permissions-policy/camera/index.md index 51c3e854f1cc1e..ff522d774fdd8a 100644 --- a/files/zh-cn/web/http/headers/permissions-policy/camera/index.md +++ b/files/zh-cn/web/http/headers/permissions-policy/camera/index.md @@ -1,5 +1,5 @@ --- -title: 'Permissions-Policy: camera' +title: "Permissions-Policy: camera" slug: Web/HTTP/Headers/Permissions-Policy/camera original_slug: Web/HTTP/Headers/Feature-Policy/camera --- diff --git a/files/zh-cn/web/http/headers/permissions-policy/index.md b/files/zh-cn/web/http/headers/permissions-policy/index.md index fad4113b48c4be..b4ec73e22af696 100644 --- a/files/zh-cn/web/http/headers/permissions-policy/index.md +++ b/files/zh-cn/web/http/headers/permissions-policy/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Permissions-Policy 更多的信息,请查看[Feature Policy](/zh-CN/docs/Web/HTTP/Feature_Policy) -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/permissions-policy/picture-in-picture/index.md b/files/zh-cn/web/http/headers/permissions-policy/picture-in-picture/index.md index 9efab1ad03caaf..a817c3b937ecf0 100644 --- a/files/zh-cn/web/http/headers/permissions-policy/picture-in-picture/index.md +++ b/files/zh-cn/web/http/headers/permissions-policy/picture-in-picture/index.md @@ -1,5 +1,5 @@ --- -title: 'Permissions-Policy: picture-in-picture' +title: "Permissions-Policy: picture-in-picture" slug: Web/HTTP/Headers/Permissions-Policy/picture-in-picture --- diff --git a/files/zh-cn/web/http/headers/pragma/index.md b/files/zh-cn/web/http/headers/pragma/index.md index 6be982fa896dbb..d8c9d19d04f2f9 100644 --- a/files/zh-cn/web/http/headers/pragma/index.md +++ b/files/zh-cn/web/http/headers/pragma/index.md @@ -9,10 +9,10 @@ slug: Web/HTTP/Headers/Pragma > **备注:** 由于 Pragma 在 HTTP 响应中的行为没有确切规范,所以不能可靠替代 HTTP/1.1 中通用首部 Cache-Control,尽管在请求中,假如 Cache-Control 不存在的话,它的行为与 Cache-Control: no-cache 一致。建议只在需要兼容 HTTP/1.0 客户端的场合下应用 Pragma 首部。 -| Header type | {{Glossary("General header")}}, but response behavior is not specified and thus implementation-specific. | -| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ | -| {{Glossary("Forbidden header name")}} | no | -| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | +| Header type | {{Glossary("General header")}}, but response behavior is not specified and thus implementation-specific. | +| ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- | +| {{Glossary("Forbidden header name")}} | no | +| {{Glossary("Simple response header", "CORS-safelisted response-header")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/proxy-authenticate/index.md b/files/zh-cn/web/http/headers/proxy-authenticate/index.md index d1371897e4bec4..fed042e25d0d94 100644 --- a/files/zh-cn/web/http/headers/proxy-authenticate/index.md +++ b/files/zh-cn/web/http/headers/proxy-authenticate/index.md @@ -9,9 +9,9 @@ The HTTP **`Proxy-Authenticate`** 是一个响应首部,指定了获取 {{Glos `Proxy-Authenticate` 首部需要与 {{HTTPStatus("407")}} `Proxy Authentication Required` 响应一起发送。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/proxy-authorization/index.md b/files/zh-cn/web/http/headers/proxy-authorization/index.md index 1e9a1eaaea0417..a35dba3bcb893c 100644 --- a/files/zh-cn/web/http/headers/proxy-authorization/index.md +++ b/files/zh-cn/web/http/headers/proxy-authorization/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Proxy-Authorization **`Proxy-Authorization`** 是一个请求首部,其中包含了用户代理提供给代理服务器的用于身份验证的凭证。这个首部通常是在服务器返回了 {{HTTPStatus("407")}} `Proxy Authentication Required` 响应状态码及 {{HTTPHeader("Proxy-Authenticate")}} 首部后发送的。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -22,6 +22,7 @@ Proxy-Authorization: - \ - : [身份验证类型](/zh-CN/docs/Web/HTTP/Authentication#Authentication_schemes)。一个常见的类型是 ["基本验证"。](/zh-CN/docs/Web/HTTP/Authentication#Basic_authentication_scheme)IANA 机构维护了 [一系列的身份验证机制](http://www.iana.org/assignments/http-authschemes/http-authschemes.xhtml)。 - \ + - : 凭证的构成方式如下: - 将用户名和密码用冒号拼接(aladdin:opensesame)。 diff --git a/files/zh-cn/web/http/headers/range/index.md b/files/zh-cn/web/http/headers/range/index.md index 1c0dd6d7c5de8a..99ea24aff1ae34 100644 --- a/files/zh-cn/web/http/headers/range/index.md +++ b/files/zh-cn/web/http/headers/range/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Range The **`Range`** 是一个请求首部,告知服务器返回文件的哪一部分。在一个 `Range` 首部中,可以一次性请求多个部分,服务器会以 multipart 文件的形式将其返回。如果服务器返回的是范围响应,需要使用 {{HTTPStatus("206")}} `Partial Content` 状态码。假如所请求的范围不合法,那么服务器会返回 {{HTTPStatus("416")}} `Range Not Satisfiable` 状态码,表示客户端错误。服务器允许忽略 `Range` 首部,从而返回整个文件,状态码用 {{HTTPStatus("200")}} 。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/referer/index.md b/files/zh-cn/web/http/headers/referer/index.md index 41f799becd1570..45645883c987f5 100644 --- a/files/zh-cn/web/http/headers/referer/index.md +++ b/files/zh-cn/web/http/headers/referer/index.md @@ -16,9 +16,9 @@ slug: Web/HTTP/Headers/Referer - 来源页面采用的协议为表示本地文件的 "file" 或者 "data" URI; - 当前请求页面采用的是非安全协议,而来源页面采用的是安全协议(HTTPS)。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/referrer-policy/index.md b/files/zh-cn/web/http/headers/referrer-policy/index.md index 04ce4ae2aa2fa8..2d3135d3196e0c 100644 --- a/files/zh-cn/web/http/headers/referrer-policy/index.md +++ b/files/zh-cn/web/http/headers/referrer-policy/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Referrer-Policy **`Referrer-Policy`** 首部用来监管哪些访问来源信息——会在 {{HTTPHeader("Referer")}} 中发送——应该被包含在生成的请求当中。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -43,6 +43,7 @@ Referrer-Policy: unsafe-url - strict-origin-when-cross-origin - : 对于同源的请求,会发送完整的 URL 作为引用地址;在同等安全级别的情况下,发送文件的源作为引用地址 (HTTPS->HTTPS);在降级的情况下不发送此首部 (HTTPS->HTTP)。 - unsafe-url + - : 无论是同源请求还是非同源请求,都发送完整的 URL(移除参数信息之后)作为引用地址。 > **备注:** 这项设置会将受 TLS 安全协议保护的资源的源和路径信息泄露给非安全的源服务器。进行此项设置的时候要慎重考虑。 @@ -76,25 +77,25 @@ CSS 可以从样式表获取引用的资源,这些资源也可以遵从 referr ## 示例 -| Policy | Document | Navigation to | Referrer | -| ------------------------------------- | -------------------------------- | ---------------------------------- | ----------------------------- | -| **`no-referrer`** | `https://example.com/page.html` | any domain or path | no referrer | -| **`no-referrer-when-downgrade`** | `https://example.com/page.html` | `https://example.com/otherpage.html` | `https://example.com/page.html` | -| **`no-referrer-when-downgrade`** | `https://example.com/page.html` | `https://mozilla.org` | `https://example.com/page.html` | -| **`no-referrer-when-downgrade`** | `https://example.com/page.html` | **http**://example.org | no referrer | -| **`origin`** | `https://example.com/page.html` | any domain or path | `https://example.com/` | -| **`origin-when-cross-origin`** | `https://example.com/page.html` | `https://example.com/otherpage.html` | `https://example.com/page.html` | -| **`origin-when-cross-origin`** | `https://example.com/page.html` | `https://mozilla.org` | `https://example.com/` | -| **`origin-when-cross-origin`** | `https://example.com/page.html` | **http**://example.com/page.html | `https://example.com/` | -| **`same-origin`** | `https://example.com/page.html` | `https://example.com/otherpage.html` | `https://example.com/page.html` | -| **`same-origin`** | `https://example.com/page.html` | `https://mozilla.org` | no referrer | -| **`strict-origin`** | `https://example.com/page.html` | `https://mozilla.org` | `https://example.com/` | -| **`strict-origin`** | `https://example.com/page.html` | **http**://example.org | no referrer | -| **`strict-origin`** | **http**://example.com/page.html | any domain or path | `http://example.com/` | -| **`strict-origin-when-cross-origin`** | `https://example.com/page.html` | `https://example.com/otherpage.html` | `https://example.com/page.html` | -| **`strict-origin-when-cross-origin`** | `https://example.com/page.html` | `https://mozilla.org` | `https://example.com/` | -| **`strict-origin-when-cross-origin`** | `https://example.com/page.html` | **http**://example.org | no referrer | -| **`unsafe-url`** | `https://example.com/page.html` | any domain or path | `https://example.com/page.html` | +| Policy | Document | Navigation to | Referrer | +| ------------------------------------- | -------------------------------- | ------------------------------------ | ------------------------------- | +| **`no-referrer`** | `https://example.com/page.html` | any domain or path | no referrer | +| **`no-referrer-when-downgrade`** | `https://example.com/page.html` | `https://example.com/otherpage.html` | `https://example.com/page.html` | +| **`no-referrer-when-downgrade`** | `https://example.com/page.html` | `https://mozilla.org` | `https://example.com/page.html` | +| **`no-referrer-when-downgrade`** | `https://example.com/page.html` | **http**://example.org | no referrer | +| **`origin`** | `https://example.com/page.html` | any domain or path | `https://example.com/` | +| **`origin-when-cross-origin`** | `https://example.com/page.html` | `https://example.com/otherpage.html` | `https://example.com/page.html` | +| **`origin-when-cross-origin`** | `https://example.com/page.html` | `https://mozilla.org` | `https://example.com/` | +| **`origin-when-cross-origin`** | `https://example.com/page.html` | **http**://example.com/page.html | `https://example.com/` | +| **`same-origin`** | `https://example.com/page.html` | `https://example.com/otherpage.html` | `https://example.com/page.html` | +| **`same-origin`** | `https://example.com/page.html` | `https://mozilla.org` | no referrer | +| **`strict-origin`** | `https://example.com/page.html` | `https://mozilla.org` | `https://example.com/` | +| **`strict-origin`** | `https://example.com/page.html` | **http**://example.org | no referrer | +| **`strict-origin`** | **http**://example.com/page.html | any domain or path | `http://example.com/` | +| **`strict-origin-when-cross-origin`** | `https://example.com/page.html` | `https://example.com/otherpage.html` | `https://example.com/page.html` | +| **`strict-origin-when-cross-origin`** | `https://example.com/page.html` | `https://mozilla.org` | `https://example.com/` | +| **`strict-origin-when-cross-origin`** | `https://example.com/page.html` | **http**://example.org | no referrer | +| **`unsafe-url`** | `https://example.com/page.html` | any domain or path | `https://example.com/page.html` | ### 指定后备策略 diff --git a/files/zh-cn/web/http/headers/retry-after/index.md b/files/zh-cn/web/http/headers/retry-after/index.md index 8020d20501620e..c9291ebd3fdb33 100644 --- a/files/zh-cn/web/http/headers/retry-after/index.md +++ b/files/zh-cn/web/http/headers/retry-after/index.md @@ -10,9 +10,9 @@ slug: Web/HTTP/Headers/Retry-After - 当与 {{HTTPStatus(503)}} (Service Unavailable,当前服务不存在) 响应一起发送的时候,表示服务下线的预期时长。 - 当与重定向响应一起发送的时候,比如 {{HTTPStatus(301)}} (Moved Permanently,永久迁移),表示用户代理在发送重定向请求之前需要等待的最短时间。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/sec-ch-ua-full-version-list/index.md b/files/zh-cn/web/http/headers/sec-ch-ua-full-version-list/index.md index 8cb126c55a06d1..cceb41bb237b92 100644 --- a/files/zh-cn/web/http/headers/sec-ch-ua-full-version-list/index.md +++ b/files/zh-cn/web/http/headers/sec-ch-ua-full-version-list/index.md @@ -44,7 +44,7 @@ Sec-CH-UA-Full-Version-List: "";v="", ... - `` - : 与用户代理相关的品牌,如“Chromium”和“Google Chrome”。 - 这可能是一个故意不正确的品牌,如 `" Not A;Brand"` 或 `"(Not(A:Brand"`(实际值是预期随时间变化且不可预测的)。 + 这可能是一个故意不正确的品牌,如 `" Not A;Brand"` 或 `"(Not(A:Brand"`(实际值是预期随时间变化且不可预测的)。 - `` - : 完整的版本号,例如 98.0.4750.0。 diff --git a/files/zh-cn/web/http/headers/sec-fetch-dest/index.md b/files/zh-cn/web/http/headers/sec-fetch-dest/index.md index 415de91180af21..f19f830e68b58f 100644 --- a/files/zh-cn/web/http/headers/sec-fetch-dest/index.md +++ b/files/zh-cn/web/http/headers/sec-fetch-dest/index.md @@ -30,7 +30,7 @@ slug: Web/HTTP/Headers/Sec-Fetch-Dest ## 语法 - ``` +``` Sec-Fetch-Dest: audio Sec-Fetch-Dest: audioworklet Sec-Fetch-Dest: document diff --git a/files/zh-cn/web/http/headers/sec-fetch-mode/index.md b/files/zh-cn/web/http/headers/sec-fetch-mode/index.md index 9bb60f61023db8..ceeadf29abaef4 100644 --- a/files/zh-cn/web/http/headers/sec-fetch-mode/index.md +++ b/files/zh-cn/web/http/headers/sec-fetch-mode/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Sec-Fetch-Mode **`Sec-Fetch-Mode`** 获取元数据标头表明了一个请求的模式。 -| Header type | {{Glossary("Fetch Metadata Request Header")}} | -| ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | -| {{Glossary("Forbidden header name")}} | 只要包含前缀 `Sec-` 都属于应用程序禁止修改的 HTTP 消息头,用户代理保留全部对它们的控制权 | +| Header type | {{Glossary("Fetch Metadata Request Header")}} | +| ---------------------------------------------- | ---------------------------------------------------------------------------------------- | +| {{Glossary("Forbidden header name")}} | 只要包含前缀 `Sec-` 都属于应用程序禁止修改的 HTTP 消息头,用户代理保留全部对它们的控制权 | | {{Glossary("CORS-safelisted request header")}} | | ## 语法 diff --git a/files/zh-cn/web/http/headers/sec-fetch-site/index.md b/files/zh-cn/web/http/headers/sec-fetch-site/index.md index 0a738cf65a83f0..be04f4c3729b40 100644 --- a/files/zh-cn/web/http/headers/sec-fetch-site/index.md +++ b/files/zh-cn/web/http/headers/sec-fetch-site/index.md @@ -7,11 +7,11 @@ slug: Web/HTTP/Headers/Sec-Fetch-Site **`Sec-Fetch-Site`** 获取元数据标头表明了一个请求发起者的来源与目标资源来源之间的关系。 -| Header type | {{Glossary("Fetch Metadata Request Header")}} | -| ---------------------------------------------------------------- | ---------------------------------------------------------------------------------------- | -| {{Glossary("Forbidden header name")}} | 只要包含前缀 `Sec-` 都属于应用程序禁止修改的 HTTP 消息头,用户代理保留全部对它们的控制权 | +| Header type | {{Glossary("Fetch Metadata Request Header")}} | +| ----------------------------------------------- | ---------------------------------------------------------------------------------------- | +| {{Glossary("Forbidden header name")}} | 只要包含前缀 `Sec-` 都属于应用程序禁止修改的 HTTP 消息头,用户代理保留全部对它们的控制权 | | {{Glossary("CORS-safelisted response header")}} | | -| {{Glossary("CORS-safelisted request header")}} | | +| {{Glossary("CORS-safelisted request header")}} | | ## 语法 diff --git a/files/zh-cn/web/http/headers/sec-fetch-user/index.md b/files/zh-cn/web/http/headers/sec-fetch-user/index.md index 7194ffda6df501..a441c827f13ecb 100644 --- a/files/zh-cn/web/http/headers/sec-fetch-user/index.md +++ b/files/zh-cn/web/http/headers/sec-fetch-user/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Sec-Fetch-User **`Sec-Fetch-User`** 获取元数据标头表明了一个导航请求是否由用户激活触发。 -| Header type | {{Glossary("Fetch Metadata Request Header")}} | -| ------------------------------------------------------------ | ---------------------------------------------------------------------------------------- | -| {{Glossary("Forbidden header name")}} | 只要包含前缀 `Sec-` 都属于应用程序禁止修改的 HTTP 消息头,用户代理保留全部对它们的控制权 | +| Header type | {{Glossary("Fetch Metadata Request Header")}} | +| ---------------------------------------------- | ---------------------------------------------------------------------------------------- | +| {{Glossary("Forbidden header name")}} | 只要包含前缀 `Sec-` 都属于应用程序禁止修改的 HTTP 消息头,用户代理保留全部对它们的控制权 | | {{Glossary("CORS-safelisted request header")}} | | ## 语法 diff --git a/files/zh-cn/web/http/headers/server-timing/index.md b/files/zh-cn/web/http/headers/server-timing/index.md index 08b0bc6c571646..d5e33e1d4a8bd7 100644 --- a/files/zh-cn/web/http/headers/server-timing/index.md +++ b/files/zh-cn/web/http/headers/server-timing/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Server-Timing **`Server-Timing`** 标头传达在一个给定请求 - 响应周期中的一个或多个参数和描述。它用于在用户浏览器的开发工具或 {{domxref("PerformanceServerTiming")}} 接口中显示任何后端服务器定时参数(例如,数据库读/写、CPU 时间、文件系统访问等)。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/server/index.md b/files/zh-cn/web/http/headers/server/index.md index 1661aa03f8ee14..fcb428977319ac 100644 --- a/files/zh-cn/web/http/headers/server/index.md +++ b/files/zh-cn/web/http/headers/server/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Server 应该避免使用过长或者过于详细的描述作为 Server 的值,因为这有可能泄露服务器的内部实现细节,有利于攻击者找到或者探测已知的安全漏洞。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/set-cookie/index.md b/files/zh-cn/web/http/headers/set-cookie/index.md index 7ec7d94b1c9fa1..ec5b648b2356d1 100644 --- a/files/zh-cn/web/http/headers/set-cookie/index.md +++ b/files/zh-cn/web/http/headers/set-cookie/index.md @@ -65,6 +65,7 @@ Set-Cookie: =; Domain=; Secure; HttpOnl > **`__Host-` 前缀**:以 `__Host-` 为前缀的 cookie,必须与 `secure` 属性一同设置,必须应用于安全页面(即使用 HTTPS 访问的页面),也禁止设置 domain 属性(也就不会发送给子域),同时 path 属性的值必须为 `/`。 - `Expires=` {{optional_inline}} + - : cookie 的最长有效时间,形式为符合 HTTP-date 规范的时间戳。参见 {{HTTPHeader("Date")}} 可以获取详细信息。 如果没有设置这个属性,那么表示这是一个**会话期 cookie**。一个会话结束于客户端被关闭时,这意味着会话期 cookie 在彼时会被移除。 @@ -76,6 +77,7 @@ Set-Cookie: =; Domain=; Secure; HttpOnl - `Max-Age=` {{optional_inline}} - : 在 cookie 失效之前需要经过的秒数。秒数为 0 或 -1 将会使 cookie 直接过期。假如 `Expires` 和 `Max-Age` 属性均存在,那么 `Max-Age` 的优先级更高。 - `Domain=` {{optional_inline}} + - : 指定 cookie 可以送达的主机名。 假如没有指定,那么默认值为当前文档访问地址中的主机部分(但是不包含子域名)。 @@ -83,12 +85,16 @@ Set-Cookie: =; Domain=; Secure; HttpOnl 与之前的规范不同的是,域名(`.example.com`)之前的点号会被忽略。 多个主机/域名的值是*不*被允许的,但如果指定了一个域,则其子域也会被包含。 + - `Path=` {{optional_inline}} + - : 指定一个 URL 路径,这个路径*必须*出现在要请求的资源的路径中才可以发送 `Cookie` 标头。 字符 `/` 可以解释为文件目录分隔符,此目录的下级目录也满足匹配的条件(例如,如果 `path=/docs`,那么 + - `/docs`、`/docs/`、`/docs/Web/` 和 `/docs/Web/HTTP` 都满足匹配条件。 - `/`、`/docsets` 或者 `/fr/docs` 则不满足匹配条件。 + - `Secure` {{optional_inline}} - : 一个带有安全属性的 cookie 只有在请求使用 `https:` 协议(localhost 不受此限制)的时候才会被发送到服务器。以阻止[中间人](/zh-CN/docs/Glossary/MitM)攻击。 @@ -100,17 +106,21 @@ Set-Cookie: =; Domain=; Secure; HttpOnl - `HttpOnly` {{optional_inline}} - : 用于阻止 JavaScript 通过 {{domxref("Document.cookie")}} 属性访问 cookie。注意,设置了 `HttpOnly` 的 cookie 在 JavaScript 初始化的请求中仍然会被发送。例如,调用 {{domxref("XMLHttpRequest.send()")}} 或 {{domxref("fetch()")}}。其用于防范跨站脚本攻击({{Glossary("Cross-site_scripting", "XSS")}})。 - `SameSite=` {{optional_inline}} + - : 允许服务器设定一则 cookie 不随着跨站请求一起发送,这样可以在一定程度上防范跨站请求伪造攻击({{Glossary("CSRF")}})。 可选的属性值有: - `Strict` + - : 这意味浏览器仅对同一站点的请求发送 `cookie`,即请求来自设置 cookie 的站点。如果请求来自不同的域或协议(即使是相同域),则携带有 `SameSite=Strict` 属性的 cookie 将不会被发送。 - `Lax` + - : 这意味着 cookie 不会在跨站请求中被发送,如:加载图像或 frame 的请求。但 cookie 在用户从外部站点导航到源站时,cookie 也将被发送(例如,跟随一个链接)。这是 `SameSite` 属性未被设置时的默认行为。 - `None` + - : 这意味着浏览器会在跨站和同站请求中均发送 cookie。在设置这一属性值时,必须同时设置 `Secure` 属性,就像这样:`SameSite=None; Secure`。 > **备注:** 与 [SameSite Cookie](/zh-CN/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value) 相关的标准作了如下变动: diff --git a/files/zh-cn/web/http/headers/sourcemap/index.md b/files/zh-cn/web/http/headers/sourcemap/index.md index 9268e3c49a4a4f..fa6b98b7751d4f 100644 --- a/files/zh-cn/web/http/headers/sourcemap/index.md +++ b/files/zh-cn/web/http/headers/sourcemap/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/SourceMap **`SourceMap`** [HTTP](/zh-CN/docs/Web/HTTP) 响应头链接生成的代码到一个 [source map](/zh-CN/docs/Tools/Debugger/How_to/Use_a_source_map),使浏览器能够重建原始的资源然后显示在调试器里。 -| Header 类型 | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header 类型 | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/te/index.md b/files/zh-cn/web/http/headers/te/index.md index 45e8e19094a24c..9eb11cc880ae70 100644 --- a/files/zh-cn/web/http/headers/te/index.md +++ b/files/zh-cn/web/http/headers/te/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/TE 可以参考 {{HTTPHeader("Transfer-Encoding")}} 来获取更多关于传输编码的细节信息。值得注意的是,支持 HTTP/1.1 协议的接收方一定可以处理 `chunked` 传输编码请求,所以没有必要一定在 `TE` 首部指定“chunked”关键字。然而,如果客户端将要接收编码在 chunked 包体里面的"trailer"信息的时候,主动指定该头部将会非常有用。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/timing-allow-origin/index.md b/files/zh-cn/web/http/headers/timing-allow-origin/index.md index b56a8dd81068ef..7431954bc0971c 100644 --- a/files/zh-cn/web/http/headers/timing-allow-origin/index.md +++ b/files/zh-cn/web/http/headers/timing-allow-origin/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Timing-Allow-Origin 响应头 **`Timing-Allow-Origin`** 用于指定特定站点,以允许其访问[Resource Timing API](/zh-CN/docs/Web/API/Performance_API/Resource_timing)提供的相关信息,否则这些信息会由于跨源限制将被报告为零 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/tk/index.md b/files/zh-cn/web/http/headers/tk/index.md index 0650505dea0195..febfa61d4950b0 100644 --- a/files/zh-cn/web/http/headers/tk/index.md +++ b/files/zh-cn/web/http/headers/tk/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Tk **`Tk`** 响应首部显示了对相应请求的跟踪情况。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/trailer/index.md b/files/zh-cn/web/http/headers/trailer/index.md index 152a0178f3c480..89c7193c8fe711 100644 --- a/files/zh-cn/web/http/headers/trailer/index.md +++ b/files/zh-cn/web/http/headers/trailer/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/Trailer > **备注:** 请求首部 {{HTTPHeader("TE")}} 需要设置 trailers 来允许挂载字段。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 @@ -22,6 +22,7 @@ Trailer: header-names ## 指令 - `header-names` + - : 出现在分块信息挂载部分的消息首部。以下首部字段**不允许**出现: - 用于信息分帧的首部 (例如{{HTTPHeader("Transfer-Encoding")}} 和 {{HTTPHeader("Content-Length")}}), diff --git a/files/zh-cn/web/http/headers/transfer-encoding/index.md b/files/zh-cn/web/http/headers/transfer-encoding/index.md index 90731583b98c64..9c430165139aec 100644 --- a/files/zh-cn/web/http/headers/transfer-encoding/index.md +++ b/files/zh-cn/web/http/headers/transfer-encoding/index.md @@ -11,9 +11,9 @@ slug: Web/HTTP/Headers/Transfer-Encoding 当这个消息首部出现在 {{HTTPMethod("HEAD")}} 请求的响应中,而这样的响应没有消息体,那么它其实指的是应用在相应的 {{HTTPMethod("GET")}} 请求的应答的值。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | yes | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | yes | ## 语法 diff --git a/files/zh-cn/web/http/headers/upgrade-insecure-requests/index.md b/files/zh-cn/web/http/headers/upgrade-insecure-requests/index.md index 73dad4658b55b6..e534471aa778fc 100644 --- a/files/zh-cn/web/http/headers/upgrade-insecure-requests/index.md +++ b/files/zh-cn/web/http/headers/upgrade-insecure-requests/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/Upgrade-Insecure-Requests **`Upgrade-Insecure-Requests`** 是一个请求首部,用来向服务器端发送信号,表示客户端优先选择加密及带有身份验证的响应,并且它可以成功处理 {{CSP("upgrade-insecure-requests")}} [CSP](/zh-CN/docs/Web/Security/CSP) 指令。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/user-agent/firefox/index.md b/files/zh-cn/web/http/headers/user-agent/firefox/index.md index a1d136998f712f..c45b8bf669f956 100644 --- a/files/zh-cn/web/http/headers/user-agent/firefox/index.md +++ b/files/zh-cn/web/http/headers/user-agent/firefox/index.md @@ -19,7 +19,7 @@ Firefox 的 User Agent(用户代理)值可被拆分为以下四个部分: - **_Gecko/geckotrail_** 标明浏览器基于 Gecko。 - 在桌面端,_**geckotrail**_ 的值恒为"20100101"。 - _**Firefox/firefoxversion**_ 标明浏览器是 Firefox,并提供了版本号(如"_17.0"_)。 -- 自从移动版 Firefox 10 开始,***geckotrail***与**_firefoxversion_**保持一致。 +- 自从移动版 Firefox 10 开始,**_geckotrail_**与**_firefoxversion_**保持一致。 > **备注:** (如果你必须检测浏览器引擎,而不是去做特征检测的话)推荐使用"_Gecko_"与"_rv:_"字符串来检测基于 Gecko 的浏览器。因为一些浏览器的 UA 中也包含有"_like Gecko_"字段。 diff --git a/files/zh-cn/web/http/headers/user-agent/index.md b/files/zh-cn/web/http/headers/user-agent/index.md index 2a089b51733146..fd0eeac0c8617e 100644 --- a/files/zh-cn/web/http/headers/user-agent/index.md +++ b/files/zh-cn/web/http/headers/user-agent/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/User-Agent > **备注:** 请阅读[使用用户代理字段进行浏览器检测](/zh-CN/docs/Web/HTTP/Browser_detection_using_the_user_agent)来了解为什么为不同的浏览器提供不同的页面或者服务通常不是一个好主意。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -40,8 +40,8 @@ User-Agent: Mozilla/ () ( [] ## 指令 - \ + - : 三位数字警告码。第一位数字表示 Warning 信息在验证之后是否需要从已存储的响应中删除。 - `1xx` 警告码描述了关于当前响应的新鲜度或者验证状态的警告信息,并且将会在验证之后被缓存服务器删除。 - `2xx` 警告码描述了验证之后不会被修复的某些展现内容方面的警告信息,并且在验证之后不会被缓存服务器删除。 + - \ - : 添加到 Warning 首部的服务器或者软件的名称或者伪名称(当代理不可知的时候可以用 "-" 代替)。 - \ @@ -37,15 +39,15 @@ Warning: [] [由 iana.org 维护的 HTTP 警告码登记表](http://www.iana.org/assignments/http-warn-codes/http-warn-codes.xhtml)规定了警告码的命名空间。 -| 码值 | 文字描述 | 详细说明 | -| ---- | ---------------------- | -------------------------------------------------------------------------------------------------- | -| 110 | Response is Stale | 由缓存服务器提供的响应已过期(设置的失效时间已过)。 | -| 111 | Revalidation Failed | 由于无法访问服务器,响应验证失败。 | -| 112 | Disconnected Operation | 缓存服务器断开连接。 | -| 113 | Heuristic Expiration | 如果缓存服务器采用启发式方法,将缓存的有效时间设定为 24 小时,而在该响应的年龄超过 24 小时时发送。 | -| 199 | Miscellaneous Warning | 任意的、未明确指定的警告信息。 | -| 214 | Transformation Applied | 由代理服务器添加,如果它对返回的展现内容进行了任何转换,比如改变了内容编码、媒体类型等。 | -| 299 | Miscellaneous Persistent Warning | 与 199 类似,只不过指代的是持久化警告。 | +| 码值 | 文字描述 | 详细说明 | +| ---- | -------------------------------- | -------------------------------------------------------------------------------------------------- | +| 110 | Response is Stale | 由缓存服务器提供的响应已过期(设置的失效时间已过)。 | +| 111 | Revalidation Failed | 由于无法访问服务器,响应验证失败。 | +| 112 | Disconnected Operation | 缓存服务器断开连接。 | +| 113 | Heuristic Expiration | 如果缓存服务器采用启发式方法,将缓存的有效时间设定为 24 小时,而在该响应的年龄超过 24 小时时发送。 | +| 199 | Miscellaneous Warning | 任意的、未明确指定的警告信息。 | +| 214 | Transformation Applied | 由代理服务器添加,如果它对返回的展现内容进行了任何转换,比如改变了内容编码、媒体类型等。 | +| 299 | Miscellaneous Persistent Warning | 与 199 类似,只不过指代的是持久化警告。 | ## 示例 diff --git a/files/zh-cn/web/http/headers/x-content-type-options/index.md b/files/zh-cn/web/http/headers/x-content-type-options/index.md index 311533088d3052..d65c79ee82f271 100644 --- a/files/zh-cn/web/http/headers/x-content-type-options/index.md +++ b/files/zh-cn/web/http/headers/x-content-type-options/index.md @@ -13,9 +13,9 @@ slug: Web/HTTP/Headers/X-Content-Type-Options 注意:`nosniff` 只应用于 "`script`" 和 "`style`" 两种类型。事实证明,将其应用于图片类型的文件会导致[与现有的站点冲突](https://github.com/whatwg/fetch/issues/395)。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -26,6 +26,7 @@ X-Content-Type-Options: nosniff ## 指令 - `nosniff` + - : 下面两种情况的请求将被阻止: - 请求类型是"`style`" 但是 MIME 类型不是 "`text/css`", diff --git a/files/zh-cn/web/http/headers/x-dns-prefetch-control/index.md b/files/zh-cn/web/http/headers/x-dns-prefetch-control/index.md index b73b0a86687017..fbc4b8d33815ec 100644 --- a/files/zh-cn/web/http/headers/x-dns-prefetch-control/index.md +++ b/files/zh-cn/web/http/headers/x-dns-prefetch-control/index.md @@ -10,9 +10,9 @@ original_slug: Controlling_DNS_prefetching 因为预读取会在后台执行,所以 {{glossary("DNS")}} 很可能在链接对应的东西出现之前就已经解析完毕。这能够减少用户点击链接时的延迟。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 @@ -59,7 +59,7 @@ DNS 请求需要的带宽非常小,但是延迟却有点高,这一点在手 你可以通过使用 [`rel`](/zh-CN/docs/Web/HTML/Element/link#rel) 属性值为 [link type](/zh-CN/docs/Web/HTML/Link_types) 中的 `dns-prefetch` 的 {{ HTMLElement("link") }} 标签来对特定域名进行预读取: ```html - + ``` 在这个例子中,Firefox 将预解析域名"[www.spreadfirefox.com](http://www.spreadfirefox.com)"。 @@ -67,7 +67,7 @@ DNS 请求需要的带宽非常小,但是延迟却有点高,这一点在手 而且,{{ HTMLElement("link") }} 元素也可以使用不完整的 URL 的主机名来标记预解析,但这些主机名前必需要有双斜线: ```html - + ``` 强制对域名进行预读取在一些情况下很有用,比如,在网站的主页上,强制在整个网站上频繁引用的域名的预解析,即使它们不在主页本身上使用。即使主页的性能可能不受影响,这将提高整体站点性能。 diff --git a/files/zh-cn/web/http/headers/x-forwarded-host/index.md b/files/zh-cn/web/http/headers/x-forwarded-host/index.md index df37d2107ef1f3..5914e0c6bbd9a1 100644 --- a/files/zh-cn/web/http/headers/x-forwarded-host/index.md +++ b/files/zh-cn/web/http/headers/x-forwarded-host/index.md @@ -13,9 +13,9 @@ The **`X-Forwarded-Host`** (XFH) 是一个事实上的标准首部,用来确 HTTP 协议中的 {{HTTPHeader("Forwarded")}} 是这个消息首部的标准化版本。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/x-forwarded-proto/index.md b/files/zh-cn/web/http/headers/x-forwarded-proto/index.md index d23717ae6fdeca..7cd54731c0e020 100644 --- a/files/zh-cn/web/http/headers/x-forwarded-proto/index.md +++ b/files/zh-cn/web/http/headers/x-forwarded-proto/index.md @@ -9,9 +9,9 @@ slug: Web/HTTP/Headers/X-Forwarded-Proto HTTP 协议中的 {{HTTPHeader("Forwarded")}} 是这个消息首部的标准化版本。 -| Header type | {{Glossary("Request header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Request header")}} | +| ------------------------------------- | ------------------------------ | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/headers/x-frame-options/index.md b/files/zh-cn/web/http/headers/x-frame-options/index.md index 5eb0ce69f09975..3164e72e1828b8 100644 --- a/files/zh-cn/web/http/headers/x-frame-options/index.md +++ b/files/zh-cn/web/http/headers/x-frame-options/index.md @@ -110,16 +110,16 @@ http-response set-header X-Frame-Options SAMEORIGIN 要配置 Express 以发送 `X-Frame-Options` 响应头,你可以使用借助了 [frameguard](https://helmetjs.github.io/docs/frameguard/) 的 [helmet](https://helmetjs.github.io/) 来设置首部。在你的服务器配置里面添加: ```js -const helmet = require('helmet'); +const helmet = require("helmet"); const app = express(); -app.use(helmet.frameguard({ action: 'SAMEORIGIN' })); +app.use(helmet.frameguard({ action: "SAMEORIGIN" })); ``` 或者,你也可以直接用 frameguard: ```js -const frameguard = require('frameguard') -app.use(frameguard({ action: 'SAMEORIGIN' })) +const frameguard = require("frameguard"); +app.use(frameguard({ action: "SAMEORIGIN" })); ``` ## 规范 diff --git a/files/zh-cn/web/http/headers/x-xss-protection/index.md b/files/zh-cn/web/http/headers/x-xss-protection/index.md index bf4691c658be79..25c4f58ff9595b 100644 --- a/files/zh-cn/web/http/headers/x-xss-protection/index.md +++ b/files/zh-cn/web/http/headers/x-xss-protection/index.md @@ -7,9 +7,9 @@ slug: Web/HTTP/Headers/X-XSS-Protection HTTP **`X-XSS-Protection`** 响应头是 Internet Explorer,Chrome 和 Safari 的一个特性,当检测到跨站脚本攻击 ({{Glossary("XSS")}}) 时,浏览器将停止加载页面。若网站设置了良好的 {{HTTPHeader("Content-Security-Policy")}} 来禁用内联 JavaScript (`'unsafe-inline'`),现代浏览器不太需要这些保护,但其仍然可以为尚不支持 {{Glossary("CSP")}} 的旧版浏览器的用户提供保护。 -| Header type | {{Glossary("Response header")}} | -| ------------------------------------------------ | ---------------------------------------- | -| {{Glossary("Forbidden header name")}} | no | +| Header type | {{Glossary("Response header")}} | +| ------------------------------------- | ------------------------------- | +| {{Glossary("Forbidden header name")}} | no | ## 语法 diff --git a/files/zh-cn/web/http/messages/index.md b/files/zh-cn/web/http/messages/index.md index 26be541682a0bf..b5d086b70e0ec5 100644 --- a/files/zh-cn/web/http/messages/index.md +++ b/files/zh-cn/web/http/messages/index.md @@ -5,7 +5,7 @@ slug: Web/HTTP/Messages {{HTTPSidebar}} -HTTP 消息是服务器和客户端之间交换数据的方式。有两种类型的消息:*请求*(request)——由客户端发送用来触发一个服务器上的动作;*响应*(response)——来自服务器的应答。 +HTTP 消息是服务器和客户端之间交换数据的方式。有两种类型的消息:_请求_(request)——由客户端发送用来触发一个服务器上的动作;_响应_(response)——来自服务器的应答。 HTTP 消息由采用 ASCII 编码的多行文本构成。在 HTTP/1.1 及早期版本中,这些消息通过连接公开地发送。在 HTTP/2 中,为了优化和性能方面的改进,曾经可人工阅读的消息被分到多个 HTTP 帧中。 @@ -30,21 +30,21 @@ HTTP 请求和响应具有相似的结构,由以下部分组成: ### 起始行 -HTTP 请求是由客户端发出的消息,用来使服务器执行动作。*起始行*(start-line)包含三个元素: +HTTP 请求是由客户端发出的消息,用来使服务器执行动作。_起始行_(start-line)包含三个元素: 1. 一个 _[HTTP 方法](/zh-CN/docs/Web/HTTP/Methods)_,一个动词(像 {{HTTPMethod("GET")}}、{{HTTPMethod("PUT")}} 或者 {{HTTPMethod("POST")}})或者一个名词(像 {{HTTPMethod("HEAD")}} 或者 {{HTTPMethod("OPTIONS")}}),描述要执行的动作。例如,`GET` 表示要获取资源,`POST` 表示向服务器推送数据(创建或修改资源,或者产生要返回的临时文件)。 -2. *请求目标*(request target),通常是一个 {{glossary("URL")}},或者是协议、端口和域名的绝对路径,通常以请求的环境为特征。请求的格式因不同的 HTTP 方法而异。它可以是: +2. _请求目标_(request target),通常是一个 {{glossary("URL")}},或者是协议、端口和域名的绝对路径,通常以请求的环境为特征。请求的格式因不同的 HTTP 方法而异。它可以是: - - 一个绝对路径,末尾跟上一个 `'?'` 和查询字符串。这是最常见的形式,称为*原始形式*(origin form),被 `GET`、`POST`、`HEAD` 和 `OPTIONS` 方法所使用。 - - `POST / HTTP/1.1` - - `GET /background.png HTTP/1.0` - - `HEAD /test.html?query=alibaba HTTP/1.1` - - `OPTIONS /anypage.html HTTP/1.0` - - 一个完整的 URL,被称为*绝对形式*(absolute form),主要在使用 `GET` 方法连接到代理时使用。`GET http://developer.mozilla.org/zh-CN/docs/Web/HTTP/Messages HTTP/1.1` - - 由域名和可选端口(以 `':'` 为前缀)组成的 URL 的 authority 部分,称为 _authority form_。仅在使用 `CONNECT` 建立 HTTP 隧道时才使用。`CONNECT developer.mozilla.org:80 HTTP/1.1` - - *星号形式*(asterisk form),一个简单的星号(`'*'`),配合 `OPTIONS` 方法使用,代表整个服务器。`OPTIONS * HTTP/1.1` + - 一个绝对路径,末尾跟上一个 `'?'` 和查询字符串。这是最常见的形式,称为*原始形式*(origin form),被 `GET`、`POST`、`HEAD` 和 `OPTIONS` 方法所使用。 + - `POST / HTTP/1.1` + - `GET /background.png HTTP/1.0` + - `HEAD /test.html?query=alibaba HTTP/1.1` + - `OPTIONS /anypage.html HTTP/1.0` + - 一个完整的 URL,被称为*绝对形式*(absolute form),主要在使用 `GET` 方法连接到代理时使用。`GET http://developer.mozilla.org/zh-CN/docs/Web/HTTP/Messages HTTP/1.1` + - 由域名和可选端口(以 `':'` 为前缀)组成的 URL 的 authority 部分,称为 _authority form_。仅在使用 `CONNECT` 建立 HTTP 隧道时才使用。`CONNECT developer.mozilla.org:80 HTTP/1.1` + - _星号形式_(asterisk form),一个简单的星号(`'*'`),配合 `OPTIONS` 方法使用,代表整个服务器。`OPTIONS * HTTP/1.1` -3. *HTTP 版本*(HTTP version),定义了剩余消息的结构,作为对期望的响应版本的指示符。 +3. _HTTP 版本_(HTTP version),定义了剩余消息的结构,作为对期望的响应版本的指示符。 ### 标头(Header) @@ -73,9 +73,9 @@ HTTP 请求是由客户端发出的消息,用来使服务器执行动作。* HTTP 响应的起始行被称作*状态行*(status line),包含以下信息: -1. *协议版本*,通常为 `HTTP/1.1`。 -2. *状态码*(status code),表明请求是成功或失败。常见的状态码是 {{HTTPStatus("200")}}、{{HTTPStatus("404")}} 或 {{HTTPStatus("302")}}。 -3. *状态文本*(status text)。一个简短的,纯粹的信息,通过状态码的文本描述,帮助人们理解该 HTTP 消息。 +1. _协议版本_,通常为 `HTTP/1.1`。 +2. _状态码_(status code),表明请求是成功或失败。常见的状态码是 {{HTTPStatus("200")}}、{{HTTPStatus("404")}} 或 {{HTTPStatus("302")}}。 +3. _状态文本_(status text)。一个简短的,纯粹的信息,通过状态码的文本描述,帮助人们理解该 HTTP 消息。 一个典型的状态行看起来像这样:`HTTP/1.1 404 Not Found`。 diff --git a/files/zh-cn/web/http/overview/index.md b/files/zh-cn/web/http/overview/index.md index ecc4cbf10eec22..a14e7428420595 100644 --- a/files/zh-cn/web/http/overview/index.md +++ b/files/zh-cn/web/http/overview/index.md @@ -95,26 +95,26 @@ HTTP 是无状态的:在同一个连接中,两个执行成功的请求之间 1. 打开一个 TCP 连接:TCP 连接被用来发送一条或多条请求,以及接受响应消息。客户端可能打开一条新的连接,或重用一个已经存在的连接,或者也可能开几个新的 TCP 连接连向服务端。 2. 发送一个 HTTP 报文:HTTP 报文(在 HTTP/2 之前)是语义可读的。在 HTTP/2 中,这些简单的消息被封装在了帧中,这使得报文不能被直接读取,但是原理仍是相同的。 - ```http - GET / HTTP/1.1 - Host: developer.mozilla.org - Accept-Language: zh - ``` + ```http + GET / HTTP/1.1 + Host: developer.mozilla.org + Accept-Language: zh + ``` 3. 读取服务端返回的报文信息: - ```http - HTTP/1.1 200 OK - Date: Sat, 09 Oct 2010 14:28:02 GMT - Server: Apache - Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT - ETag: "51142bc1-7449-479b075b2891b" - Accept-Ranges: bytes - Content-Length: 29769 - Content-Type: text/html - - …(此处是所请求网页的 29769 字节) - ``` + ```http + HTTP/1.1 200 OK + Date: Sat, 09 Oct 2010 14:28:02 GMT + Server: Apache + Last-Modified: Tue, 01 Dec 2009 20:18:22 GMT + ETag: "51142bc1-7449-479b075b2891b" + Accept-Ranges: bytes + Content-Length: 29769 + Content-Type: text/html + + …(此处是所请求网页的 29769 字节) + ``` 4. 关闭连接或者为后续请求重用连接。 diff --git a/files/zh-cn/web/http/protocol_upgrade_mechanism/index.md b/files/zh-cn/web/http/protocol_upgrade_mechanism/index.md index 4f1c9e783bd004..720b2879f0e4c4 100644 --- a/files/zh-cn/web/http/protocol_upgrade_mechanism/index.md +++ b/files/zh-cn/web/http/protocol_upgrade_mechanism/index.md @@ -44,7 +44,7 @@ webSocket = new WebSocket("ws://destination.server.ext", "optionalProtocol"); {{domxref("WebSocket.WebSocket", "WebSocket()")}} 构造函数已经自动完成了发送初始 HTTP/1.1 连接的所有工作,然后为你处理握手及升级过程。 ->**备注:** 你也可以用 `"wss://"` URL 方式来打开安全的 WebSocket 连接。 +> **备注:** 你也可以用 `"wss://"` URL 方式来打开安全的 WebSocket 连接。 如果想要自己重头实现 WebSocket 连接,就必须要处理握手和升级过程。在创建初始 HTTP/1.1 会话之后,你需要发送另一个 HTTP 标准请求来请求升级,但在标头中要带上 {{HTTPHeader("Upgrade")}} 和 {{HTTPHeader("Connection")}},也就是: diff --git a/files/zh-cn/web/http/proxy_servers_and_tunneling/index.md b/files/zh-cn/web/http/proxy_servers_and_tunneling/index.md index cebf5c60559994..555aa3a0fd0814 100644 --- a/files/zh-cn/web/http/proxy_servers_and_tunneling/index.md +++ b/files/zh-cn/web/http/proxy_servers_and_tunneling/index.md @@ -74,10 +74,8 @@ The file consists of a function called `FindProxyForURL`. The example below will ```js function FindProxyForURL(url, host) { - if (isResolvable(host)) - return "DIRECT"; - else - return "PROXY proxy.mydomain.com:8080"; + if (isResolvable(host)) return "DIRECT"; + else return "PROXY proxy.mydomain.com:8080"; } ``` diff --git a/files/zh-cn/web/http/proxy_servers_and_tunneling/proxy_auto-configuration_pac_file/index.md b/files/zh-cn/web/http/proxy_servers_and_tunneling/proxy_auto-configuration_pac_file/index.md index 8c008601012b8e..19acb077e755af 100644 --- a/files/zh-cn/web/http/proxy_servers_and_tunneling/proxy_auto-configuration_pac_file/index.md +++ b/files/zh-cn/web/http/proxy_servers_and_tunneling/proxy_auto-configuration_pac_file/index.md @@ -155,8 +155,8 @@ isPlainHostName(host) #### 例子 ```js -isPlainHostName("www.mozilla.org") // false -isPlainHostName("www") // true +isPlainHostName("www.mozilla.org"); // false +isPlainHostName("www"); // true ``` ### dnsDomainIs() @@ -181,8 +181,8 @@ dnsDomainIs(host, domain) #### 例子 ```js -dnsDomainIs("www.mozilla.org", ".mozilla.org") // true -dnsDomainIs("www", ".mozilla.org") // false +dnsDomainIs("www.mozilla.org", ".mozilla.org"); // true +dnsDomainIs("www", ".mozilla.org"); // false ``` ### localHostOrDomainIs() @@ -207,10 +207,10 @@ localHostOrDomainIs(host, hostdom) #### 例子 ```js -localHostOrDomainIs("www.mozilla.org" , "www.mozilla.org") // true (exact match) -localHostOrDomainIs("www" , "www.mozilla.org") // true (hostname match, domain not specified) -localHostOrDomainIs("www.google.com" , "www.mozilla.org") // false (domain name mismatch) -localHostOrDomainIs("home.mozilla.org", "www.mozilla.org") // false (hostname mismatch) +localHostOrDomainIs("www.mozilla.org", "www.mozilla.org"); // true (exact match) +localHostOrDomainIs("www", "www.mozilla.org"); // true (hostname match, domain not specified) +localHostOrDomainIs("www.google.com", "www.mozilla.org"); // false (domain name mismatch) +localHostOrDomainIs("home.mozilla.org", "www.mozilla.org"); // false (hostname mismatch) ``` ### isResolvable() @@ -231,7 +231,7 @@ isResolvable(host) #### 例子: ```js -isResolvable("www.mozilla.org") // true +isResolvable("www.mozilla.org"); // true ``` ### isInNet() @@ -258,9 +258,11 @@ Pattern and mask specification is done the same way as for SOCKS configuration. #### 例子: ```js -function alert_eval(str) { alert(str + ' is ' + eval(str)) } +function alert_eval(str) { + alert(str + " is " + eval(str)); +} function FindProxyForURL(url, host) { - alert_eval('isInNet(host, "63.245.213.24", "255.255.255.255")') + alert_eval('isInNet(host, "63.245.213.24", "255.255.255.255")'); // "PAC-alert: isInNet(host, "63.245.213.24", "255.255.255.255") is true" } ``` @@ -324,7 +326,7 @@ myIpAddress() #### 例子 ```js -myIpAddress() //returns the string "127.0.1.1" if you were running Firefox on that localhost +myIpAddress(); //returns the string "127.0.1.1" if you were running Firefox on that localhost ``` ### dnsDomainLevels() @@ -345,8 +347,8 @@ dnsDomainLevels(host) #### 例子: ```js -dnsDomainLevels("www"); // 0 -dnsDomainLevels("mozilla.org"); // 1 +dnsDomainLevels("www"); // 0 +dnsDomainLevels("mozilla.org"); // 1 dnsDomainLevels("www.mozilla.org"); // 2 ``` @@ -372,7 +374,7 @@ shExpMatch(str, shexp) #### 例子 ```js -shExpMatch("http://home.netscape.com/people/ari/index.html" , "*/ari/*"); // returns true +shExpMatch("http://home.netscape.com/people/ari/index.html", "*/ari/*"); // returns true shExpMatch("http://home.netscape.com/people/montulli/index.html", "*/ari/*"); // returns false ``` @@ -389,6 +391,7 @@ weekdayRange(wd1, wd2, [gmt]) #### 参数 - wd1 和 wd2 + - : One of the ordered weekday strings: ```plain @@ -410,11 +413,11 @@ If both **wd1** and **wd1** are defined, the condition is true if the current we #### 例子 ```js -weekdayRange("MON", "FRI"); // returns true Monday through Friday (local timezone) +weekdayRange("MON", "FRI"); // returns true Monday through Friday (local timezone) weekdayRange("MON", "FRI", "GMT"); // returns true Monday through Friday (GMT timezone) -weekdayRange("SAT"); // returns true on Saturdays local time -weekdayRange("SAT", "GMT"); // returns true on Saturdays GMT time -weekdayRange("FRI", "MON"); // returns true Friday and Monday only (note, order does matter!) +weekdayRange("SAT"); // returns true on Saturdays local time +weekdayRange("SAT", "GMT"); // returns true on Saturdays GMT time +weekdayRange("FRI", "MON"); // returns true Friday and Monday only (note, order does matter!) ``` ### dateRange() @@ -461,10 +464,10 @@ If only a single value is specified (from each category: day, month, year), the #### 例子 ```js -dateRange(1); // returns true on the first day of each month, local timezone -dateRange(1, "GMT") // returns true on the first day of each month, GMT timezone -dateRange(1, 15); // returns true on the first half of each month -dateRange(24, "DEC"); // returns true on 24th of December each year +dateRange(1); // returns true on the first day of each month, local timezone +dateRange(1, "GMT"); // returns true on the first day of each month, GMT timezone +dateRange(1, 15); // returns true on the first half of each month +dateRange(24, "DEC"); // returns true on 24th of December each year dateRange("JAN", "MAR"); // returns true on the first quarter of the year dateRange(1, "JUN", 15, "AUG"); @@ -514,11 +517,11 @@ If only a single value is specified (from each category: hour, minute, second), #### 例子 ```js -timerange(12); // returns true from noon to 1pm -timerange(12, 13); // returns true from noon to 1pm -timerange(12, "GMT"); // returns true from noon to 1pm, in GMT timezone -timerange(9, 17); // returns true from 9am to 5pm -timerange(8, 30, 17, 00); // returns true from 8:30am to 5:00pm +timerange(12); // returns true from noon to 1pm +timerange(12, 13); // returns true from noon to 1pm +timerange(12, "GMT"); // returns true from noon to 1pm, in GMT timezone +timerange(9, 17); // returns true from 9am to 5pm +timerange(8, 30, 17, 00); // returns true from 8:30am to 5:00pm timerange(0, 0, 0, 0, 0, 30); // returns true between midnight and 30 seconds past midnight ``` @@ -555,7 +558,7 @@ function FindProxyForURL(url, host) { !localHostOrDomainIs(host, "www.mozilla.org") && !localHostOrDoaminIs(host, "merchant.mozilla.org") ) { - return "DIRECT"; + return "DIRECT"; } else { return "PROXY w3proxy.mozilla.org:8080; DIRECT"; } @@ -574,10 +577,8 @@ function FindProxyForURL(url, host) { ```js function FindProxyForURL(url, host) { - if (isResolvable(host)) - return "DIRECT"; - else - return "PROXY proxy.mydomain.com:8080"; + if (isResolvable(host)) return "DIRECT"; + else return "PROXY proxy.mydomain.com:8080"; } ``` @@ -605,10 +606,8 @@ function FindProxyForURL(url, host) { ```js function FindProxyForURL(url, host) { - if (isInNet(host, "198.95.0.0", "255.255.0.0")) - return "DIRECT"; - else - return "PROXY proxy.mydomain.com:8080"; + if (isInNet(host, "198.95.0.0", "255.255.0.0")) return "DIRECT"; + else return "PROXY proxy.mydomain.com:8080"; } ``` @@ -645,21 +644,20 @@ All local accesses are desired to be direct. All proxy servers run on the port 8 ```js function FindProxyForURL(url, host) { - if (isPlainHostName(host) || dnsDomainIs(host, ".mydomain.com")) return "DIRECT"; - else if (shExpMatch(host, "*.com")) - return "PROXY proxy1.mydomain.com:8080; " + - "PROXY proxy4.mydomain.com:8080"; - + return ( + "PROXY proxy1.mydomain.com:8080; " + "PROXY proxy4.mydomain.com:8080" + ); else if (shExpMatch(host, "*.edu")) - return "PROXY proxy2.mydomain.com:8080; " + - "PROXY proxy4.mydomain.com:8080"; - + return ( + "PROXY proxy2.mydomain.com:8080; " + "PROXY proxy4.mydomain.com:8080" + ); else - return "PROXY proxy3.mydomain.com:8080; " + - "PROXY proxy4.mydomain.com:8080"; + return ( + "PROXY proxy3.mydomain.com:8080; " + "PROXY proxy4.mydomain.com:8080" + ); } ``` @@ -694,11 +692,10 @@ function FindProxyForURL(url, host) { > > ```js > // ... -> if (shExpMatch(url, "http:\*")) { -> return "PROXY http-proxy.mydomain.com:8080"; +> if (shExpMatch(url, "http:*")) { +> return "PROXY http-proxy.mydomain.com:8080"; > } > // ... -> > ``` > **备注:** 自动配置脚本也可以在服务端动态生成。这在某些情况下比较有用,例如根据客户端地址指定不同的代理服务器。`isInNet()`, `isResolvable()` 和 `dnsResolve()` 应该谨慎使用,这些函数会进行 DNS 查询。其他函数则大都是字符处理函数,不需要 DNS。如果通过代理连接,代理本身也会进行一次 DNS 查询,这产生了额外的 DNS 请求。并且绝大多数情况下,不需要这些函数来实现特定的功能。 diff --git a/files/zh-cn/web/http/redirections/index.md b/files/zh-cn/web/http/redirections/index.md index c9265f16689557..b4aac20acf41c9 100644 --- a/files/zh-cn/web/http/redirections/index.md +++ b/files/zh-cn/web/http/redirections/index.md @@ -5,7 +5,7 @@ slug: Web/HTTP/Redirections {{HTTPSidebar}} -**URL 重定向**(也称为 *URL 转发*)是一种为页面、表单或者整个 Web 站点/应用提供多个 URL 地址的技术。HTTP 对此操作有一种特殊类型的响应,称为 ***HTTP 重定向***(HTTP redirect)。 +**URL 重定向**(也称为 _URL 转发_)是一种为页面、表单或者整个 Web 站点/应用提供多个 URL 地址的技术。HTTP 对此操作有一种特殊类型的响应,称为 **_HTTP 重定向_**(HTTP redirect)。 重定向可实现许多目标: diff --git a/files/zh-cn/web/http/resources_and_specifications/index.md b/files/zh-cn/web/http/resources_and_specifications/index.md index 8cb482bbb17ce5..3eec52d0455bea 100644 --- a/files/zh-cn/web/http/resources_and_specifications/index.md +++ b/files/zh-cn/web/http/resources_and_specifications/index.md @@ -7,52 +7,52 @@ slug: Web/HTTP/Resources_and_specifications HTTP 协议于 20 世纪 90 年代初期被规范化。得益于其扩展性,该规范至今又添加了大量的补充内容。这些增补规范文档散落在网络的不同位置。本文列出了与 HTTP 协议相关的规范文档。 -| 规范 | 标题 | 状态 | -| ------------------------------------------------------------------------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | -| {{rfc(7230)}} | 超文本传输协议(HTTP/1.1):报文格式与路由 | 建议标准 | -| {{rfc(7231)}} | 超文本传输协议(HTTP/1.1):语义与内容 | 建议标准 | -| {{rfc(7232)}} | 超文本传输协议(HTTP/1.1):条件请求 | 建议标准 | -| {{rfc(7233)}} | 超文本传输协议(HTTP/1.1):范围请求 | 建议标准 | -| {{rfc(7234)}} | 超文本传输协议(HTTP/1.1):缓存 | 建议标准 | -| {{rfc(5861)}} | 针对陈旧内容的 HTTP 缓存控制扩展 | 信息参考 | -| {{rfc(8246)}} | 不可变的 HTTP 响应 | 建议标准 | -| {{rfc(7235)}} | 超文本传输协议(HTTP/1.1):认证 | 建议标准 | -| {{rfc(6265)}} | HTTP 状态控制机制:定义 Cookies | 建议标准 | -| [Draft spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-prefixes-00) | Cookie 前缀 | IETF 草案 | -| [Draft spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) | 同源 Cookies | IETF 草案 | -| [Draft spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone-01) | 反对非安全的源站对安全 cookies 进行修改 | IETF 草案 | -| {{rfc(2145)}} | HTTP 版本号的使用与解释 | 信息参考 | -| {{rfc(6585)}} | 扩展的 HTTP 状态码 | 建议标准 | -| {{rfc(7538)}} | 超文本传输协议的 308 状态码(永久重定向) | 建议标准 | -| {{rfc(7725)}} | 用于报告法律限制的 HTTP 状态码 | 即将成为标准 | -| {{rfc(2397)}} | URL 的“data“方案 | 建议标准 | -| {{rfc(3986)}} | 统一资源定位符(URI):通用语法 | 因特网标准 | -| {{rfc(5988)}} | 网络链接 _定义了 {{HTTPHeader("Link")}} 首部字段_ | 建议标准 | -| [Experimental spec](https://tools.ietf.org/id/draft-thomson-hybi-http-timeout-01.html) | 超文本传输协议(HTTP))的 Keep-Alive 首部字段 | 信息参考(已过期) | -| [Draft spec](http://httpwg.org/http-extensions/client-hints.html) | HTTP 客户端提示 | IETF 草案 | -| {{rfc(7578)}} | 从表单中返回数据:multipart/form-data | 建议标准 | -| {{rfc(6266)}} | 在超文本传输协议(HTTP)中使用 Content-Disposition 首部字段 | 建议标准 | -| {{rfc(2183)}} | Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field _Only a subset of syntax of the {{HTTPHeader("Content-Disposition")}} header can be used in the context of HTTP messages._ | 建议标准 | -| {{rfc(7239)}} | 前向 HTTP 扩展 | 建议标准 | -| {{rfc(6455)}} | WebSocket 协议 | 建议标准 | -| {{rfc(5246)}} | 安全传输层(TLS)协议 1.2 版本 _该规范已经被后续 RFC 文档进行了修改,不过这些修改不会对 HTTP 协议本身产生效力。_ | 建议标准 | -| [Draft spec]() | 安全传输层(TLS)协议 1.3 版本 _该版本就绪之后,将取代之前的 1.2 版本_ | IETF 草案 | -| {{rfc(2817)}} | 在 HTTP/1.1 中进行 TLS 升级 | 建议标准 | -| {{rfc(7540)}} | 超文本传输协议版本 2(HTTP/2) | 建议标准 | -| {{rfc(7541)}} | HPACK:对 HTTP/2 的首部进行压缩 | 即将成为标准 | -| {{rfc(7838)}} | HTTP 替代服务 | 即将成为标准 | -| {{rfc(7301)}} | 对安全传输层(TLS)的应用层协议的协商的扩展 _用于在传输 HTTP/2 报文时进行协商,以减少一对额外的请求/响应_ | 建议标准 | -| {{rfc(6454)}} | 网络源站的概念 | 建议标准 | -| [Fetch](https://fetch.spec.whatwg.org/#cors-protocol) | 跨源资源共享 | 实时标准 | -| {{rfc(7034)}} | HTTP 首部字段 X-Frame-Options | 信息参考 | -| {{rfc(6797)}} | HTTP 严格安全传输(HSTS) | 建议标准 | -| [Upgrade Insecure Requests](https://w3c.github.io/webappsec-upgrade-insecure-requests/) | 对不安全的请求进行升级 | 推荐候选 | -| [Content Security Policy 1.0](https://www.w3.org/TR/CSP1/) | 内容安全策略 1.0 版本。_CSP 1.1 与 CSP 3.0 并未扩展 HTTP 协议标准_ | 已废弃 | -| [Microsoft document]() | _指定传统文档模式定义 X-UA-Compatible 规范_ | 注记 | -| {{rfc(5689)}} | HTTP 拓展之 Web 分布式创作与版本控制 (WebDAV) _这些 Web 上的拓展,与 CardDAV 和 CalDAV 一起超出了 Web 上的 HTTP 的范围。当下应用的现代 API 使用了 RESTful 的接口。_ | 建议标准 | -| {{rfc(2324)}} | 超文本咖啡壶控制协议(HTCPCP/1.0) | 愚人节玩笑 | -| {{rfc(7168)}} | 超文本咖啡壶控制协议的茶壶扩展(HTCPCP-TEA) | 愚人节玩笑 | -| [HTML Living Standard](https://html.spec.whatwg.org/multipage/) | HTML。_针对服务端发送的事件定义了 HTTP 扩展_ | 实时标准 | -| [Tracking Preference Expression](https://www.w3.org/2011/tracking-protection/drafts/tracking-dnt.html) | DNT 首部字段 | 编辑草案/推荐候选 | -| [Reporting API](http://wicg.github.io/reporting/) | `Report-To` 首部字段 | 草案 | -| [Draft spec](https://tools.ietf.org/html/draft-ietf-httpbis-expect-ct-01) | Expect-CT 拓展于 HTTP | IETF 草案 | +| 规范 | 标题 | 状态 | +| ------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------ | +| {{rfc(7230)}} | 超文本传输协议(HTTP/1.1):报文格式与路由 | 建议标准 | +| {{rfc(7231)}} | 超文本传输协议(HTTP/1.1):语义与内容 | 建议标准 | +| {{rfc(7232)}} | 超文本传输协议(HTTP/1.1):条件请求 | 建议标准 | +| {{rfc(7233)}} | 超文本传输协议(HTTP/1.1):范围请求 | 建议标准 | +| {{rfc(7234)}} | 超文本传输协议(HTTP/1.1):缓存 | 建议标准 | +| {{rfc(5861)}} | 针对陈旧内容的 HTTP 缓存控制扩展 | 信息参考 | +| {{rfc(8246)}} | 不可变的 HTTP 响应 | 建议标准 | +| {{rfc(7235)}} | 超文本传输协议(HTTP/1.1):认证 | 建议标准 | +| {{rfc(6265)}} | HTTP 状态控制机制:定义 Cookies | 建议标准 | +| [Draft spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-prefixes-00) | Cookie 前缀 | IETF 草案 | +| [Draft spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-same-site-00) | 同源 Cookies | IETF 草案 | +| [Draft spec](https://tools.ietf.org/html/draft-ietf-httpbis-cookie-alone-01) | 反对非安全的源站对安全 cookies 进行修改 | IETF 草案 | +| {{rfc(2145)}} | HTTP 版本号的使用与解释 | 信息参考 | +| {{rfc(6585)}} | 扩展的 HTTP 状态码 | 建议标准 | +| {{rfc(7538)}} | 超文本传输协议的 308 状态码(永久重定向) | 建议标准 | +| {{rfc(7725)}} | 用于报告法律限制的 HTTP 状态码 | 即将成为标准 | +| {{rfc(2397)}} | URL 的“data“方案 | 建议标准 | +| {{rfc(3986)}} | 统一资源定位符(URI):通用语法 | 因特网标准 | +| {{rfc(5988)}} | 网络链接 _定义了 {{HTTPHeader("Link")}} 首部字段_ | 建议标准 | +| [Experimental spec](https://tools.ietf.org/id/draft-thomson-hybi-http-timeout-01.html) | 超文本传输协议(HTTP))的 Keep-Alive 首部字段 | 信息参考(已过期) | +| [Draft spec](http://httpwg.org/http-extensions/client-hints.html) | HTTP 客户端提示 | IETF 草案 | +| {{rfc(7578)}} | 从表单中返回数据:multipart/form-data | 建议标准 | +| {{rfc(6266)}} | 在超文本传输协议(HTTP)中使用 Content-Disposition 首部字段 | 建议标准 | +| {{rfc(2183)}} | Communicating Presentation Information in Internet Messages: The Content-Disposition Header Field _Only a subset of syntax of the {{HTTPHeader("Content-Disposition")}} header can be used in the context of HTTP messages._ | 建议标准 | +| {{rfc(7239)}} | 前向 HTTP 扩展 | 建议标准 | +| {{rfc(6455)}} | WebSocket 协议 | 建议标准 | +| {{rfc(5246)}} | 安全传输层(TLS)协议 1.2 版本 _该规范已经被后续 RFC 文档进行了修改,不过这些修改不会对 HTTP 协议本身产生效力。_ | 建议标准 | +| [Draft spec]() | 安全传输层(TLS)协议 1.3 版本 _该版本就绪之后,将取代之前的 1.2 版本_ | IETF 草案 | +| {{rfc(2817)}} | 在 HTTP/1.1 中进行 TLS 升级 | 建议标准 | +| {{rfc(7540)}} | 超文本传输协议版本 2(HTTP/2) | 建议标准 | +| {{rfc(7541)}} | HPACK:对 HTTP/2 的首部进行压缩 | 即将成为标准 | +| {{rfc(7838)}} | HTTP 替代服务 | 即将成为标准 | +| {{rfc(7301)}} | 对安全传输层(TLS)的应用层协议的协商的扩展 _用于在传输 HTTP/2 报文时进行协商,以减少一对额外的请求/响应_ | 建议标准 | +| {{rfc(6454)}} | 网络源站的概念 | 建议标准 | +| [Fetch](https://fetch.spec.whatwg.org/#cors-protocol) | 跨源资源共享 | 实时标准 | +| {{rfc(7034)}} | HTTP 首部字段 X-Frame-Options | 信息参考 | +| {{rfc(6797)}} | HTTP 严格安全传输(HSTS) | 建议标准 | +| [Upgrade Insecure Requests](https://w3c.github.io/webappsec-upgrade-insecure-requests/) | 对不安全的请求进行升级 | 推荐候选 | +| [Content Security Policy 1.0](https://www.w3.org/TR/CSP1/) | 内容安全策略 1.0 版本。_CSP 1.1 与 CSP 3.0 并未扩展 HTTP 协议标准_ | 已废弃 | +| [Microsoft document]() | _指定传统文档模式定义 X-UA-Compatible 规范_ | 注记 | +| {{rfc(5689)}} | HTTP 拓展之 Web 分布式创作与版本控制 (WebDAV) _这些 Web 上的拓展,与 CardDAV 和 CalDAV 一起超出了 Web 上的 HTTP 的范围。当下应用的现代 API 使用了 RESTful 的接口。_ | 建议标准 | +| {{rfc(2324)}} | 超文本咖啡壶控制协议(HTCPCP/1.0) | 愚人节玩笑 | +| {{rfc(7168)}} | 超文本咖啡壶控制协议的茶壶扩展(HTCPCP-TEA) | 愚人节玩笑 | +| [HTML Living Standard](https://html.spec.whatwg.org/multipage/) | HTML。_针对服务端发送的事件定义了 HTTP 扩展_ | 实时标准 | +| [Tracking Preference Expression](https://www.w3.org/2011/tracking-protection/drafts/tracking-dnt.html) | DNT 首部字段 | 编辑草案/推荐候选 | +| [Reporting API](http://wicg.github.io/reporting/) | `Report-To` 首部字段 | 草案 | +| [Draft spec](https://tools.ietf.org/html/draft-ietf-httpbis-expect-ct-01) | Expect-CT 拓展于 HTTP | IETF 草案 | diff --git a/files/zh-cn/web/http/session/index.md b/files/zh-cn/web/http/session/index.md index 79240459471007..53a8e2be090cfb 100644 --- a/files/zh-cn/web/http/session/index.md +++ b/files/zh-cn/web/http/session/index.md @@ -27,8 +27,8 @@ slug: Web/HTTP/Session 1. 第一行包括请求方法及请求参数: - - 文档路径,不包括协议和域名的绝对路径 URL - - 使用的 HTTP 协议版本 + - 文档路径,不包括协议和域名的绝对路径 URL + - 使用的 HTTP 协议版本 2. 接下来的行每一行都表示一个 HTTP 标头,为服务器提供关于所需数据的信息(例如语言,或 MIME 类型),或是一些改变请求行为的数据(例如当数据已经被缓存,就不再应答)。这些 HTTP 标头形成一个以空行结尾的块。 3. 最后一块是可选数据块,包含更多数据,主要被 POST 方法所使用。 diff --git a/files/zh-cn/web/http/status/408/index.md b/files/zh-cn/web/http/status/408/index.md index 2987520f79912e..095da5b5f4a7cb 100644 --- a/files/zh-cn/web/http/status/408/index.md +++ b/files/zh-cn/web/http/status/408/index.md @@ -5,7 +5,7 @@ slug: Web/HTTP/Status/408 {{HTTPSidebar}} -响应状态码 **`408 Request Timeout`** 表示服务器想要将没有在使用的连接关闭。一些服务器会在空闲连接上发送此信息,**即便是在客户端没有发送任何请求的情况下。 +响应状态码 **`408 Request Timeout`** 表示服务器想要将没有在使用的连接关闭。一些服务器会在空闲连接上发送此信息,即便是在客户端没有发送任何请求的情况下。 服务器应该在此类响应中将 {{HTTPHeader("Connection")}} 首部的值设置为 "close",因为 `408` 意味着服务器已经决定将连接关闭,而不是继续等待。