W3C home > Mailing lists > Public > www-lib@w3.org > January to March 2007

Example for fetching Headers and Content

From: Gunnar Henne <Henne@otris.de>
Date: Tue, 09 Jan 2007 15:53:11 +0100
Message-ID: <45A3AC57.1090601@otris.de>
To: www-lib@w3.org

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 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:46 GMT