浏览器如何将数据包转换为html代码? [英] how does a browser convert the packets into html code?

查看:126
本文介绍了浏览器如何将数据包转换为html代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用c ++创建了一个程序,该程序将获取我收到的所有数据包.我现在的问题是,某些网站(例如google.com)不是您所看到的,而是您从数据包中获得的内容.我期待某种html代码,但看着它,数据包似乎已加密.我不确定他们是出于安全原因还是这样做,以便他们的php代码或任何其他方法可以使他们的网站与任何浏览器兼容.

我需要有关如何读取数据包的帮助,例如网站的页面源或其附近的任何内容.

最后,我要创建某种防火墙.

I have created a program in c++ that will get all packets that i receive. My problem now is that some websites like google.com is not a what you see is what you get in the packets. i was expecting some sort of html code but looking at it the packets seem to be encrypted. i''m not sure if they do that for security reasons or they make it that way so that their php code or whatever can make their site compatible with any browser.

I need help on how to read the packets to something like the page source of a website or anything close to it.

In the end I''m creating some sort of firewall.

推荐答案

Google和许多其他站点使用gzip编码来减少传输的大小.如果要捕获HTTP标头,则应包含一个"Content-encoding"标头,该标头说明如何压缩数据.

有关详细信息,请查看 RFC 2616 [
Google and many other sites use gzip encoding to reduce the size of transfers. If you''re capturing the HTTP headers, they should include a "Content-encoding" header which says how the data has been compressed.

For details, take a look at RFC 2616[^]


这篇关于浏览器如何将数据包转换为html代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