亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

directory search
Guides Access control CORS Authentication Browser detection using the user agent Caching Caching FAQ Compression Conditional requests Connection management in HTTP 1.x Content negotiation Content negotiation: List of default Accept values Cookies CSP Messages Overview Protocol upgrade mechanism Proxy servers and tunneling Proxy servers and tunneling: Proxy Auto-Configuration (PAC) file Public Key Pinning Range requests Redirections Resources and specifications Resources and URIs Response codes Server-Side Access Control Session Guides: Basics Basics of HTTP Choosing between www and non-www URLs Data URIs Evolution of HTTP Identifying resources on the Web MIME Types MIME types: Complete list of MIME types CSP Content-Security-Policy Content-Security-Policy-Report-Only CSP: base-uri CSP: block-all-mixed-content CSP: child-src CSP: connect-src CSP: default-src CSP: font-src CSP: form-action CSP: frame-ancestors CSP: frame-src CSP: img-src CSP: manifest-src CSP: media-src CSP: object-src CSP: plugin-types CSP: referrer CSP: report-uri CSP: require-sri-for CSP: sandbox CSP: script-src CSP: style-src CSP: upgrade-insecure-requests CSP: worker-src Headers Accept Accept-Charset Accept-Encoding Accept-Language Accept-Ranges Access-Control-Allow-Credentials Access-Control-Allow-Headers Access-Control-Allow-Methods Access-Control-Allow-Origin Access-Control-Expose-Headers Access-Control-Max-Age Access-Control-Request-Headers Access-Control-Request-Method Age Allow Authorization Cache-Control Connection Content-Disposition Content-Encoding Content-Language Content-Length Content-Location Content-Range Content-Type Cookie Cookie2 Date DNT ETag Expect Expires Forwarded From Headers Host If-Match If-Modified-Since If-None-Match If-Range If-Unmodified-Since Keep-Alive Large-Allocation Last-Modified Location Origin Pragma Proxy-Authenticate Proxy-Authorization Public-Key-Pins Public-Key-Pins-Report-Only Range Referer Referrer-Policy Retry-After Server Set-Cookie Set-Cookie2 SourceMap Strict-Transport-Security TE Tk Trailer Transfer-Encoding Upgrade-Insecure-Requests User-Agent User-Agent: Firefox Vary Via Warning WWW-Authenticate X-Content-Type-Options X-DNS-Prefetch-Control X-Forwarded-For X-Forwarded-Host X-Forwarded-Proto X-Frame-Options X-XSS-Protection Methods CONNECT DELETE GET HEAD Methods OPTIONS PATCH POST PUT Status 100 Continue 101 Switching Protocols 200 OK 201 Created 202 Accepted 203 Non-Authoritative Information 204 No Content 205 Reset Content 206 Partial Content 300 Multiple Choices 301 Moved Permanently 302 Found 303 See Other 304 Not Modified 307 Temporary Redirect 308 Permanent Redirect 400 Bad Request 401 Unauthorized 403 Forbidden 404 Not Found 405 Method Not Allowed 406 Not Acceptable 407 Proxy Authentication Required 408 Request Timeout 409 Conflict 410 Gone 411 Length Required 412 Precondition Failed 413 Payload Too Large 414 URI Too Long 415 Unsupported Media Type 416 Range Not Satisfiable 417 Expectation Failed 426 Upgrade Required 428 Precondition Required 429 Too Many Requests 431 Request Header Fields Too Large 451 Unavailable For Legal Reasons 500 Internal Server Error 501 Not Implemented 502 Bad Gateway 503 Service Unavailable 504 Gateway Timeout 505 HTTP Version Not Supported 511 Network Authentication Required Status
characters

所述ETag HTTP 響應(yīng)報(bào)頭為資源的特定版本的標(biāo)識符。它允許緩存更高效,并節(jié)省帶寬,因?yàn)槿绻麅?nèi)容沒有改變,Web 服務(wù)器不需要發(fā)送完整的響應(yīng)。另一方面,如果內(nèi)容發(fā)生了變化,etags 有助于防止資源的同時(shí)更新互相覆蓋(“空中沖突”)。

如果給定 URL 處的資源發(fā)生更改,則Etag必須生成新值。因此,Etags 與指紋相似,也可能用于某些服務(wù)器的跟蹤目的。它們的比較可以快速確定資源的兩個(gè)表示是否相同,但它們也可能被設(shè)置為無限期地由跟蹤服務(wù)器持續(xù)存在。

Header type

Response header

Forbidden header name

no

語法

ETag: W/"<etag_value>"ETag: "<etag_value>"

指令

W/可選'W/'(區(qū)分大小寫)表示使用弱驗(yàn)證程序。弱驗(yàn)證器很容易生成,但對于比較來說卻不太有用。強(qiáng)大的驗(yàn)證器是進(jìn)行比較的理想選擇,但可能非常難以高效生成。

Etag相同資源的兩個(gè)表示的弱值可能在語義上是等價(jià)的,但不是字節(jié)一致的?!?lt;etag_value>”實(shí)體標(biāo)記唯一地表示請求的資源。它們是放在雙引號(像是"675af34563dc-tr34")之間的 ASCII 字符串。

ETag沒有指定生成值的方法。通常,使用內(nèi)容的散列,最后修改時(shí)間戳的散列或僅修訂版本號。例如,MDN 使用 wiki 內(nèi)容的十六進(jìn)制數(shù)字的散列。

例子

ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"ETag: W/"0815"

避免空中碰撞

借助標(biāo)題ETagIf-Match頭文件,您可以檢測到空中編輯沖突。

例如,在編輯 MDN 時(shí),當(dāng)前的 wiki 內(nèi)容被散列并放入Etag響應(yīng)中:

ETag: "33a64df551425fcc55e4d42a148795d9f25f89d4"

當(dāng)保存對 wiki 頁面的更改(發(fā)布數(shù)據(jù))時(shí),POST請求將包含包含要檢查新鮮度If-MatchETag值的標(biāo)題。

If-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"

如果散列不匹配,則意味著文檔已被編輯,并且412 Precondition Failed引發(fā)錯(cuò)誤。

緩存不變的資源

ETag標(biāo)題的另一個(gè)典型用例是緩存未更改的資源。如果用戶再次訪問一個(gè)給定的 URL(它有一個(gè)ETag集合),并且它已經(jīng)過時(shí)了,那么這個(gè) URL 太舊而不能被視為可用,客戶端會將它的值發(fā)送到ETag一個(gè)If-None-Match標(biāo)題字段中:

If-None-Match: "33a64df551425fcc55e4d42a148795d9f25f89d4"

服務(wù)器比較客戶端ETag(與其If-None-Match一起發(fā)送)ETag與其當(dāng)前版本的資源,并且如果兩個(gè)值匹配(即資源沒有改變),則服務(wù)器發(fā)回304 Not Modified狀態(tài),沒有任何正文,告訴客戶端緩存版本的響應(yīng)仍然很好用(新鮮)。

規(guī)范

Specification

Title

RFC 7232, section 2.3: ETag

Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests

瀏覽器兼容性

Feature

Chrome

Firefox

Edge

Internet Explorer

Opera

Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

Feature

Android

Chrome for Android

Edge mobile

Firefox for Android

IE mobile

Opera Android

iOS Safari

Basic Support

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

(Yes)

Previous article: Next article: