cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: POST with digest authentication

From: D H <dhjunkuse_at_hotmail.com>
Date: Fri, 19 Nov 2004 05:04:56 +0000

I looked through the code some more, in http.c, I commented out this piece
of code in Curl_http()

if((!data->state.authhost.done || !data->state.authproxy.done ) &&
     (httpreq != HTTPREQ_GET)) {
    /* Until we are authenticated, we switch over to HEAD. Unless its a GET
       we want to do. The explanation for this is rather long and boring,
but
       the point is that it can't be done otherwise without risking having
to
       send the POST or PUT data multiple times. */
   /* XXX
     httpreq = HTTPREQ_HEAD;
     request = (char *)"HEAD";
     conn->bits.no_body = TRUE;
    */
    conn->bits.authprobe = TRUE; /* this is a request done to probe for
                                    authentication methods */
  }

The client now seems to work. It does wastefully post data twice (as
mentioned in the comment), but otherwise it seems to work fine for my needs.

One thing I noticed was that the callback WRITEFUNCTION prints the server
response from both attempts at POST. Not sure if this would have happened
if first request had been HEAD and the second POST.

Thanks,
Dh

>From: "D H" <dhjunkuse_at_hotmail.com>
>Reply-To: libcurl development <curl-library_at_cool.haxx.se>
>To: curl-library_at_cool.haxx.se
>Subject: POST with digest authentication
>Date: Fri, 19 Nov 2004 01:19:35 +0000
>
>I am trying to use libcurl to write a client that needs to talk to a
>limited HTTP server interface. This server interface returns an empty
>response (and connection is terminated) when it gets a HEAD request.
>
>I am using digest authentication and trying to make a POST request with
>some data (POSTFIELDS). Curl inevitably sends a HEAD request when I do this
>(and hence I get an empty response from the server). If I use basic
>authentication, then curl does not seem to make the HEAD request.
>
>Questions:
>
>1) Is there anyway of making libcurl do the POST request without making the
>head request (for digest authentication)? THe server would also accept GET
>request with some data,
>
>2) If not, would it be messy to attempt to change curl code (in my
>implementation) to not send a HEAD request? Any pointers on which source
>files to look at would be much appreciated.
>
>Thanks,
>Dh
>
>_________________________________________________________________
>Express yourself instantly with MSN Messenger! Download today - it's FREE!
>http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now!
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
Received on 2004-11-19