Index: http.c
===================================================================
RCS file: /usr/aventail/prodroot/appliance/vendor/curl/src/lib/http.c,v
retrieving revision 1.1.1.7
diff -u -w -r1.1.1.7 http.c
--- http.c	2004/03/22 19:37:38	1.1.1.7
+++ http.c	2004/03/26 01:17:06
@@ -18,7 +18,7 @@
  * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  * KIND, either express or implied.
  *
- * $Id: http.c,v 1.1.1.7 2004/03/22 19:37:38 dyouatt Exp $
+ * $Id: http.c,v 1.1.1.3.24.3 2004/03/24 23:32:51 xhu Exp $
  ***************************************************************************/
 
 #include "setup.h"
@@ -93,6 +93,7 @@
 #include "url.h"
 #include "share.h"
 #include "http.h"
 
 #define _MPRINTF_REPLACE /* use our functions only */
 #include <curl/mprintf.h>
@@ -1340,14 +1341,14 @@
 
     if(!req_buffer)
       return CURLE_OUT_OF_MEMORY;
-
+/* AVENTAIL CHANGE: move password to the bottom of the list. */
     /* add the main request stuff */
     result =
       add_bufferf(req_buffer,
                   "%s " /* GET/HEAD/POST/PUT */
                   "%s HTTP/%s\r\n" /* path + HTTP version */
-                  "%s" /* proxyuserpwd */
-                  "%s" /* userpwd */
                   "%s" /* range */
                   "%s" /* user agent */
                   "%s" /* cookie */
@@ -1356,14 +1357,13 @@
                   "%s" /* accept */
                   "%s" /* accept-encoding */
                   "%s" /* referer */
-                  "%s",/* transfer-encoding */
+                  "%s"/* transfer-encoding */
+                  "%s" /* proxyuserpwd */
+                  "%s",/* userpwd */
 
                 request,
                 ppath,
                 httpstring,
-                (conn->bits.httpproxy && conn->allocptr.proxyuserpwd)?
-                conn->allocptr.proxyuserpwd:"",
-                conn->allocptr.userpwd?conn->allocptr.userpwd:"",
                 (conn->bits.use_range && conn->allocptr.rangeline)?
                 conn->allocptr.rangeline:"",
                 (data->set.useragent && *data->set.useragent && conn->allocptr.uagent)?
@@ -1375,7 +1375,10 @@
                 (data->set.encoding && *data->set.encoding && conn->allocptr.accept_encoding)?
                 conn->allocptr.accept_encoding:"", /* 08/28/02 jhrg */
                 (data->change.referer && conn->allocptr.ref)?conn->allocptr.ref:"" /* Referer: <data> <CRLF> */,
-                te
+                te,
+                (conn->bits.httpproxy && conn->allocptr.proxyuserpwd)?
+                conn->allocptr.proxyuserpwd:"",
+                conn->allocptr.userpwd?conn->allocptr.userpwd:""
                 );
 
     if(result)
@@ -1543,15 +1546,29 @@
       }
       break;
 
+     /* AVENTAIL CHANGE: Load Content-Length and 100 Continue after NTLM authenticated. */
     case HTTPREQ_PUT: /* Let's PUT the data to the server! */
-
-      if((data->set.infilesize>0) && !conn->bits.upload_chunky)
+    {
+     bool header_load = FALSE;
+     if((data->state.authwant == CURLAUTH_NONE) ||
+           (data->state.authwant == CURLAUTH_BASIC) ||
+           (strncmp(request,"POST",4)))
+      {
+              header_load = TRUE;
+      }
+      else if(authdone)
+      {
+           header_load = TRUE;
+      }
+      if( (header_load) && (data->set.infilesize>0) && !conn->bits.upload_chunky)
         /* only add Content-Length if not uploading chunked */
         add_bufferf(req_buffer,
                     "Content-Length: %" FORMAT_OFF_T "\r\n", /* size */
                     data->set.infilesize );
 
-      if(!checkheaders(data, "Expect:")) {
+      if(authdone && !checkheaders(data, "Expect:")) {
         /* if not disabled explicitly we add a Expect: 100-continue
            to the headers which actually speeds up post operations (as
            there is one packet coming back from the web server) */
@@ -1579,7 +1596,7 @@
       if(result)
         return result;
       break;
-
+    }
     case HTTPREQ_POST:
       /* this is the simple POST, using x-www-form-urlencoded style */
 
