W3C home > Mailing lists > Public > www-lib@w3.org > January to March 1999

Re: Problems with POST

From: MOREAU Jean-Jacques <moreau@crf.canon.fr>
Date: Tue, 02 Mar 1999 16:49:28 +0100
Message-ID: <36DC0888.5622AB1B@crf.canon.fr>
To: Isabelle Delagarde <delagard@ssti.fr>
CC: www-lib@w3.org
Isabelle,

Isabelle Delagarde wrote:

> I would like to POST data with format "a=b&c=d&..." followed by a MIME
> file : everything needs to be in the same request.

I've digged into the library's code, and haven't found how to do this
(elegantly) either -although I would think it is supported, as my reading of
the latest HTTP draft is that this is a perfectly legal operation...

Please find below a patch to apply to ComLine/src/HTLine.c, which is my
closest attempt at implementing this functionality in the w3c sample program
(which I believe did not implement the '-post -dest' option properly).

Of course, any further help on this topic will be appreciated!

Jean-Jacques.

PS. Sorry for not providing a patch file; I am compiling under Win98/Cygnus!

------------------------------------------------------------
    case METHOD_POST:
 if (formdata) {
     HTParentAnchor * posted = NULL;
#if 1
     posted = HTPostFormAnchor(formfields, (HTAnchor *) cl->anchor,
          cl->request);
     status = posted ? YES : NO;
#else
     /* If we want output to a chunk instead */
     post_result = HTPostFormAnchorToChunk(formfields, (HTAnchor *)
cl->anchor,
        cl->request);
     status = post_result ? YES : NO;
#endif
 } else {
#if 0
     if (SHOW_MSG) HTPrint("Nothing to post to this address\n");
     status = NO;
#else
     FILE * stream;
     char postString[4096];

     char * postDataURL = HTAnchor_address((HTAnchor *) cl->anchor);
     char * tail = strrchr(postDataURL, '/') + 1;
     stream = fopen(tail, "r");
     fread(postString, sizeof(char), 4096, stream);
     fclose(stream);

     HTAnchor_clearHeader(cl->anchor);
     HTAnchor_setDocument(cl->anchor, postString);
     HTAnchor_setLength(cl->anchor, strlen(postString));
     HTAnchor_setFormat(cl->anchor, WWW_RAW);

     HTLink_removeAll((HTAnchor *) cl->anchor);
     HTLink_add((HTAnchor *) cl->anchor, (HTAnchor *) cl->dest,
         NULL, METHOD_POST);

     status = HTPostAnchor(cl->anchor, (HTAnchor *) cl->dest,
          cl->request);

#endif
 }
 break;


Received on Tuesday, 2 March 1999 10:52:32 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:29 GMT