1. 程式人生 > >HTTP Headers參考使用

HTTP Headers參考使用

Requests

Field name Description Example
Accept Content-Types that are acceptable Accept: text/plain
Accept-Charset Character sets that are acceptable Accept-Charset: utf-8
Accept-Encoding Acceptable encodings Accept-Encoding: <compress
| gzip | identity>
Accept-Language Acceptable languages for response Accept-Language: en-US
Accept-Ranges Allows the server to indicate its acceptance of range requests for a resource Accept-Ranges: bytes
Authorization Authentication credentials for HTTP authentication Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Cache-Control Used to specify directives that MUST be obeyed by all caching mechanisms along the request/response chain Cache-Control: no-cache
Connection What type of connection the user-agent would prefer Connection: close
an HTTP cookie previously sent by the server with Set-Cookie (below) Cookie: $Version=1; Skin=new;
Content-Length The length of the request body in octets (8-bit bytes) Content-Length: 348
Content-Type The mime type of the body of the request (used with POST and PUT requests) Content-Type: application/x-www-form-urlencoded
Date The date and time that the message was sent Date: Tue, 15 Nov 1994 08:12:31 GMT
Expect Indicates that particular server behaviors are required by the client Expect: 100-continue
From The email address of the user making the request From: [email protected]
Host The domain name of the server (for virtual hosting), mandatory since HTTP/1.1 Host: en.wikipedia.org
If-Match Only perform the action if the client supplied entity matches the same entity on the server. This is mainly for methods like PUT to only update a resource if it has not been modified since the user last updated it. If-Match: "737060cd8c284d8af7ad3082f209582d"
If-Modified-Since Allows a 304 Not Modified to be returned if content is unchanged If-Modified-Since: Sat, 29 Oct 1994 19:43:31 GMT
If-None-Match Allows a 304 Not Modified to be returned if content is unchanged, see HTTP ETag If-None-Match: "737060cd8c284d8af7ad3082f209582d"
If-Range If the entity is unchanged, send me the part(s) that I am missing; otherwise, send me the entire new entity If-Range: "737060cd8c284d8af7ad3082f209582d"
If-Unmodified-Since Only send the response if the entity has not been modified since a specific time. If-Unmodified-Since: Sat, 29 Oct 1994 19:43:31 GMT
Max-Forwards Limit the number of times the message can be forwarded through proxies or gateways. Max-Forwards: 10
Pragma Implementation-specific headers that may have various effects anywhere along the request-response chain. Pragma: no-cache
Proxy-Authorization Authorization credentials for connecting to a proxy. Proxy-Authorization: Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ==
Range Request only part of an entity. Bytes are numbered from 0. Range: bytes=500-999
This is the address of the previous web page from which a link to the currently requested page was followed. Referer: http://en.wikipedia.org/wiki/Main_Page
TE The transfer encodings the user agent is willing to accept: the same values as for the response header Transfer-Encoding can be used, plus the "trailers" value (related to the "chunked" transfer method) to notify the server it accepts to receive additional headers (the trailers) after the last, zero-sized, chunk. TE: trailers, deflate;q=0.5
Upgrade Ask the server to upgrade to another protocol. Upgrade: HTTP/2.0, SHTTP/1.3, IRC/6.9, RTA/x11
User-Agent The user agent string of the user agent User-Agent: Mozilla/5.0 (Linux; X11)
Via Informs the server of proxies through which the request was sent. Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)
Warning A general warning about possible problems with the entity body. Warning: 199 Miscellaneous warning

Responses

