curl-library
Re: overriding automatic Expect: 100-continue behavior
From: Andrew Biggs <adb_at_cisco.com>
Date: Tue, 08 Aug 2006 17:52:42 -0600
Should the lines on 2200 and 2204 be
Daniel Stenberg wrote:
Received on 2006-08-09
Date: Tue, 08 Aug 2006 17:52:42 -0600
Should the lines on 2200 and 2204 be
data->state.expect100headeror
data->set.expect100header?
Daniel Stenberg wrote:
On Tue, 8 Aug 2006, Andrew Biggs wrote:
At the moment I'm just relying on the output from having set
CURLOPT_VERBOSE, but I could set up Ethereal and confirm if you think
Would you be able to check if the attached patch makes it work more in the way you'd expect it?
Index: lib/http.c =================================================================== RCS file: /cvsroot/curl/curl/lib/http.c,v retrieving revision 1.288 diff -u -r1.288 http.c --- lib/http.c 8 Aug 2006 21:12:50 -0000 1.288 +++ lib/http.c 8 Aug 2006 23:17:13 -0000 @@ -2247,18 +2247,29 @@ return result; } + if(data->set.postfields) { - if((data->state.authhost.done || data->state.authproxy.done ) - && (postsize < MAX_INITIAL_POST_SIZE)) { - /* If we're not done with the authentication phase, we don't expect - to actually send off any data yet. Hence, we delay the sending of - the body until we receive that friendly 100-continue response */ - - /* The post data is less than MAX_INITIAL_PORT_SIZE, then append it - to the header. This limit is no magic limit but only set to - prevent really huge POSTs to get the data duplicated with - malloc() and family. */ + if(postsize > TINY_INITIAL_POST_SIZE) { + result = expect100(data, req_buffer); + if(result) + return result; + } + else + data->state.expect100header = FALSE; + + if(((data->state.authhost.done && data->state.authproxy.done ) || + (postsize < TINY_INITIAL_POST_SIZE) || + !data->state.expect100header) && + postsize < MAX_INITIAL_POST_SIZE) { + /* [ If we're done with the authentication phase or + if the postsize is tiny or + we don't expect:-100 ] AND + postsize is less than MAX_INITIAL_POST_SIZE + + then append the post data to the HTTP request header. This limit + is no magic limit but only set to prevent really huge POSTs to + get the data duplicated with malloc() and family. */ result = add_buffer(req_buffer, "\r\n", 2); /* end of headers! */ if(result) @@ -2297,18 +2308,10 @@ /* set the upload size to the progress meter */ Curl_pgrsSetUploadSize(data, http->postsize); - result = expect100(data, req_buffer); - if(result) - return result; - add_buffer(req_buffer, "\r\n", 2); /* end of headers! */ } } else { - result = expect100(data, req_buffer); - if(result) - return result; - add_buffer(req_buffer, "\r\n", 2); /* end of headers! */ if(data->set.postfieldsize) { Index: lib/http.h =================================================================== RCS file: /cvsroot/curl/curl/lib/http.h,v retrieving revision 1.30 diff -u -r1.30 http.h --- lib/http.h 10 Apr 2006 15:00:54 -0000 1.30 +++ lib/http.h 8 Aug 2006 23:17:13 -0000 @@ -74,7 +74,11 @@ It must not be greater than 64K to work on VMS. */ #ifndef MAX_INITIAL_POST_SIZE -#define MAX_INITIAL_POST_SIZE 1024 +#define MAX_INITIAL_POST_SIZE (64*1024) +#endif + +#ifndef TINY_INITIAL_POST_SIZE +#define TINY_INITIAL_POST_SIZE 1024 #endif #endif
Received on 2006-08-09