Re: get body of a response

>>>>> "Wang, Xinju" <Xinju.Wang@ugs.com>:

> In HTReader_read of HTReader.c, I can copy the body of the reponse from the
> me->write (me is the InputStream). I basically grab whatever in the
> stream and put it into an added field in the request. This is a hack
> but if you know an elegant way to do it, please let me know.

I never handled the response specially for WebDAV requests.  I just
routed the response into the dispatching XML handler I used for MIME
type text/xml, which recognized the "DAV:" namespace on the top level
element, and sent it off to the correct backend.

> Also, does this hack have some side effects?

> if(me->write) {
> 	request->responseBody = HTChunk_new(1024);
> 	HTChunk_puts(request->responseBody, me->write);
> }

I don't know.

> I tried everything I can find in this mailing list and the doc. The
> HTTmpAnchor doesn't work maybe because of the 206 status code.

You mean HTTmpAnchor doesn't work for sending the XML message?  In
what way does it not work?  Does it hang, waiting for a server 100
continue? 

> Since WebDAV has many new status code, do I need to add code to
> interpret them?

I've gotten someone to send me the diffs from the imported libwww
5.3.2 to what's currently in CVS, and my changes to HTTP.c are:

Index: Library/src/HTTP.c
===================================================================
RCS file: /giga/cvs/2x/3rdparty/libwww/Library/src/HTTP.c,v
retrieving revision 1.1.1.3
retrieving revision 1.3
diff -c -b -t -r1.1.1.3 -r1.3
*** HTTP.c	2001/07/20 12:32:11	1.1.1.3
--- HTTP.c	2001/07/31 16:31:33	1.3
***************
*** 286,292 ****
                                 me->reason, (int) strlen(me->reason),
                                 "HTTPNextState");
              http->next = HTTP_OK;
!             http->result = HT_PARTIAL_CONTENT;
              break;
  
          default:
--- 286,292 ----
                                 me->reason, (int) strlen(me->reason),
                                 "HTTPNextState");
              http->next = HTTP_OK;
!             http->result = HT_LOADED;
              break;
  
          default:
***************
*** 738,744 ****
          **  like. The TRACE and OPTIONS method just adds to the current 
          **  metainformation so in that case we don't clear the anchor.
          */
!         if (me->status==200 || me->status==203 || me->status==300) {
              /*
              **  200, 203 and 300 are all fully cacheable responses. No byte 
              **  ranges or anything else make life hard in this case.
--- 738,748 ----
          **  like. The TRACE and OPTIONS method just adds to the current 
          **  metainformation so in that case we don't clear the anchor.
          */
!         if (me->status==200 ||
!             me->status==203 ||
!             me->status==207 ||
!             me->status==300)
!         {
              /*
              **  200, 203 and 300 are all fully cacheable responses. No byte 
              **  ranges or anything else make life hard in this case.

Received on Tuesday, 13 November 2001 03:08:16 UTC