Field name Description Example
Accept-Ranges What partial content range types this server supports Accept-Ranges: bytes
Age The age the object has been in a proxy cache in seconds Age: 12
Allow Valid actions for a specified resource. To be used for a 405 Method not allowed Allow: GET, HEAD
Cache-Control Tells all caching mechanisms from server to client whether they may cache this object Cache-Control: no-cache
Content-Encoding The type of encoding used on the data Content-Encoding: gzip
Content-Language The language the content is in Content-Language: da
Content-Length The length of the response body in octets (8-bit bytes) Content-Length: 348
Content-Location An alternate location for the returned data Content-Location: /index.htm
Content-Disposition An opportunity to raise a "File Download" dialogue box for a known MIME type Content-Disposition: attachment; filename=fname.ext
Content-MD5 A Base64-encoded binary MD5 sum of the content of the response Content-MD5: Q2hlY2sgSW50ZWdyaXR5IQ==
Content-Range Where in a full body message this partial message belongs Content-Range: bytes 21010-47021/47022
Content-Type The mime type of this content Content-Type: text/html; charset=utf-8
Date The date and time that the message was sent Date: Tue, 15 Nov 1994 08:12:31 GMT
ETag An identifier for a specific version of a resource, often a Message Digest, see ETag ETag: "737060cd8c284d8af7ad3082f209582d"
Expires Gives the date/time after which the response is considered stale Expires: Thu, 01 Dec 1994 16:00:00 GMT
Last-Modified The last modified date for the requested object, in RFC 2822 format Last-Modified: Tue, 15 Nov 1994 12:45:26 GMT
Used in redirection, or when a new resource has been created. Location: http://www.w3.org/pub/WWW/People.html
Pragma Implementation-specific headers that may have various effects anywhere along the request-response chain. Pragma: no-cache
Proxy-Authenticate Request authentication to access the proxy. Proxy-Authenticate: Basic
Used in redirection, or when a new resource has been created. This refresh redirects after 5 seconds.
(This is a proprietary/non-standard header extension introduced by Netscape and supported by most web browsers.)
Refresh: 5; url=http://www.w3.org/pub/WWW/People.html
Retry-After If an entity is temporarily unavailable, this instructs the client to try again after a specified period of time. Retry-After: 120
Server A name for the server Server: Apache/1.3.27 (Unix) (Red-Hat/Linux)
Set-Cookie Set-Cookie: UserID=JohnDoe; Max-Age=3600; Version=1
Trailer The Trailer general field value indicates that the given set of header fields is present in the trailer of a message encoded with chunked transfer-coding. Trailer: Max-Forwards
Transfer-Encoding The form of encoding used to safely transfer the entity to the user. Currently defined methods are: chunked, compress, deflate, gzip, identity. Transfer-Encoding: chunked
Vary Tells downstream proxies how to match future request headers to decide whether the cached response can be used rather than requesting a fresh one from the origin server. Vary: *
Via Informs the client of proxies through which the response was sent. Via: 1.0 fred, 1.1 nowhere.com (Apache/1.1)
Warning A general warning about possible problems with the entity body. Warning: 199 Miscellaneous warning
WWW-Authenticate Indicates the authentication scheme that should be used to access the requested entity. WWW-Authenticate: Basic

Common non-standard headers

Non-standard headers can be used, with the convention of prefixing the header name with X- .[1]

Field name Description Example
X-Frame-Options[2] Clickjacking protection. DENY - no rendering within a frame, SAMEORIGIN - no rendering if origin mismatch X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
X-Requested-With[3] mainly used to identify Ajax requests. Most JavaScript frameworks send this header with value of XMLHttpRequest X-Requested-With: XMLHttpRequest
a de facto standard for identifying the originating IP address of a client connecting to a web server through an HTTP proxy or load balancer X-Forwarded-For: client1, proxy1, proxy2
a de facto standard for identifying the originating protocol of an HTTP request, since a reverse proxy (load balancer) communicates with a web server using HTTP X-Forwarded-Proto: https

相關推薦

HTTP Headers參考使用

Requests Field name Description Example Accept Content-Types that are acceptable Accept: text/plain A

[Angular] Read Custom HTTP Headers Sent by the Server in Angular

conf nor update names fault pan table tom color By default the response body doesn’t contain all the data that might be needed in y

關於http headers 在 Websockets client API 中的正確操作

pre hyperlink lin tar ESS proto pro send .html 由於這段時間要處理websocket一些問題,要在WebSocket連接過程中使用最基礎的用戶名密碼驗證,但是一直沒有找到怎麽處理,然後詳細閱讀了RFC6455文檔,然後才知道怎麽

http headers解析

轉自:https://www.cnblogs.com/ranjianxi/p/7494734.html 檔案資訊: Content-Type: application/x-javascript Content-Length: 2000 Content-Type:指定請求和響應的內容型別,如果未

Python - HTTP Headers

客戶端和伺服器之間的請求和響應涉及訊息中的標題和正文。標頭包含出現在通過TCP連線傳送的原始訊息開頭的協議特定資訊。使用空行將郵件正文與標題分隔開。 Cache-Control Cache-Control通用頭欄位用於指定所有快取系統必須遵守的指令。語法如下: Cache-

