10 releases (stable)

2.0.0 Nov 24, 2023
1.2.1 Aug 17, 2023
1.2.0 May 11, 2023
1.1.1 Jan 13, 2023
0.1.2 Oct 14, 2021

#82 in Authentication

Download history 687/week @ 2023-11-03 503/week @ 2023-11-10 842/week @ 2023-11-17 594/week @ 2023-11-24 376/week @ 2023-12-01 165/week @ 2023-12-08 218/week @ 2023-12-15 151/week @ 2023-12-22 171/week @ 2023-12-29 406/week @ 2024-01-05 231/week @ 2024-01-12 217/week @ 2024-01-19 290/week @ 2024-01-26 503/week @ 2024-02-02 655/week @ 2024-02-09 593/week @ 2024-02-16

2,069 downloads per month
Used in 7 crates

MIT license

19KB
378 lines

diqwest

This crate extends reqwest to be able to send requests with digest auth flow.

When you send a request with digest auth flow this first request will be executed. In case the response is a 401 the www-authenticate header is parsed and the answer is calculated. The initial request is executed again with additional Authorization header. The response will be returned from send_with_digest_auth().

In case the first response is not a 401 this first response is returned from send_with_digest_auth() without any manipulation. In case the first response is a 401 but the www-authenticate header is missing the first reponse is returned as well.

Examples

Async (default)

use diqwest::WithDigestAuth;
use reqwest::{Client, Response};

// Call `.send_with_digest_auth()` on `RequestBuilder` like `send()`
let response: Response = Client::new()
  .get("url")
  .send_with_digest_auth("username", "password")
  .await?;

Blocking (feature flag blocking has to be enabled in Cargo.toml)

use diqwest::blocking::WithDigestAuth;
use reqwest::blocking::{Client, Response};

// Call `.send_with_digest_auth()` on `RequestBuilder` like `send()`
let response: Response = Client::new()
  .get("url")
  .send_with_digest_auth("username", "password")?;

Dependencies

~4–18MB
~262K SLoC