开发者

http header in a packets?

how to retrieve the http header in a packet in c++?

any sample code or tutorials can be a big help!..

thanx!..

note: winpcap was used for the packet sniffing and these packets are already filterd to be only tcp and http/s protocols..the only problem is how to decode the packet's http heade开发者_如何转开发r..


If you got the header read into a buffer already use the HTTP specification.

If you need to read the header, look at ASIO or boost::asio (same lib) for a neat low-level network lib. Or, consider Qt, an entire C++ framework that supports both low and high-level networking (and much more). There are HTTP client/server classes that you can use there.

Or, open a socket() and read from it directly. Eww.


The C++ network library might be what you're looking for.

Check the http::parser and its parse_http_headers member function in particular. It will populate an object of type http::message with the contents of your message's header.

The lib is still under development and the documentation is scarce. Therefore, the best way to learn it seems to be by browsing the source (but don't worry, it's very readable).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