Secure your web application with these HTTP headers

Secure your web application with these HTTP headersAs we’ve seen in the previous parts of this series, servers can send HTTP headers to provide the client

什麼是HTTP Headers

什麼是HTTP Headers HTTP是“Hypertext Transfer Protocol”的所寫,整個全球資訊網都在使用這種協議,幾乎你在瀏覽器裡看到的大部分內容都是通過http協議來傳輸的,比如這篇文章。 HTTP Headers是HTTP請求和相應的核心,它承載了關於客戶端瀏覽器,請求頁面,

Http Headers各屬性的作用

Request Headers: 下圖是我訪問一個URL:http://www.hzau.edu.cn的一個header,根據具體例項來分析一下各部分的功能及其作用。 Accept 作用: 瀏覽器端可以接受的媒體型別, 例如: A

使用 Spring RestTemplate 呼叫 rest 服務時自定義請求頭(custom HTTP headers

        在 Spring 3.0 中可以通過 HttpEntity 物件自定義請求頭資訊,如:private static final String APPLICATION_PDF = "application/pdf"; RestTemplate restTe

呼叫webservice,出現錯誤:Uncaught SoapFault exception: [HTTP] Error Fetching http headers

    在PHP中呼叫webservice釋出的服務(__Call),報如下錯:     Fatal error: Uncaught SoapFault exception: [HTTP] Error Fetching http headers in Test.php:18

HTTP Headers

1、基本介紹 HTTP 訊息頭允許客戶端和伺服器通過 request和 response傳遞附加資訊。一個請求頭由名稱(不區分大小寫)後跟一個冒號“:”,冒號後跟具體的值(不帶換行符)組成。該值前面的引導空白會被忽略。 2、根據不同上下文,可將訊息頭分為:

一致性hash 參考http://blog.csdn.net/cywosp/article/details/23397179/

相同 算法 tail 一個 得到 其他 ron strong 分布式 hash好壞的四個定義: 平衡性:平衡性是指哈希的結果能夠盡可能分布到所有的緩沖中去,這樣可以使得所有的緩沖空間都得到利用。 單調性:單調性是指如果已經有一些內容通過哈希分派到了相應的緩沖中,又有新的緩沖

http請求 headers 中的配置詳解

1.Accept 指定客戶端能夠接收的內容型別,內容型別中的先後次序表示客戶端接收的先後次序. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8 2.

jquery fileupload設定http request headers

CORS是一個W3C標準,全稱是"跨域資源共享"(Cross-origin resource sharing)。 它允許瀏覽器向跨源伺服器,發出XMLHttpRequest請求,從而克服了AJAX只能同源使用的限制。 整個CORS通訊過程,都是瀏覽器自動完成,不需要使用者參與。對於開發者

http Get Post response headers

常見狀態碼: 200 OK                       //客戶端請求成功 400 Bad Request             //客戶端請求有語法錯誤,不能被伺服器所理解 401 Unauthorized              //請求未經授權

LwIP+ STM32+HTTP例程參考

#include <RTL.h> #include <rtthread.h>#include <lwip/netdb.h>#include <lwip/sockets.h>#include <led.h>// Http請求內容static cons

Linux下用c語言實現發送http請求 方式可以Get或者Post例程參考

sockaddr select sleep online 創建 線程終止 index -s lse [1].[代碼] Linux下用c語言實現發送http請求 方式可以Get或者Post 跳至 [1] ? 1 2 3 4 5 6 7 8 9 10 11 12 1

Linux下用c語言實現傳送http請求 方式可以Get或者Post例程參考

[1].[程式碼] Linux下用c語言實現傳送http請求 方式可以Get或者Post 跳至 [1] ? 1 2

C++:C語言實現HTTP的GET和POST請求例程參考 C++:C語言實現HTTP的GET和POST請求

C++:C語言實現HTTP的GET和POST請求   閱讀目錄   HTTP請求和IP/TCP   實現GET請求   實現POST請求:   參考: 回到頂部

HTTP頭部資訊(Request Headers請求頭和Response Headers響應頭)

Request Header(請求頭) Accept:告訴伺服器,瀏覽器能夠處理的資料型別。(P575) Accept-Charset:瀏覽器能顯示的字符集。 Accept-Encoding:告訴伺服器,客戶機支援的資料壓縮格式。 Aceept-Language:瀏覽器當前設定的語言。