cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: posting binary data

From: Sigrid Thijs <sigrid.thijs_at_androme.com>
Date: Tue, 06 Mar 2007 10:02:58 +0100

Sigrid Thijs wrote:
> Hi,
>
> since we upgraded our client to libcurl version 7.16.0 (win32) we
> experience problems while posting a request with binary data.
>
>
> The following curl options are set:
>
> curl_easy_setopt ( pCURL, CURLOPT_PRIVATE, (void *)pUpload );
> curl_easy_setopt ( pCURL, CURLOPT_URL, remotePathName.c_str () );

If we replace this code:

> curl_easy_setopt ( pCURL, CURLOPT_POST, 1 );
> curl_easy_setopt ( pCURL, CURLOPT_READDATA, pFile );

by this:

char * pbuffer = new char[fileSize];
fread ( pbuffer, 1, fileSize, pFile );
curl_easy_setopt ( pCURL, CURLOPT_POSTFIELDS, pbuffer );

it works like before. Aren't these methods supposed to be equivalent?

kind regards,

Sigrid

> curl_easy_setopt ( pCURL, CURLOPT_POSTFIELDSIZE, fileSize );
> curl_easy_setopt ( pCURL, CURLOPT_HTTPAUTH, CURLAUTH_DIGEST );
> curl_easy_setopt ( pCURL, CURLOPT_USERPWD, login.c_str () );
> curl_easy_setopt ( pCURL, CURLOPT_CAPATH, certificateDirectory );
>
> pCURLList = curl_slist_append ( pCURLList, "Content-Type: image/png" );
> curl_easy_setopt ( pCURL, CURLOPT_HTTPHEADER, pCURLList );
>
>
> kind regards,
>
> Sigrid
>
>
Received on 2007-03-06