9 Jan 2007 15:53
Example for fetching Headers and Content
Gunnar Henne <Henne <at> otris.de>
2007-01-09 14:53:11 GMT
2007-01-09 14:53:11 GMT
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).
(Continue reading)
> This a full filled example of what has been called 'literate
> programming' . . .
>
> "The main idea is to treat a program as a piece of literature,
> addressed to human beings rather than to a computer. The program is
> also viewed as a hypertext document, rather like the World Wide
> Web." -- Knuth [1]
>
>> I'm asking because I thought about using the library's nice and
>> gentle comment style in other projects, instead of the doxygen style.
>
> It is interesting the effect of text which is conciously intended
> for another human being.
This was something interesting and news to me. One never stops to
RSS Feed