|
18 | 18 | use core::fmt; |
19 | 19 | use std::fmt::Formatter; |
20 | 20 |
|
21 | | -use crate::util::redacted::Redact; |
22 | | - |
23 | 21 | /// [Cookie](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie) returned by |
24 | 22 | /// the server with `Set-Cookie` header, and saved in the cookie storage of the internal HTTP |
25 | 23 | /// engine. |
@@ -78,9 +76,9 @@ impl Cookie { |
78 | 76 | ) |
79 | 77 | } |
80 | 78 |
|
81 | | - /// Creates a [`Cookie`] from a Nescape cookie formatted string. |
| 79 | + /// Creates a [`Cookie`] from a Netscape cookie formatted string. |
82 | 80 | pub fn from_netscape_str(s: &str) -> Result<Self, ParseCookieError> { |
83 | | - let tokens = s.split_ascii_whitespace().collect::<Vec<&str>>(); |
| 81 | + let tokens = s.split("\t").collect::<Vec<&str>>(); |
84 | 82 | let (http_only, domain) = if let Some(&v) = tokens.first() { |
85 | 83 | if let Some(domain) = v.strip_prefix("#HttpOnly_") { |
86 | 84 | (true, domain.to_string()) |
@@ -140,22 +138,6 @@ impl fmt::Display for Cookie { |
140 | 138 | } |
141 | 139 | } |
142 | 140 |
|
143 | | -impl Redact for Cookie { |
144 | | - fn redact(&self, secrets: &[impl AsRef<str>]) -> String { |
145 | | - format!( |
146 | | - "{}{}\t{}\t{}\t{}\t{}\t{}\t{}", |
147 | | - if self.http_only { "#HttpOnly_" } else { "" }, |
148 | | - self.domain, |
149 | | - self.include_subdomain, |
150 | | - self.path, |
151 | | - self.https, |
152 | | - self.expires, |
153 | | - self.name, |
154 | | - self.value.redact(secrets) |
155 | | - ) |
156 | | - } |
157 | | -} |
158 | | - |
159 | 141 | #[derive(Clone, Debug, PartialEq, Eq)] |
160 | 142 | pub struct ParseCookieError; |
161 | 143 |
|
|
0 commit comments