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)
This commit is contained in:
Daniel Stenberg 2007-08-01 12:58:04 +00:00
parent bd100b2a51
commit 006878686c
3 changed files with 23 additions and 10 deletions

View File

@ -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

View 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)

View 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: