cURL / Mailing Lists / curl-library / Single Mail

curl-library

Issue with curl_multi + SSL connection

From: Raghavendra Prasad Bilamkar <Raghavendra.Bilamkar_at_tridentmicro.com>
Date: Wed, 14 Jul 2010 16:37:23 +0200

Hi All,

I am not able to make a curl_multi + SSL connection, but he same works with curl_easy.
Here is he code snippet.....

Open()
{
      .....
       curl_easy_setopt(file->handle.curl, CURLOPT_URL, url);
       curl_easy_setopt(file->handle.curl, CURLOPT_WRITEDATA, file);
       curl_easy_setopt(file->handle.curl, CURLOPT_VERBOSE, 1L);
       curl_easy_setopt(file->handle.curl, CURLOPT_WRITEFUNCTION, write_callback);

       curl_easy_setopt(file->handle.curl,CURLOPT_SSLCERTTYPE,"PEM");
       curl_easy_setopt(file->handle.curl,CURLOPT_SSLCERT,"Path to Cert");

       curl_easy_setopt(file->handle.curl,CURLOPT_SSLKEYTYPE,"PEM");
       curl_easy_setopt(file->handle.curl,CURLOPT_SSLKEY," Path to Cert ");

       if(!multi_handle)
            multi_handle = curl_multi_init();

       curl_multi_add_handle(multi_handle, file->handle.curl);

       do
      {
                res = curl_multi_perform(multi_handle, &file->still_running);
       }while(res == CURLM_CALL_MULTI_PERFORM );

}

read( )
{
                .....
                curl_multi_fdset(multi_handle, &fdread, &fdwrite, &fdexcep, &maxfd);
                rc = select(maxfd+1, &fdread, &fdwrite, &fdexcep, &timeout);

      switch(rc) {
        case -1:
            /* select error */
            break;

        case 0:
            break;

        default:
            /* timeout or readable/writable sockets */
            /* note we *could* be more efficient and not wait for
             * CURLM_CALL_MULTI_PERFORM to clear here and check it on re-entry
             * but that gets messy */
            while(curl_multi_perform(multi_handle, &file->still_running) ==
                  CURLM_CALL_MULTI_PERFORM);

            break;
        }
    } while(file->still_running && (file->buffer_pos < want));
}

Following output is seen.....

* About to connect() to proxy 92.120.XX.XX port 3128 (#0)
* Trying 92.120.XX.XX...
* Establish HTTP proxy tunnel to "some sever here"
* Proxy auth using Basic with user 'XXXXXXXX'
> CONNECT some sever here HTTP/1.1
Host: some server here
Proxy-Authorization: Basic VFJJRC1FVVxyYmlsYW1rYToxMndlbGNvbWU/
Proxy-Connection: Keep-Alive

< HTTP/1.0 200 Connection established
<
* Proxy replied OK to CONNECT request
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
  CApath: none
* Expire cleared
* SSL connection using RC4-MD5

After this, I don't see any action from CURL. The next print that I expect is ( as seen with curl_easy )
* Server certificate:
* subject: XXXXXXXXXXXXX
* start date: 2009-11-25 00:00:00 GMT
* expire date: 2011-12-07 23:59:59 GMT
* common name: XXXXX
* issuer: XXXX
* SSL certificate verify ok.

Please let me know why curl_multi + SSL is not working.

Regards
Raghu

_____________________________________________________________________
B Raghavendra Prasad
Technical Leader
BL-DTV

Trident Microsystems India Pvt. Ltd.
Manyatha Tech Park
Nagawara Vilage, Kasaba Hobli
Bangalore 560 045

Direct +91-80-4024 8107
Fax +91-80-4024 7095

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