On Tue, 1 Dec 2009, Daniel Stenberg wrote:
> I think I agree with you that appending the header is a good idea for the case
> when we don't know the size at all, but we must make a better distinction
> between unknown and zero since the suggested patch will lead to badness
> otherwise (visualized by the failure of test 175 to start with).
>
> We use the specific case size 0 in a few circumstances for the first request
> in a multi-pass authentication (when we know the request won't be accepted but
> we expect a challenge response) and when we send zero bytes there's really no
> point in an Expect: header.
That's what I expected. Would this be a better solution, by setting it to
-1 if it's unknown? (This is completely untested, but it's easier to show
what I'm trying to say using a patch instead of trying to describe it
verbally.)
// Martin
Index: http.c
===================================================================
RCS file: /cvsroot/curl/curl/lib/http.c,v
retrieving revision 1.429
diff -u -r1.429 http.c
--- http.c 1 Dec 2009 12:04:55 -0000 1.429
+++ http.c 1 Dec 2009 12:53:55 -0000
@@ -2815,7 +2815,7 @@
/* figure out the size of the postfields */
postsize = (data->set.postfieldsize != -1)?
data->set.postfieldsize:
- (data->set.postfields? (curl_off_t)strlen(data->set.postfields):0);
+ (data->set.postfields? (curl_off_t)strlen(data->set.postfields):-1);
}
if(!data->req.upload_chunky) {
/* We only set Content-Length and allow a custom Content-Length if
@@ -2849,7 +2849,7 @@
data->state.expect100header =
Curl_compareheader(ptr, "Expect:", "100-continue");
}
- else if(postsize > TINY_INITIAL_POST_SIZE) {
+ else if(postsize > TINY_INITIAL_POST_SIZE || postsize < 0) {
result = expect100(data, conn, req_buffer);
if(result)
return result;
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html