RE: -902

In the continuing saga of my PUT request that insists on returning -902, I
added a setOutputStream to HTBlackHole() in an attempt to put someone
downstream of the MIME parser to handle the PUT's response body. And,
wonder of wonders, the request returns 200! Yea!

Well... actually... modified rapture. It turns out the *first* request
returns 200. A second PUT request returns from the event loop without even
calling my terminate handler! I can't believe it! I thought I was beginning
to understand this stuff, but no luck.

The task is to write a memory buffer to a URL. Here's my PUT code sequence:

     // Create a temporary anchor to represent the buffer being written.
     anchor = HTTmpAnchor(HTLib_userProfile());
     HTAnchor_setDocument(anchor, buffer);
     HTAnchor_setLength(anchor, numBytes);

     // Perform a PUT on that anchor.
     request = HTRequest_new();
     HTRequest_setOutputFormat(request, WWW_SOURCE);    // Don't convert
output format.
     HTRequest_setOutputStream(request, HTBlockHole());           // Throw
away any reponse body.

     // Add a terminate handler to stop the event loop.
     HTRequest_addAfter(request, aTerminateHandler, NULL, NULL, HT_ALL,
HT_FILTER_LAST, FALSE);

     if (HTPutAbsolute(anchor, (char*)url, request)) {
          HTEventList_loop(request);                    // Wait for PUT to
complete.
          err = OK;                           // PUT succeded.
     } else
          err = NO;

     HTRequest_delete(request);                         // Clean up.
     HTAnchor_deleteAll(NULL);

The symptom is:

First time, the server returns "100 Continue", then "200 OK". The client
processes both responses, calls my terminate handler with status = 200, and
everything is fine. Second time, the *same* code runs, the server returns
"100 Continue" and the client processes the reply, and then returns from
the event loop without waiting for the "200 OK" *and* without calling my
terminate handler. ARGH! Any ideas?

regards,
-jim

Received on Monday, 21 December 1998 12:31:36 UTC