curl with++ httpss g++, share the already collected library
-
I can't compromise the OpenSSL curl as I need access to https.
Simple code#include <iostream> #include <curl\curl.h> #include <string>
// функция, вызываемая cURL для записи полученных данных
std::string curlBuffer;int main(void)
{
CURL curl;
CURLcode res;
char curlErrorBuffer[CURL_ERROR_SIZE];
curl = curl_easy_init();
if(curl) {
/ First set the URL that is about to receive our POST. This URL can
just as well be a https:// URL if that is what should receive the
data. */
curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, curlErrorBuffer);
curl_easy_setopt(curl, CURLOPT_URL, "https://www.google.co.uk");/* Perform the request, res will get the return code */ res = curl_easy_perform(curl); if(res = CURLE_OK) { std::cout<<"ok\n"; } std::cout<<"error:" << res << " "<<curlErrorBuffer<< "\n"; /* always cleanup */ curl_easy_cleanup(curl);
}
return 0;
}
makes a mistake to the Protocol "https" not supported or disabled in libcurl already under implementation.
He's overcrowded a bunch of infus, said he needs to be compromised with the support of the OpenSSL, but my cmake says he didn't find the OpenSSL module. I'm sure a lot of people have a library under the windows of ten.
Code bloks
The question was resolved by a direct answer from Pak Uula. I don't understand why the comment was the answer. Got him.
Std:cout
The test showed that now there's been a download of the curl website, which I didn't find anymore.ste::cout<<curl_version()<<'\n';
libcurl/7.80.0 OpenSSL/3.0.0 (Schannel) zlib/1.2.11 brotli/1.0.9 zstd/1.5.0 libidn2/2.3.2 libssh2/1.10.0 nghttp2/1.46.0 libgsasl/1.10.0
Yeah, there's a new problem in checking the certificate, but that's another question.
SSL certificate problem: unable to get local issuer certificate
// не проверять сертификат удаленного сервера
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0);
It's bad for my bot to be a telegram that's sending someone to join us who's not critically connected to the server.
The question asked was the truth in the rhetoric.
Thank you all for your help.
-
Windows is the simplest thing to use cmake-gui for libcurl configuration. Predetermine opensl and specify the relevant parameters for configuration:
As a result, the withdrawal is:
curl version=[7.74.0] Enabled features: SSL IPv6 libz AsynchDNS SSPI alt-svc SPNEGO Kerberos NTLM MultiSSL HTTPS-proxy Enabled protocols: DICT FILE FTP FTPS GOPHER HTTP HTTPS IMAP IMAPS LDAP MQTT POP3 POP3S RTSP SMB SMBS SMTP SMTPS TELNET TFTP Enabled SSL backends: OpenSSL Schannel Configuring done
Then you can makefile and collect libcurl with ssl