[pbs-devel] [PATCH backup 1/2] tools: rename extract_auth_cookie to extract_cookie

Thomas Lamprecht t.lamprecht at proxmox.com
Mon Sep 7 14:56:41 CEST 2020


It does nothing specific to authentication..

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---

will be re-used for parsing the PBSLangCookie, it felt wrong having "auth" in
the name.

 src/server/rest.rs | 2 +-
 src/tools.rs       | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/server/rest.rs b/src/server/rest.rs
index 5ee788d2..70c8b2c1 100644
--- a/src/server/rest.rs
+++ b/src/server/rest.rs
@@ -446,7 +446,7 @@ fn extract_auth_data(headers: &http::HeaderMap) -> (Option<String>, Option<Strin
     let mut ticket = None;
     if let Some(raw_cookie) = headers.get("COOKIE") {
         if let Ok(cookie) = raw_cookie.to_str() {
-            ticket = tools::extract_auth_cookie(cookie, "PBSAuthCookie");
+            ticket = tools::extract_cookie(cookie, "PBSAuthCookie");
         }
     }
 
diff --git a/src/tools.rs b/src/tools.rs
index 1b9d35a8..a3fbe007 100644
--- a/src/tools.rs
+++ b/src/tools.rs
@@ -326,9 +326,9 @@ pub fn assert_if_modified(digest1: &str, digest2: &str) -> Result<(), Error> {
     Ok(())
 }
 
-/// Extract authentication cookie from cookie header.
+/// Extract a specific cookie from cookie header.
 /// We assume cookie_name is already url encoded.
-pub fn extract_auth_cookie(cookie: &str, cookie_name: &str) -> Option<String> {
+pub fn extract_cookie(cookie: &str, cookie_name: &str) -> Option<String> {
     for pair in cookie.split(';') {
         let (name, value) = match pair.find('=') {
             Some(i) => (pair[..i].trim(), pair[(i + 1)..].trim()),
-- 
2.27.0






More information about the pbs-devel mailing list