How do I get headers and data for a request no matter what happens?

I am trying to use libwww (latest version) to build a general purpose
HTTP API, and I am having trouble with some very basic things.

I want to get both the data and the headers for all requests, even
ones that are considered failures, and regardless of if I have
turned on the cache.

I am finding that the HTAnchor has the headers only for successful
requests with the Cache turned on, and HTResponse never seems to have all
of the headers.  I am finding that if I get the output/debug streams in
RAW format, then I do see the headers on the stream (and I can parse
them myself), but the data is sometimes in chunked mode, and I really
don't want to re-implement chunk decoding.  Is there some way to get
both the headers and the decoded data at the same time?

(Perhaps I need to register a converter that can see the raw stream, but
then pass everything that it sees on to a stream stack that WWW_SOURCE
would normally construct?  But I can't figure out what exactly I do to
do that, and that seems like a lot of work for something fairly simple.
(I guess that I register a converter for some www/x-my-header-capture
that captures the headers, and then have that use
HTStreamStack(
    "www/x-my-header-capture",
    WWW_SOURCE,
    HTRequest_outputStream(request),
    request,
    NO)
that it passes the data on to, but that seems like then the stream
is getting the wrong format (since it asked for my custom format),
instead I want my converter to somehow be always part of the
WWW_RAW -> WWW_SOURCE stack...)

William Bardwell
wbardwel@curl.com

Received on Tuesday, 24 June 2003 18:49:06 UTC