5

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
  • 1
    I asked a similar question before and couldn't find a solution. Hope this one get answered. It's quite PITA to parse it manually but that's what I've done at the end. Commented Apr 23, 2009 at 14:34

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

Comments

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).

1 Comment

Sure it is, but proper HTTP parsing is difficult. You could try and dig out the needed parts of the .NET parser with reflection, but I wouldn't recommend this approach unless you're really desperate.
2

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.