cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLOPT_INFILESIZE and padded files

From: Peter Seebach <seebs_at_plethora.net>
Date: Tue, 16 Jan 2007 16:54:47 -0600

In message <Pine.LNX.4.64.0701162329220.10229_at_yvahk3.pbagnpgbe.fr>, Daniel Stenberg writes:
>On Tue, 16 Jan 2007, Peter Seebach wrote:
>> This works, but curl still reports error code 18, even though the uploaded
>> file is precisely the same size as the encoded jpeg data, and appears to be
>> correct.

>libcurl returns 18 if it doesn't upload the same amount of data that you
>initially told it you were gonna send.

Hmm. I've been getting 18 in cases where it DOES upload the amount I asked
for, too... Not sure why, then.

>> Is there some obvious and cheap way to tell curl that the file size I am
>> specifying is not merely a suspicion, but is in fact the amount of data I
>> want uploaded?

>That's what the given size means. You tell libcurl about the size. libcurl
>tells the server about the size to come. Then it transfers the data and you
>deliver that amount of data. Everything is fine and dandy...

>If not, then something is wrong somewhere.

Well, yes. In this case, I have a file which is always padded, and I want
to upload the unpadded portion, so I want to tell curl to upload ONLY the
number of bytes I specify, even if there seems to be more data in the file.

The context is actually a buffer attached with fmemopen(), but in general,
it would seem like it would be handy to have a way to tell curl to stop reading
at a given size regardless of how much more is available in the stdio stream.

-s
Received on 2007-01-17