header connection 个人理解

来源:互联网 发布:注册消防工程师软件 编辑:程序博客网 时间:2024/06/03 19:36

在响应头中 看到有如下代码

HTTP/1.1 200 OK
Date: Thu, 19 Oct 2017 06:26:46 GMT
Server: Apache/2.4.23 (Win64) PHP/5.6.25
X-Powered-By: PHP/5.6.25
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Content-Length: 1322
Keep-Alive: timeout=5, max=81
Connection: Keep-Alive
Content-Type: text/html; charset=UTF-8

看到connection的值为 keep-alive 不太懂,百度了下,说是http1.1版本的特性 长连接。

还有一个参数是keep-alive ,值为timeout=5,max=81,意思是 在5秒内 的所有http请求 都不会再次连接服务器,因为当前的连接方式是长连接,就可以走这个长连接,完成css ,js ,图片等文件的请求。

如此一来 ,客户端连接服务器的次数少了,大大加快的网站的访问速度。

以上是个人总结以免忘记,不喜勿喷~

原创粉丝点击