curl-library
LibCurl built with SSL says Unsupported Protocol
Date: Wed, 24 Nov 2010 04:51:52 -0500
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 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"
Incase it helps, here is my function, although I am under the impression
something is wrong with LibCurl/OpenSSL.
void SteamInvite::InviteToGroup(const char *szUserSteamID)
{
CURL *curl;
CURLcode res;
int sockfd; // Socket
size_t iolen;
char errorBuffer[CURL_ERROR_SIZE];
const int idSize = 64;
char *szUserID = new char[idSize];
char *szInviterID = new char[idSize];
char *szGroupID = new char[idSize];
_i64toa(GetCommunityID(szUserSteamID), szUserID, 10);
_i64toa(GetCommunityID(g_CvarSteamID.GetString()), szInviterID, 10);
GetGroupCommunityID(g_CvarSteamGroupID.GetInt(), szGroupID,
idSize); // Group Steam Community ID
const char *szCookie = g_CvarSteamCookie.GetString(); // Steam
Community Login Cookie
char *buffer = new char[1024];
/* Create the GET request */
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "GET
/actions/GroupInvite?type=groupInvite&inviter=");
snprintf(buffer, strlen(buffer), "%s&invitee=%s&group=%s ",
szInviterID, szUserID, szGroupID);
headers = curl_slist_append(headers, buffer);
headers = curl_slist_append(headers, "HTTP/1.1\r\nHost:
steamcommunity.com\r\nConnection: close\r\nCookie: ");
snprintf(buffer, strlen(buffer), "steamLogin=%s\r\n\r\n", szCookie);
headers = curl_slist_append(headers, buffer);
delete buffer;
/* Init CURL */
curl = curl_easy_init();
if(curl)
{
curl_easy_setopt(curl, CURLOPT_URL,
"https://www.steamcommunity.com");
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1); // Incase
server redirects after authentication
curl_easy_setopt(curl, CURLOPT_CONNECT_ONLY, 1); // No
transfer, just extract the socket
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errorBuffer);
//curl_easy_setopt(curl, CURLOPT_USERAGENT, void*); // Setup a
simple user agent so it won't get thrown out
// POST Login Information
char *userpass = new char[idSize];
snprintf(userpass, strlen(userpass), "userId=%s&password=%s",
g_CvarSteamUsername.GetString(), g_CvarSteamPassword.GetString());
curl_easy_setopt(curl, CURLOPT_POST, 1); // Switch to POST mode
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, userpass); // Set
the POST fields
res = curl_easy_getinfo(curl, CURLINFO_LASTSOCKET, &sockfd);
if(res != CURLE_OK)
{
Msg("Socket Error: %s\n", curl_easy_strerror(res));
Msg("Error Buffer: %s\n", errorBuffer);
return;
}
/* wait for the socket to become ready for sending */
if(!wait_on_socket(sockfd, 0, 60000L))
{
Msg("Socket Error: timeout.\n");
return;
}
Msg("Sending Request.\n");
res = curl_easy_send(curl, headers->data,
strlen(headers->data), &iolen);
if(res != CURLE_OK)
{
Msg("Socket Error: %s\n", curl_easy_strerror(res));
Msg("Error Buffer: %s\n", errorBuffer);
return;
}
Msg("Reading Response.\n");
for(;;)
{
char buf[1024];
wait_on_socket(sockfd, 1, 60000L);
res = curl_easy_recv(curl, buf, 1024, &iolen);
if(CURLE_OK != res)
break;
Msg("Received %u bytes.\n", iolen);
}
// Close the connection
curl_easy_cleanup(curl);
}
}
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2010-11-24