]> git.proxmox.com Git - proxmox-backup.git/commitdiff
server/rest: user constants for HTTP headers
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 30 Oct 2020 12:33:36 +0000 (13:33 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 30 Oct 2020 12:33:36 +0000 (13:33 +0100)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/server/rest.rs

index 85ad3746a791f60d4a6445e50f4f4c170da593a2..8ee3e77b17a22db451a389555e30db154ac19ca0 100644 (file)
@@ -553,7 +553,7 @@ enum AuthData {
 }
 
 fn extract_auth_data(headers: &http::HeaderMap) -> Option<AuthData> {
-    if let Some(raw_cookie) = headers.get("COOKIE") {
+    if let Some(raw_cookie) = headers.get(header::COOKIE) {
         if let Ok(cookie) = raw_cookie.to_str() {
             if let Some(ticket) = tools::extract_cookie(cookie, "PBSAuthCookie") {
                 let csrf_token = match headers.get("CSRFPreventionToken").map(|v| v.to_str()) {
@@ -568,7 +568,7 @@ fn extract_auth_data(headers: &http::HeaderMap) -> Option<AuthData> {
         }
     }
 
-    match headers.get("AUTHORIZATION").map(|v| v.to_str()) {
+    match headers.get(header::AUTHORIZATION).map(|v| v.to_str()) {
         Some(Ok(v)) if v.starts_with("PBSAPIToken ") => {
             Some(AuthData::ApiToken(v["PBSAPIToken ".len()..].to_owned()))
         },