.NET HTTP parser

2019-06-28 08:12发布

问题:

I am writing an application to sniff some HTTP traffic. I am using WinPcap to access the TCP/IP packets. Is there a library that will help me parse the HTTP messages?

I have implemented a basic parser myself, but I would like something more mature: I keep running into new variations (chunked messages, gzip-compression etc.)

The .NET framework probably have a HTTP parser, but I can't see any way to use it, when the TCP packets do not come from a direct TCP connection.

回答1:

Check out HttpMachine | https://github.com/bvanderveen/httpmachine



回答2:

You could create a dummy "http server" and serve your sniffed packets out of it, then you can use .NET's parser (HttpWebResponse or whatever).



回答3:

Long shoot, but have you look at Cassini source code?
I also found HTML Agility in previous SO question.