Ethernet实验之HTTP(二)

上一次完成了第一部分的实验,这次来做一下第二部分的内容

一、实验内容

大意是我们首先清除一下浏览器的缓存,然后开启Ethereal,首先访问提供的网址,再刷新一次,再停止抓包

二、关于问题

Answer the following questions:
8. Inspect the contents of the first HTTP GET request from your browser to the
server. Do you see an “IF-MODIFIED-SINCE” line in the HTTP GET?
9. Inspect the contents of the server response. Did the server explicitly return the
contents of the file? How can you tell?
10. Now inspect the contents of the second HTTP GET request from your browser to
the server. Do you see an “IF-MODIFIED-SINCE:” line in the HTTP GET? If
so, what information follows the “IF-MODIFIED-SINCE:” header?
11. What is the HTTP status code and phrase returned from the server in response to
this second HTTP GET? Did the server explicitly return the contents of the file?
Explain.
8.在第一次浏览器向服务器发送的get指令记录中,没有看到“if-modified-since”的字样

9.查看服务器响应的记录

可以看到浏览器中的内容都显式地展现在了服务器响应的记录中

10.在浏览器的第二条get指令的记录中,查看到了if-modified-since的字样

在首部行后面跟着的信息是:

get/ethereal-labs/thhp-ethereal-file2.html http/1.1\r\n

11.在第二条get指令的回复记录中,状态码是304 not modified。在记录中没有显式地展示网页的内容

在我们的浏览器缓存了这个网页的信息之后,会不确定当前缓存的是不是最新的,所以当下一次再访问这个网址的时候,会查看上一次的last-modified的值,确定我们浏览器的信息是不是最新的,如果是最新的,就会返回304 not modified这个状态,表示我们当前的是最新的,浏览器从缓存中读取就可以了,不需要再发送一次网页信息;如果不是最新的,这时候的处理方法和第一次访问页面的状态是一样的,服务器会把最新的网页信息发送到客户端,这时候的状态码就是200 OK,和我们第一个实验做的是一样的。

发布了63 篇原创文章 · 获赞 15 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/LieberVater/article/details/89095408