pub struct DigestAuthChallenge {
pub realm: String,
pub nonce: String,
pub qop: Option<String>,
pub algorithm: String,
pub opaque: Option<String>,
pub stale: bool,
}Expand description
Parsed WWW-Authenticate header for Digest auth challenge
Represents a server’s Digest authentication challenge as defined in RFC 2617.
Example header: Digest realm="aria2", nonce="abc123", qop="auth", algorithm="MD5"
Fields§
§realm: StringAuthentication realm (typically a human-readable string describing the protected area)
nonce: StringServer-provided nonce value (unique per challenge)
qop: Option<String>Quality of protection: “auth” or “auth-int” (optional)
algorithm: StringHash algorithm used (default “MD5”)
opaque: Option<String>Opaque value that client must return unchanged (optional)
stale: boolIf true, the previous attempt failed due to stale nonce
Implementations§
Source§impl DigestAuthChallenge
impl DigestAuthChallenge
Sourcepub fn parse(header_value: &str) -> Result<Self, Aria2Error>
pub fn parse(header_value: &str) -> Result<Self, Aria2Error>
Parse a WWW-Authenticate header value containing a Digest challenge.
§Arguments
header_value- The full header value, e.g.Digest realm="aria2", nonce="abc123", qop="auth", algorithm="MD5", opaque="xyz", stale=false
§Returns
A parsed DigestAuthChallenge on success, or an error message on failure.
§Errors
Returns an error if:
- The header does not start with “Digest “
- The required
nonceparameter is missing
§Example
ⓘ
let challenge = DigestAuthChallenge::parse(
r#"Digest realm="test realm", nonce="dcd98b7102dd2f0e8b11d0f600bfb0c093", qop="auth""#
).unwrap();
assert_eq!(challenge.realm, "test realm");
assert_eq!(challenge.nonce, "dcd98b7102dd2f0e8b11d0f600bfb0c093");Trait Implementations§
Source§impl Clone for DigestAuthChallenge
impl Clone for DigestAuthChallenge
Source§fn clone(&self) -> DigestAuthChallenge
fn clone(&self) -> DigestAuthChallenge
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DigestAuthChallenge
impl Debug for DigestAuthChallenge
Auto Trait Implementations§
impl Freeze for DigestAuthChallenge
impl RefUnwindSafe for DigestAuthChallenge
impl Send for DigestAuthChallenge
impl Sync for DigestAuthChallenge
impl Unpin for DigestAuthChallenge
impl UnsafeUnpin for DigestAuthChallenge
impl UnwindSafe for DigestAuthChallenge
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more