I try to implement a simple proxy server and i face the following problem:When the server send back the file i've requested and i store it i can't open it.Obviously this is because i store the http headers too.Have you any ideas how can i store only the body and not the headers.i only cache when the answer is "200 ok".A code example would be great.Thanx!! :D
Check out the thttpd web server at the www.acme.com site for an example... small code impl of a web server... fairly easy to understand the flow of things (few callbacks etc. in it)...
Michael
Try using an HTTP state machine parser to parse out he HTTP header and body and then use that to extract and save just the body. HTTP / HTTPS Header Check:: HTTP / HTTPS Header Check. Whois Lookup. Domain Age Tool. IP to City. File Search Engine allow you to inspect the HTTP headers that the web server returns http://www.webconfs.com/http-header-check.phpHOME |
It is a parser that parsers one character at a time recording that state since the data across TCP can be broken anyplace and is not guaranteed to be packaged in any shape or format (but reliable and in order is guaranteed).
I am sure there are places to get one--but I would just write one.
And what exactly is a HTTP state machine parser,where can i find him and how can i use it assuming i work with c.Thanx again!!!! :)
How much does getting a small tattoo on your hip/stomach hurt?
Do anyone else have an itchy anus? ?
|