cURL / Mailing Lists / curl-library / Single Mail

curl-library

Cost behind setting of SSL options on libcurl handle again and again.

From: Shivanand <centrio_at_gmail.com>
Date: Wed, 7 Apr 2010 15:55:41 +0530

Hi,
I am having an application that uses libcurl multi handle to perform
simple HTTP transfer. It downloads data from Http server using HTTP
GET.

I want to extend the classes in my application to use HTTPS. I have a
handler class that wraps up libcurl API's. There are two methods
Connect and GetData.

In Connect I establish connection with the server and download the
HTTP headers. I stop once I get first callback for Data.

In GetData I keep pulling data from the server till the transfer is complete.

To extend the class for SSL transfer, I am thinking of initializing
SSL options in Connect method it self. This will result in setting of
SSL options again and again for each Connection. Is this a costly task
(costly in terms of socket handling and resource open/close) of
setting the SSL options or is it light weight thing?

I will be setting following options on libcurl handle.

 sessionData->curlEasyStatusCode = curl_easy_setopt(sessionData->curlEasyHandle,

CURLOPT_SSLCERTTYPE, "PEM");

 sessionData->curlEasyStatusCode = curl_easy_setopt(sessionData->curlEasyHandle,

CURLOPT_SSL_VERIFYPEER, 1L);

 sessionData->curlEasyStatusCode = curl_easy_setopt(sessionData->curlEasyHandle,

CURLOPT_SSL_VERIFYHOST, 0L);

 sessionData->curlEasyStatusCode = curl_easy_setopt(sessionData->curlEasyHandle,

CURLOPT_SSL_CTX_FUNCTION,
                                                       *sslctx_function);

Please let me know the issues that could be costly if I follow this method.

Best Regards
Shivanand
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-04-07