Browse Source

Merge branch 'pr-method-lifetime' of slamb/digest_auth_rs into master

Ondřej Hruška 5 months ago
parent
commit
a1f3c6ebfb
2 changed files with 6 additions and 6 deletions
  1. 2 2
      src/digest.rs
  2. 4 4
      src/enums.rs

+ 2 - 2
src/digest.rs View File

@@ -161,7 +161,7 @@ pub struct AuthContext<'a> {
161 161
     /// May be left out if not using auth-int
162 162
     pub body: Option<Cow<'a, [u8]>>,
163 163
     /// HTTP method used (defaults to GET)
164
-    pub method: HttpMethod,
164
+    pub method: HttpMethod<'a>,
165 165
     /// Spoofed client nonce (use only for tests; a random nonce is generated automatically)
166 166
     pub cnonce: Option<Cow<'a, str>>,
167 167
 }
@@ -202,7 +202,7 @@ impl<'a> AuthContext<'a> {
202 202
         password: PW,
203 203
         uri: UR,
204 204
         body: Option<BD>,
205
-        method: HttpMethod,
205
+        method: HttpMethod<'a>,
206 206
     ) -> Self
207 207
     where
208 208
         UN: Into<Cow<'a, str>>,

+ 4 - 4
src/enums.rs View File

@@ -168,20 +168,20 @@ impl Display for Charset {
168 168
 
169 169
 /// HTTP method (used when generating the response hash for some Qop options)
170 170
 #[derive(Debug)]
171
-pub enum HttpMethod {
171
+pub enum HttpMethod<'a> {
172 172
     GET,
173 173
     POST,
174 174
     HEAD,
175
-    OTHER(&'static str),
175
+    OTHER(&'a str),
176 176
 }
177 177
 
178
-impl Default for HttpMethod {
178
+impl<'a> Default for HttpMethod<'a> {
179 179
     fn default() -> Self {
180 180
         HttpMethod::GET
181 181
     }
182 182
 }
183 183
 
184
-impl Display for HttpMethod {
184
+impl<'a> Display for HttpMethod<'a> {
185 185
     /// Convert to uppercase string
186 186
     fn fmt(&self, f: &mut Formatter) -> fmt::Result {
187 187
         f.write_str(match self {