HTTP首部详解

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值