[root@dps631 ~]# 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:声明帮助浏览器正确地显示网页。