For Programmers: Free Programming Magazines  


Home > Archive > C# > May 2005 > Parsing HTTP Headers









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Parsing HTTP Headers
gingerninja1@gmail.com

2005-04-13, 3:58 pm

I have a TCPListener which listens for traffic on a specific port. When
a request is made to the socket from a Web Browser I get the usuall
HTTP Headers you would expect, whats the best way to parse out those
HTTP Headers so I can get the GET and POST information. Is there a
class within C# that helps out with this? Or does someone have some
code out there I can use.

Thanks a lot.

gabe garza

2005-05-14, 7:13 pm

Use split, but first check your line delimiter to figure out what to pass to
split.
Check CR/LF first for Windows, then Check for LF for Unix then check for CR.
I came across a system that uses CR but I forgot which one that was.

If a POST then check for a double delimiter cause that's what seperates your
HTTP Headers from your POST data.

You may want to read up on the HTTP Protocol as well. :)


<gingerninja1@gmail.com> wrote in message
news:1113411346.103190.269010@l41g2000cwc.googlegroups.com...
>I have a TCPListener which listens for traffic on a specific port. When
> a request is made to the socket from a Web Browser I get the usuall
> HTTP Headers you would expect, whats the best way to parse out those
> HTTP Headers so I can get the GET and POST information. Is there a
> class within C# that helps out with this? Or does someone have some
> code out there I can use.
>
> Thanks a lot.
>
>



gabe garza

2005-05-18, 4:00 am

Use split, but first check your line delimiter to figure out what to pass to
split.
Check CR/LF first for Windows, then Check for LF for Unix then check for CR.
I came across a system that uses CR but I forgot which one that was.

If a POST then check for a double delimiter cause that's what seperates your
HTTP Headers from your POST data.

You may want to read up on the HTTP Protocol as well. :)


<gingerninja1@gmail.com> wrote in message
news:1113411346.103190.269010@l41g2000cwc.googlegroups.com...
>I have a TCPListener which listens for traffic on a specific port. When
> a request is made to the socket from a Web Browser I get the usuall
> HTTP Headers you would expect, whats the best way to parse out those
> HTTP Headers so I can get the GET and POST information. Is there a
> class within C# that helps out with this? Or does someone have some
> code out there I can use.
>
> Thanks a lot.
>
>



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com