alexcrichton / curl-rust

Rust bindings to libcurl
MIT License
1.01k stars 234 forks source link

NTLM authentication on Windows does not work #359

Open stone-bits opened 3 years ago

stone-bits commented 3 years ago

I'm evaluating rust for enterprise software development. It's crucial for us to have simple way to make http requests with Kerberos and NTLM authentication. I found no other crates that can do that.

I'm building on windows with cargo.toml settings:

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

code:

...
let mut auth = Auth::new();
auth.ntlm(true); 
let mut easy = Easy::new();
easy.http_auth(&auth).unwrap(); // here it panics
...

Running this code on windows 10 with command:

cargo run

And I'm getting the following error:

"A requested feature, protocol or option was not found built-in in this libcurl 
due to a build-time decision."

It seems natural to have NTLM on windows enabled. Maybe I'm doing something wrong?

alexcrichton commented 3 years ago

This is likely falling back to the compiled in-tree version, which doesn't have this enabled by default. I think it would make sense though for this to be a feature on the curl-sys crate so it could be enabled!

sagebind commented 3 years ago

For anyone who might want to take a stab at this, here's the place where this is getting configured in the libcurl build: https://github.com/alexcrichton/curl-rust/blob/65d360ff46dc2bdede7bb396b382f76a4c3fdfcd/curl-sys/build.rs#L106

sacsand commented 3 years ago

same problem with mac os catlina 'actix-rt:worker:1' 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 }',. any soultion .

pbert519 commented 2 years ago

I think is is solved by #428.

We're using this crate with NTLM authentification with Windows and Linux.

Jayendraz commented 11 months ago

I am facing exact same issue with ntlm authentication in latest curl crate (0.4.33). any solution suggestion please?

pbert519 commented 11 months ago

Did you activate the ntlm feature?

Jayendraz commented 11 months ago

I believe NTLM feature is enabled by default. I am able to access configured NLTM proxy server through web browser though.

Jayendraz commented 11 months ago

@pbert519 while I am being new to rust, realised little late about feature activation you asked. Below line in Cargo.toml helped to resolved issue. Thanks for help!

curl = {version="0.4.44", features = ["ntlm"]}