cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: [PATCH/RFC] Adding Expect: 100-continue if post size is unknown

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Tue, 1 Dec 2009 13:23:52 +0100 (CET)

On Mon, 30 Nov 2009, Martin Storsjö wrote:

> If the size of the post data isn't yet known when starting the HTTP POST
> request (i.e. when using chunked transfer encoding), the variable postsize
> is 0 at line 1480 (in 7.19.7) in lib/http.c. With the current if statement
> at that line, no Expect: 100-continue header is emitted under that
> condition, even if the post data can be potentially huge.
>
> The attached patch is a sample of how this could be fixed, but I'm not
> totally sure if this is the right approach. Would it perhaps be better to
> make a distinction between actual size 0 and size unknown earlier in the
> function?

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.

-- 
  / daniel.haxx.se

-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2009-12-01