11 releases (stable)

new 3.0.0 Apr 19, 2024
2.0.0 Nov 24, 2023
1.2.1 Aug 17, 2023
1.2.0 May 11, 2023
0.1.2 Oct 14, 2021

#74 in Authentication

Download history 208/week @ 2024-01-01 255/week @ 2024-01-08 82/week @ 2024-01-15 147/week @ 2024-01-22 225/week @ 2024-01-29 449/week @ 2024-02-05 519/week @ 2024-02-12 1252/week @ 2024-02-19 1192/week @ 2024-02-26 426/week @ 2024-03-04 298/week @ 2024-03-11 275/week @ 2024-03-18 246/week @ 2024-03-25 472/week @ 2024-04-01 330/week @ 2024-04-08 417/week @ 2024-04-15

1,486 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

~5–18MB
~249K SLoC