cURL / Mailing Lists / curl-library / Single Mail


Re: socket error with NTLM auth proxy and multi interface

From: Pingzhong Li <>
Date: Thu, 6 Oct 2011 17:12:52 -0400

somehow I didn't receive the email for reply to my post, I got a daily digest. I just changed my subscription options and hope that I would get an email for each post so I could reply on.
If this email goes to wrong position on the email archive, please forgive me. I also didn't find a web interface to reply to.

Here is my answer to the question:

> Is this perhaps because maxfd is -1 when it is returned from
curl_multi_fdset() ?

Actually it returns some value greater than 1000 and I think that it is correct value.
Actually we also have code to do http thru libcurl by using easy interface which works on NTLM auth proxy, by comparing those 2, I found out that problem is this code at method Curl_http_perhapsrewind:
  if((expectsend == -1) || (expectsend > bytessent)) {
    /* There is still data left to send */
    if((data->state.authproxy.picked == CURLAUTH_NTLM) ||
       (data->state.authhost.picked == CURLAUTH_NTLM)) {
      if(((expectsend - bytessent) < 2000) ||
         (conn->ntlm.state != NTLMSTATE_NONE)) {
        /* The NTLM-negotiation has started *OR* there is just a little (<2K)
           data left to send, keep on sending. */

        /* rewind data when completely done sending! */
          conn->bits.rewindaftersend = TRUE;

        return CURLE_OK;
        /* this is already marked to get closed */
        return CURLE_OK;

      infof(data, "NTLM send, close instead of sending %" FORMAT_OFF_T
            " bytes\n", (curl_off_t)(expectsend - bytessent));

The line where conn->bits.rewindaftersend is set as true. At the code which only uses easy interface, this code won't be hit. However for code which uses both easy and multi interface (although it only has one easy interface inside) would hit this code. If I just change that line to like this to never let rewind happen:
conn->bits.rewindaftersend = FALSE;
My code would work without any socket error and iStillRunning got from curl_multi_perform would be correct as well.

Any suggestion how we could avoid to let it rewind? Why do we need to rewind here?


Fiberlink Disclaimer: The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.

List admin:
Received on 2011-10-06