maoertel / diqwest

Crate to extend `reqwest` to be able to send with digest auth flow.
https://docs.rs/diqwest
MIT License
18 stars 3 forks source link

Fails if username/password is defined in url #5

Closed rcastill closed 2 years ago

rcastill commented 2 years ago

In reqwest, when username/password is provided in url, it seems to use basic authentication. Something like this:

http://user:pass@host:port/path

My idea was to use .send_with_digest_authentication() using such an url, that way the authentication method would be "automatic":

Problem is, reqwest seems to fallback to basic auth because of the user/pass in the url. I tried to patch diqwest in a fork to make sure username/pass are removed for the second request, but it seems that there is no way to access the url from RequestBuilder.

The only way that I can think of this working, is that response from RequestBuilder::build is used. But that needs access to Client::execute.

I don't know if solving this issue is in the scope of this crate, but an automatic authentication process would be a nice to have. Maybe there is another approach?

rcastill commented 2 years ago

Turns out, I misstyped the password... :/

It works as intended.