cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: Sending Large files via CURLOPT_HTTPPOST ?

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 26 Jun 2002 09:13:12 +0200 (MET DST)

On Tue, 25 Jun 2002, Jeff Anderson wrote:

> Hi all. Sorry if this is a newbie problem but:

I don't think it is.

> I am using Curllib (7.9.7 on Win32 from C++) to post binary files via HTTP.
> It works great for any file up to a certain size (haven't spent the time to
> narrow it down exactly). But a file of 1,691,648 posted fine, and a file
> of 3,059,712 bytes fails with error code 55 (CURLE_SEND_ERROR).

Does the receiving end output anything back?

> I know that my serverside code can take the large files, so I assume this
> is some sort of buffer overrun. I am using the POSTEDFILESIZE option, but
> it doesn't make any difference.

POSTEDFILESIZE isn't making any difference when you're doing a multipart
formpost.

> Can anyone help me? Thank you very much and please excuse the newbie
> question. My code is below:

> /* Add simple file section */
> curl_formadd(&post, &last, CURLFORM_COPYNAME, "MyFile",
> CURLFORM_FILE, LocalFile, CURLFORM_END);
>
> /* Add file/contenttype section */
> curl_formadd(&post, &last, CURLFORM_COPYNAME, "MyFile",
> CURLFORM_FILE, LocalFile,
> CURLFORM_CONTENTTYPE, "application/binary",
> CURLFORM_END);

This appends the same file, twice. Using the same name of the part
("MyFile"). If all you want is to send the file once using your custom
content-type, then the second curl_formadd() invoke is the only one you need.

libcurl doesn't consider this an error though but will try to do what you
wish, and I can't tell why it fails sending this.

I don't think this is a buffer problem as the error CURLE_SEND_ERROR is
returned in lib/sendf.c:270 (almost uniquely) and it does this when send()
actually returned a failure (that wasn't due to EWOULDBLOCK).

-- 
    Daniel Stenberg -- I'll be away for a month, starting tomorrow
-------------------------------------------------------
This sf.net email is sponsored by: Jabber Inc.
Don't miss the IM event of the season | Special offer for OSDN members! 
JabConf 2002, Aug. 20-22, Keystone, CO http://www.jabberconf.com/osdn
Received on 2002-06-26