curl-library
Re: Uploading huge files using POST without MIME headers
Date: Mon, 17 Aug 2009 16:53:29 +0530
Thanks Daniel, it worked fine.
However, i am facing problem with file size more than 65K.
The server expects the Expect: 100-Continue to be set for files more than
size 65K which the libCurl sets on its own.
The network traffic is going through the proxy.
I am using callback functions to send the file.
Using curl.exe, i am able to post files with size more than 65K, but with
libCurl i am getting the error '502 Proxy Error(Network name no longer
valid)' for files of size more than 65K.
I am using read and write callback functions.I am setting the size of the
data and proxy in this way:
curlcode = ::curl_easy_setopt(m_pCurlEasyHandle, CURLOPT_POSTFIELDSIZE,
(curl_off_t)fileStat.st_size);
curlcode = ::curl_easy_setopt(m_pCurlEasyHandle,
CURLOPT_INFILESIZE_LARGE,(curl_off_t)fileStat.st_size);
curlcode = ::curl_easy_setopt(m_pCurlEasyHandle, CURLOPT_PROXY, "
10.55.2.25:8080");
Any guess why this might be happening wehn curl.exe wroks fine with the same
proxy.
On Mon, Aug 17, 2009 at 1:30 PM, Daniel Stenberg <daniel_at_haxx.se> wrote:
> On Mon, 17 Aug 2009, Rahul Rathi wrote:
>
> I am trying to POST huge files on a server. The server does not allow to
>> do
>> PUT for this.
>>
>> I tried using curl_formadd() for doing this. But the problem with this is
>> it inserts MIME headers and boundaries even if a single file is POSted. Is
>> there any of avoiding these MIME headers.
>>
>> The CURL_POSTFIELDS aceepts a buffer for bindary data. But this is ok for
>> small buffers. When it comes to writing huge files this not useful.
>>
>> Is there any way to POST huge files ? I don't want to do PUT.
>>
>
> curl_formadd() creates a multipart formpost and juding by your comments
> above that's not what you want (as that implies mime headers etc).
>
> And yes, a normal POST can be any size you like. You can use
> CURLOPT_POSTFIELDS or even set CURLOPT_POST only and pass all data using the
> read callback.
>
> --
>
> / daniel.haxx.se
>
Received on 2009-08-17