问题描述
我在具有cargo.toml设置的Windows上构建:
[dependencies]
curl = {version="0.4.33",features = ["ssl"]}
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Error
{ description: "A requested feature,protocol or option was not found built-in in this libcurl
due to a build-time decision.",code: 4,extra: None }'
如何为curl Rust板条箱启用NTLM支持?
解决方法
rust curl crate将尝试链接到系统上现有的curl库,如果它可以找到的话。在这种情况下,您将只能使用已编译到该现有curl库中的功能。
根据您遇到的错误,我认为编译curl库时未启用NTLM。您可以使用-V
选项运行curl cli progam(通常链接到库)来进行检查:
$ curl -V
curl 7.43.0 (x86_64-redhat-linux-gnu) libcurl/7.43.0 NSS/3.19.1 Basic ECC zlib/1.2.7 libidn/1.28 libssh2/1.8.0
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: AsynchDNS IDN IPv6 Largefile GSS-API Kerberos SPNEGO NTLM NTLM_WB SSL libz UnixSockets Metalink
如果启用了板条箱功能static-curl
,它将自动构建curl库并进行静态链接。看来它将启用该方案中的所有适用功能(尽管我尚未对此进行测试)。