0
我想通过libcurl进行HTTPS调用。 cURL和OpenSSL都是从源代码构建的。HTTPS不受支持,但启用了OpenSSL?
我用/configure --enable-shared=no --with-zlib=/usr/local --with-ssl=/usr/local/ssl
配置了cURL。当我建立支持SSL的卷曲,还给我:
然而,当我尝试执行的libcurl代码是下面:
CURL *curl;
CURLcode res;
curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init();
if (curl) {
CurlResponse = "";
host = "https://host.com";
curl_easy_setopt(curl, CURLOPT_URL, (host).c_str());
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1);
curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "Type=Initialize");
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, LibcurlResponse);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &CurlResponse);
res = curl_easy_perform(curl);
if (res != CURLE_OK) {
LibcurlError(curl_easy_strerror(res), host);
}
curl_easy_cleanup(curl);
}
curl_global_cleanup();
我得到的错误(从详细模式):
* Protocol https not supported or disabled in libcurl
* Unsupported protocol
Libcurl error: Unsupported protocol
所以,我怎样才能使一个SSL请求我的HTTPS服务器....
谢谢您的回答
BTW MinGW的代码块设置:)
嗨,你有什么参考使用curl configure行?我想这是:./configure --enable-shared = no --with-zlib =/usr/local --with-ssl =/usr/local –
本地OpenSSL版本通常位于'/ usr/local/ssl '。你能确认你实际配置并安装在'/ usr/local'而不是默认的'/ usr/local/ssl'吗? – jww
我的不好,我打算输入local/ssl –