Example for fetching Headers and Content

Gunnar Henne <[email protected]> Tue, 09 Jan 2007 15:53:11 +0100
Newsgroups gmane.comp.lib.libwww
Message-ID <[email protected]>
Hello,

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

 From the documentation I know that there is a MIME Parser in libwww=20
which is able to strip of the headers (but keep them in separate memory=20
for later) and do some content-decoding (i.e. decode Base64 Content).=20
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=20
all the protocol specific stuff like multipart etc.
4) Ask the response for the complete list of key-value headers send by=20
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 ->=20
Transform to c-string
    If the url is a file -> get the file (in the body) as Chunk ->=20
Transform to void* and length

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

Thanks in advance for your help!

With kind regards

Gunnar Henne