]> granicus.if.org Git - curl/commitdiff
Greg Morse reported a problem with POSTing using ANYAUTH to a server requiring
authorDaniel Stenberg <daniel@haxx.se>
Wed, 1 Aug 2007 12:58:04 +0000 (12:58 +0000)
committerDaniel Stenberg <daniel@haxx.se>
Wed, 1 Aug 2007 12:58:04 +0000 (12:58 +0000)
NTLM, and he provided test code and a test server and we worked out a bug
fix. We failed to count sent body data at times, which then caused internal
confusions when libcurl tried to send the rest of the data in order to
maintain the same connection alive.

(and then I did some minor reformatting of code in lib/http.c)

CHANGES
RELEASE-NOTES
lib/http.c

diff --git a/CHANGES b/CHANGES
index f99ce348a906f086d0a8c35b3b5c53d8523c09da..a245e7d0996aa2df0b1f5cbaf8594abca9fae484 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -6,6 +6,13 @@
 
                                   Changelog
 
+Daniel S (1 August 2007)
+- Greg Morse reported a problem with POSTing using ANYAUTH to a server
+  requiring NTLM, and he provided test code and a test server and we worked
+  out a bug fix. We failed to count sent body data at times, which then caused
+  internal confusions when libcurl tried to send the rest of the data in order
+  to maintain the same connection alive.
+
 Daniel S (31 July 2007)
 - Peter O'Gorman pointed out (and fixed) that the non-blocking check in
   configure made libcurl use blocking sockets on AIX 4 and 5, while that
index 2e865fb9b083642eb861ee6d7ca77461350af7f7..5e64b764c14e9f0ca6c99a11cf1bc9023603ad82 100644 (file)
@@ -30,6 +30,7 @@ This release includes the following bugfixes:
  o HTTP Digest auth on a re-used connection
  o FTPS data connection close
  o AIX 4 and 5 get to use non-blocking sockets
+ o small POST with NTLM
 
 This release includes the following known bugs:
 
@@ -51,6 +52,6 @@ advice from friends like these:
  Dan Fandrich, Song Ma, Daniel Black, Giancarlo Formicuccia, Shmulik Regev,
  Daniel Cater, Colin Hogben, Jofell Gallardo, Daniel Johnson,
  Ralf S. Engelschall, James Housley, Chris Flerackers, Patrick Monnerat,
- Jayesh A Shah, Greg Zavertnik, Peter O'Gorman
+ Jayesh A Shah, Greg Zavertnik, Peter O'Gorman, Greg Morse
  
         Thanks! (and sorry if I forgot to mention someone)
index 529889c8624e9ee8dd65c64fe2e5a666b871bd50..19e7483dff993f55614d3d47b0c5f8154763c695 100644 (file)
@@ -853,10 +853,10 @@ send_buffer *add_buffer_init(void)
 static
 CURLcode add_buffer_send(send_buffer *in,
                          struct connectdata *conn,
-                         long *bytes_written, /* add the number of sent
-                                                 bytes to this counter */
+                         long *bytes_written, /* add the number of sent bytes
+                                                 to this counter */
                          size_t included_body_bytes, /* how much of the buffer
-                                        contains body data (for log tracing) */
+                                                        contains body data */
                          int socketindex)
 
 {
@@ -921,10 +921,14 @@ CURLcode add_buffer_send(send_buffer *in,
       /* this data _may_ contain binary stuff */
       Curl_debug(conn->data, CURLINFO_HEADER_OUT, ptr,
                  (size_t)(amount-included_body_bytes), conn);
-      if (included_body_bytes)
+      if (included_body_bytes) {
         Curl_debug(conn->data, CURLINFO_DATA_OUT,
                    ptr+amount-included_body_bytes,
                    (size_t)included_body_bytes, conn);
+        /* since we sent a piece of the body here, up the byte counter for it
+           accordingly */
+        http->writebytecount = included_body_bytes;
+      }
     }
 
     *bytes_written += amount;
@@ -2038,7 +2042,8 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
       /* if a line like this was already allocated, free the previous one */
       if(conn->allocptr.rangeline)
         free(conn->allocptr.rangeline);
-      conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n", data->reqdata.range);
+      conn->allocptr.rangeline = aprintf("Range: bytes=%s\r\n",
+                                         data->reqdata.range);
     }
     else if((httpreq != HTTPREQ_GET) &&
             !checkheaders(data, "Content-Range:")) {
@@ -2418,7 +2423,7 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
 
         if(!data->state.expect100header &&
            (postsize < MAX_INITIAL_POST_SIZE))  {
-          /* if we don't use expect:-100  AND
+          /* if we don't use expect: 100  AND
              postsize is less than MAX_INITIAL_POST_SIZE
 
              then append the post data to the HTTP request header. This limit
@@ -2492,9 +2497,9 @@ CURLcode Curl_http(struct connectdata *conn, bool *done)
       else
         result =
           Curl_setup_transfer(conn, FIRSTSOCKET, -1, TRUE,
-                        &http->readbytecount,
-                        http->postdata?FIRSTSOCKET:-1,
-                        http->postdata?&http->writebytecount:NULL);
+                              &http->readbytecount,
+                              http->postdata?FIRSTSOCKET:-1,
+                              http->postdata?&http->writebytecount:NULL);
       break;
 
     default: