cURL / Mailing Lists / curl-library / Single Mail

curl-library

SSL problem

From: Marek Elsner <marek_at_icom.pl>
Date: Sun, 22 Aug 2004 12:10:25 +0200

Hello,

I would like to send data using POST method via HTTPS.
I have the following source code:

CURL *curl;
curl = curl_easy_init();
if (curl)
{
curl_easy_setopt(curl,CURLOPT_URL,"https://destination_page");
curl_easy_setopt(curl,CURLOPT_POST,1);
curl_easy_setopt(curl,CURLOPT_COOKIEJAR,"my.txt");
curl_easy_setopt(curl,CURLOPT_SSLKEYTYPE,"PEM");
curl_easy_setopt(curl,CURLOPT_SSLCERTTYPE,"PEM");
curl_easy_setopt(curl,CURLOPT_SSLCERT,"certificate.pem");
curl_easy_setopt(curl,CURLOPT_SSLKEY,"privatekey.pem");
}
/...../
int write(void *buffer,size_t size, size_t nmemb, void *stream)
    {
    register int realsize = size * nmemb;
    struct MemoryStruct *mem = (struct MemoryStruct *)stream;
    m = buffer;
    Size = realsize;
    return realsize;
    }

    curl_easy_setopt(curl,CURLOPT_POSTFIELDS,tab);
    curl_easy_setopt(curl,CURLOPT_WRITEFUNCTION,write);
    res = curl_easy_perform(curl);

I suppose it should works, but it doesn't.
Probably there is something wrong with setting curl options, because there
are no packets sending by the program, there aren't also any curl
connection.

thank for help

M

 
Received on 2004-07-18