cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: socket error with NTLM auth proxy and multi interface

From: Pingzhong Li <PLi_at_fiberlink.com>
Date: Fri, 28 Oct 2011 11:51:58 -0400

>>>Dan Fandrich Sent: Tuesday, October 25, 2011 12:24 PM
>>ar is part of the compiler suite; if you're able to compile with gcc from the Cygwin command-line, you should already have ar. If not, then the GNU version is often in a package called binutils.

Thanks a lot, Dan, without your info, I probably won't be able to find the right package.

I downloaded the binutils and now I am able to build the curl with Cygwin. So I run the tests without my changes (make test), all tests passed except 504 tests which is a multi interface tests. I didn't built with SSL, however I think that it should not matter at this case.

Here is part of log at Cygwin window for this test which I just run that test alone by using runtests.pl
===================
* starts no server
test 504...[simple multi through local proxy without listener]
./libtest/lib504 http://127.0.0.1:8991/504 127.0.0.1:55555 >log/stdout504 2>log/
stderr504

lib504 returned 99, 100 was expected
 exit FAILED
====================

Then I applied my changes to the http.c file method http_perhapsrewind line:
conn->bits.rewindaftersend = TRUE;

=========================
  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) ||
       (data->state.authproxy.picked == CURLAUTH_NTLM_WB) ||
       (data->state.authhost.picked == CURLAUTH_NTLM_WB)) {
      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! */
        if(!conn->bits.authneg) {
                        //From Pingzhong: I just comment out the original code and
                        //added a check and it will only rewind if it is an easy interface
                        if(Curl_if_multi != data->state.used_interface)
                        {
                                conn->bits.rewindaftersend = TRUE;
                                infof(data, "Rewind stream after send\n");
                        }
                        //conn->bits.rewindaftersend = TRUE;

        }

        return CURLE_OK;
      }
      if(conn->bits.close)
        /* 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));
    }

==============================================
With this change, actually all the tests passed except 504 which would be same as before my change.

I am sure that code is there for a reason. So is my change ok here? I don't really understand the logic here. Maybe it would be needed on other platform than Windows?

Thanks,
Pingzhong

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: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2011-10-28