简体   繁体   中英

How to enable NTLM support for curl Rust crate?

I build on windows with cargo.toml settings:

[dependencies]
curl = {version="0.4.33", features = ["ssl"]}

Then when I call http service I get an error:

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 }'

How to enable NTLM support for curl Rust crate?

The rust curl crate will attempt to link against the existing curl library on your system if it can find it. In that case, you will only be able to use features which are compiled into that existing curl library.

Going by the error you are getting, I would assume that NTLM was not enabled when your curl library was compiled. You can check that by running the curl cli progam (which is usually linked to the library) with the -V option:

$ 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

If you enable the crate feature static-curl then it will build the curl library itself and statically link it. It appears that it will enable all applicable features in that scenario (although I have not tested that).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM