Re: getting response-body from libwww DAV

Hi Thomas,

>
> hi,
> can anyone line out the propsed way to get the
> response body from a DAV-Request i.e. propfind
> from libwww.
> Using HTRequest_setOutputStream like in 'davsample'
> does not work for me since I want to process the
> output and not only append it to a file.
davsample sends output stream to stdout, but there are other possibilities
inside libwww...
You can use, for example, a chunk to handle request body. For example:
(used variables are
HTChunk *output;
BOOL status;
char *url, xmlbody;
HTDAVHeaders *davheaders;
)

            HTRequest_setOutputFormat (request,HTAtom_for("text/xml"));
            HTRequest_setOutputStream(request, HTStreamToChunk (request,
&(output),0));

            status = HTLOCKAbsolute(request,url,xmlbody,davheaders);

And after (in your terminate filter, for example), you can read the output
content using:

           char * out = (output)?HTChunk_data (output):NULL;

This litle example I pick up from some codes that I do this year, a
preliminar DAV support for Amaya editor, it works well (I don't know if my
codes are still under Amaya's CVS base, I think there are, you can
"download" it to analyse it)...
There are other examples under libwww/Library/Examples dir (mget.c, chunk.c,
...), you can look them also...

> What was the reason to put the HTLoad call into the
> webdav-methods by the way? From what I understand,
> it would have been more convenient to have them
> beeing called by the application and not inside
> the lib.
I think that maybe you didnīt understood the difference between HTLoad
method and the methods under HTDAV and HTAccess... HTLoad method is a
low-level method, and the methods under HTDAV and HTAccess modules are
high-level methods.. You application may choose between them.. If you want
use high-level methods, you will use the methods from HTAcces (for HTTP
calls) or from HTDAV (for WebDAV calls)... If you want to use low-level
methods in your application, you will use HTLoad..
I suggest you to read libwww documentation to better understand it. I
suggest the documents under library/User/Using/ and library/User/Guide/, and
also HTReq.html, HTAccess.html and HTDAV.html (under libwww/Library/src/)...

> Is support for DeltaV and DASL planned?
>
I think not... :(( I build libwww's WebDAV support because I needed it for
my work, but now, itīs finished... :((
The only support under libwww that you can use to implement some methods
from DeltaV and DASL protocols are the "extension methods". Those methods
are "undefined methods": your application can define it on the fly, and use
low-level functions (now you will need HTLoad) to execute it. See
HTMethods.html, HTReq.html and myext examples for more information...

> Thanks in advance
you're welcome...

Manuele

Received on Wednesday, 3 July 2002 09:27:30 UTC