Example for fetching Headers and Content

Hello,

I need to fetch binary and html files from a webserver. I have studied 
the examples and found some für fetching the body and others for 
fetching the whole answer from the webserver, including un-interpreted 
headers.

 From the documentation I know that there is a MIME Parser in libwww 
which is able to strip of the headers (but keep them in separate memory 
for later) and do some content-decoding (i.e. decode Base64 Content). 
But I didn't get it to work.
Generally I want to do this:

1) Set up a request url
2) Set up additional request headers
3) Send the request, get the response, meanwhile letting libwww handle 
all the protocol specific stuff like multipart etc.
4) Ask the response for the complete list of key-value headers send by 
the server
5) Ask the response for a value of a given single key
6) If the url is a html page -> get the Text (in the body) as Chunk -> 
Transform to c-string
    If the url is a file -> get the file (in the body) as Chunk -> 
Transform to void* and length

Can you give me some information, how I can achive this? My biggest 
question is, how I have to connect the request with the MIME Parser and 
get the Results of the MIME parsing (headers an content separated and 
decoded).

Thanks in advance for your help!

With kind regards

Gunnar Henne

Received on Tuesday, 9 January 2007 16:27:12 UTC