cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: LibCurl built with SSL says Unsupported Protocol

From: Dan Fandrich <dan_at_coneharvesters.com>
Date: Wed, 24 Nov 2010 11:59:06 -0800

On Wed, Nov 24, 2010 at 04:51:52AM -0500, Brett wrote:
> I have built LibCurl with openSSL 8 times over the last few days on Windows
> using the Makefiles and the MSVC project files. It has built correctly every
> time, but for some reason it is still not recognizing the HTTPS protocol in my
> application. I am not sure what else I can do, and I have had no luck on
> StackOverflow or the #curl IRC channel.
>
> I used the following code to verify that SSL support was enabled, which it is.
>
> curl_version_info_data *vinfo = curl_version_info( CURLVERSION_NOW );
> if( vinfo->features & CURL_VERSION_SSL )
> {
> Msg("LIBCURL: SSL Support Enabled\n");
> }

I suggest writing a test function that just does a normal HTTPS GET
transaction just to see if your SSL+libcurl installation is working.
Once that is verified, then try getting your full transaction working.

> I am however getting these errors...
> Msg("Socket Error: %s\n", curl_easy_strerror(res)); tells me "Socket Error:
> Unsupported Protocol"
> Msg("Error Buffer: %s\n", errorBuffer); tells me "Failed to get recent socket"

You're not calling curl_easy_perform(), so libcurl never has a chance to
establish a connection.

> Incase it helps, here is my function, although I am under the impression
> something is wrong with LibCurl/OpenSSL.

The code shows that you have a fundamental misunderstanding of how libcurl
works. There's no need to manually generate HTTP headers and data structures
and handle the protocol flow yourself. The general model is to create an
easy handle, set options on the handle (including URL and data callback
functions), then call curl_easy_perform() to perform the transfer.

You should be able to make minor modifications to the example program
docs/examples/post-callback.c to do what you want here.

>>> Dan
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-24