【发布时间】:2022-03-03 16:46:01
【问题描述】:
当我运行curl -V 时,我的输出是这样的
curl 7.82.0-DEV (x86_64-pc-win32) libcurl/7.82.0-DEV OpenSSL/1.1.1m WinIDN
Release-Date: [unreleased]
Protocols: dict file ftp ftps gopher gophers http https imap imaps ldap ldaps mqtt pop3 pop3s rtsp smb smbs smtp smtps telnet tftp
Features: AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI UnixSockets alt-svc
显然有Https。当我通过 c++ 使用它时,使用curl_version_info_data
curl_version_info_data* ver = curl_version_info(CURLVERSION_NOW);
for (int i = 0; i < 14; ++i) {
cout << ver->protocols[i] << endl;
}
列出的支持的协议是
dict
file
ftp
gopher
http
imap
ldap
mqtt
pop3
rtsp
smb
smtp
telnet
tftp
如果我尝试使用 https,则会收到错误 Unsupported protocol。有人有什么想法吗?
【问题讨论】:
-
取另一个 libcurl。
-
你是如何编译和链接的? OpenSSL 肯定是由一个单独的库提供的。因此,如果未激活 OpenSSL,libcurl 可能会丢弃 ftps、https 等。仅供参考:Building libcurl with SSL support on Windows 或 google "libcurl openssl" 你自己。
-
@Scheff'sCat 下载 OpenSSL 作为二进制文件并安装,使用 WITH_DEVEL 链接。但是我很困惑,使用 WINSSL 的构建也说 https 可用但它不可用?
-
请显示失败代码的minimal reproducible example。为什么只打印 14 个协议? curl 命令行是否使用与您的应用程序相同的 libcurl?