HTTP首部詳解
[[email protected] ~]# curl -v "www.baidu.com"
* About to connect() to www.baidu.com port 80 (#0)
* Trying 180.97.33.108...
* Connected to www.baidu.com (180.97.33.108) port 80 (#0)
> GET / HTTP/1.1
> User-Agent: curl/7.29.0
> Host: www.baidu.com
> Accept: */*
>
< HTTP/1.1 200 OK
< Accept-Ranges: bytes
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
< Connection: Keep-Alive
< Content-Length: 2381
< Content-Type: text/html
< Date: Wed, 24 Oct 2018 03:57:43 GMT
< Etag: "588604f8-94d"
< Last-Modified: Mon, 23 Jan 2017 13:28:24 GMT
< Pragma: no-cache
< Server: bfe/1.0.8.18
< Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
<
<!DOCTYPE html>
詳解:
> GET / HTTP/1.1
GET / HTTP/1.1:是 GET 方法訪問的 HTTP版本 HTTP/1.1
> User-Agent: curl/7.29.0
User-Agent:HTTP客戶端程式的資訊
> Host: www.baidu.com
Host:請求資源所在伺服器
> Accept: */*
Accept:使用者代理可處理的媒體型別
< HTTP/1.1 200 OK
HTTP/1.1 200 OK:協議版本和狀態返回碼
< Accept-Ranges: bytes
Accept-Ranges:用來告訴客戶端伺服器是否能處理範圍請求,指定獲取伺服器端某個部分的資源
可指定的欄位有兩種,可處理範圍請求時指定其為bytes,反之則指定其為none
< Cache-Control: private, no-cache, no-store, proxy-revalidate, no-transform
Cache-Control:控制快取的行為
private:僅向特定使用者返回響應
no-cache:快取前必須先確認其有效性
no-store:不快取請求或響應的任何內容
proxy-revalidate:要求中間快取伺服器對快取的響應有效性再進行確認
no-transform:代理不可更改媒體型別
< Connection: Keep-Alive
Connection:逐條首部、連線的管理
< Content-Length: 2381
Content-Length:實體主體的大小(單位:位元組)
< Content-Type: text/html
Content-Type:實體主體的媒體型別
< Date: Wed, 24 Oct 2018 03:57:43 GMT
Date:建立報文的日期時間
< Etag: "588604f8-94d"
Etag:資源的匹配資訊
< Last-Modified: Mon, 23 Jan 2017 13:28:24 GMT
Last-Modified:資源的最後修改日期時間
< Pragma: no-cache
Pragma:報文指令
< Server: bfe/1.0.8.18
Server:HTTP伺服器的安裝資訊
< Set-Cookie: BDORZ=27315; max-age=86400; domain=.baidu.com; path=/
Set-Cookie:是伺服器返回的響應頭用來在瀏覽器種cookie,一旦被種下,當瀏覽器訪問符合條件的url地址時,會自動帶上這個cookie
max-age=86400:響應的最大Age值
<!DOCTYPE html>
DOCTYPE html:宣告幫助瀏覽器正確地顯示網頁。