HTTP 1.1 Keep-Alive.

Dear libwww users,

I've been trying to write a program, using libwww, that fetches a web page
from a
remote web server and provides me with the following items:
1) The HTTP status code.
2) The HTTP response headers, in cleartext format.
3) The HTTP response body (the web page), also in cleartext format.

Based on the documentation of libwww and the chunkbody example program I
have come
to the attached sample program. The idea of it is that the full HTTP
response is put
in the character string, which is parsed by a parsing routine (written by
myself) and
split up in the 3 items I need.

However, there is one problem with this program. For all servers that
support the
HTTP 1.1 Keep-Alive feature. The HTTP response is delivered by the program
after the
Keep-Alive timeout has expired, and the remote web server has closed the
connection.

In the documentation I have read that I should use output format WWW_SOURCE
to let
libwww interpret the MIME headers of the response. This will deliver the
HTTP response
to the program at the moment is has been read on the connection. The problem
with that
solution is that when the specify WWW_SOURCE as output format, I won't get
the status
line and the HTTP headers in the character string.

What is the proper way of handling this?
How can I both support the HTTP 1.1 Keep-Alive feature and get the status
code and HTTP
response headers?





Thanks,

Gertjan van Wingerde.

Received on Friday, 11 June 1999 05:11:37 UTC