Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fails if username/password is defined in url #5

Closed
rcastill opened this issue Jul 20, 2022 · 1 comment
Closed

Fails if username/password is defined in url #5

rcastill opened this issue Jul 20, 2022 · 1 comment

Comments

@rcastill
Copy link
Contributor

rcastill commented Jul 20, 2022

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":

  • If endpoint was basic, then first response would be OK
  • If endpoint was digest, then second request should do it

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
Copy link
Contributor Author

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

It works as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant