diff options
author | Daniel Stenberg <daniel@haxx.se> | 2007-08-01 12:58:04 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2007-08-01 12:58:04 +0000 |
commit | 006878686cfd3faa9eca92fc8fe60cb8f8073a59 (patch) | |
tree | 6b12e64e562cf0829627bf4dbb3ce250159b9734 /lib | |
parent | bd100b2a51707fd49943b882aa10258814754f21 (diff) |
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.
(and then I did some minor reformatting of code in lib/http.c)
Diffstat (limited to 'lib')
-rw-r--r-- | lib/http.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/http.c b/lib/http.c index 529889c86..19e7483df 100644 --- a/lib/http.c +++ b/lib/http.c @@ -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: |