cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: CURLINFO_LASTSOCKET always return -1 with Https url (libcurl 7.15.4, openssl-0.9.8b)

From: Ratna Gudlavalleti <ratna_at_netenrich.com>
Date: Fri, 07 Jul 2006 11:46:19 -0700

Hi Ralph Mitchell

Thank you for pointing out the SSL Certificates verification

After setting the following curl easy options it returns the socket id

        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
        curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);

-Ratna

Ralph Mitchell wrote:
> Have you tried command-line curl to verify what happens?? Here's what
> I get, among other output:
>
> * SSL: certificate subject name 'login.yahoo.com' does not match
> target host name 'mail.yahoo.com'
>
> Yahoo have used the same secure certificate for two different
> hostnames...
>
> I think you need to set CURLOPT_SSL_VERIFYHOST.
>
> Ralph Mitchell
>
>
> On 7/7/06, Ratna Gudlavalleti <ratna_at_netenrich.com> wrote:
>> I am trying to use the CURLINFO_LASTSOCKET for getting the last socket
>>
>> This code is working fine if I use the http://mail.yahoo.com (HTTP
>> Server)
>> Once I start using the https://mail.yahoo.com (Https Server) it always
>> returns -1
>>
>> Am I missing something here !
>>
>> Thanks
>> Ratna Gudlavalleti
>>
>> #include <fcntl.h>
>> #include <io.h>
>> #include <curl/curl.h>
>>
>> int main(void) {
>> CURL *curl;
>> CURLcode res;
>> long last_sock=0;
>>
>> curl = curl_easy_init();
>> if(curl) {
>> curl_easy_setopt(curl, CURLOPT_URL, "https://mail.yahoo.com/");
>> curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1);
>>
>> res = curl_easy_perform(curl);
>> res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &last_sock);
>> printf("Return code frm curl_easy_getinfo [%d][%s]\n", res,
>> curl_easy_strerror(res));
>> printf("curl_easy_getinfo returned CURLINFO_LASTSOCKET [%ld]\n",
>> last_sock);
>>
>> if(CURLE_OK == res) {
>> printf("curl_easy_getinfo returned CURLINFO_LASTSOCKET
>> [%ld]\n", last_sock);
>> }
>>
>> /* always cleanup */
>> curl_easy_cleanup(curl);
>> }
>> return 0;
>> }
>>
Received on 2006-07-07