如何使用Wireshark检查HTTP响应主体(例如HTML内容)?
我在虚拟机的浏览器浏览器中输入URL,并且URL在我的主机计算机中请求HTML文档(此HTML文档也由我编写)。然后,在虚拟机浏览器中成功显示了HTML文档。似乎HTTP请求和响应已成功发送,否则在浏览器中无法看到HTML文档。 我使用Wireshark软件跟踪了此过程,并找到了虚拟机发送给我的主机计算机的HTTP请求(即HTML文档的请求),如下屏幕截图所示:(某些个人信息被紫色掩盖)
双击此请求以查看详细信息,我发现:
它显示响应是在框架6中。 但是,打开框架6的详细信息后,无法找到HTML文档的内容。我自己写了HTML。我知道有一些东西,例如“按钮”,“输入”。通常,这些HTML的内容应该在HTTP响应中,但我找不到它,甚至没有“身体”。 HTTP响应中没有HTML文档内容。整个帧6下方:
I input the URL in the address bar in the browser of the virtual machine, and the URL requests an HTML document in my host computer (this HTML document is also written by me). Then the HTML document is successfully displayed in the virtual machine browser. It seems that the HTTP request and response are successfully sent, otherwise the HTML document cannot be seen in the browser.
I tracked this process with Wireshark software and found the HTTP request (that is, the request for HTML document) sent by the virtual machine to my host computer, as shown in the following screenshot:(some personal information is masked with purple)
Double clicked this request to see the details and I found that:
It showed the response is in frame 6.
However, the contents of the HTML document cannot be found after opening the details of the frame 6. I wrote the HTML myself. I know there are stuffs like "button", "input". Normally, the content of these HTML should be in the HTTP response, but I couldn't find it, not even a "body". There is no HTML document content in the HTTP response. The whole frame 6 is down below:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您将获得http状态代码 304未修改不是状态代码200。这意味着浏览器已经具有响应主体,并且仅通过服务器进行验证,即主体仍然与缓存相同。您应该看到一个 if-none-match < /a>字段和/或 if-modified-since
自从身体以来尚未更改服务器只需使用状态代码304通知浏览器,以便它使用已缓存的响应。由于浏览器不需要它,因此不会再次在响应主体中发送内容。如果要在响应中获取实际内容,请确保其尚未缓存,即删除浏览器中的所有缓存或使用不缓存的客户端,例如
curl
。You get a HTTP status code 304 Not Modified and not a status code 200 back. This means that the browser already had the response body and just verified with the server is the body is still the same as it has cached. You should see an If-None-Match field and/or If-Modified-Since
Since the body has not changed the server just informs the browser using status code 304 about this so that it uses the already cached response. It does not send the content again in the response body since it is not needed by the browser. If you want to get the actual content in the response make sure it is not already cached, i.e. remove all caches in the browser or use a client which does not cache, like
curl
.