server: rest: collapse nested if for less indentation
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
This commit is contained in:
parent
b84e8aaee9
commit
c47609fedb
@ -635,27 +635,21 @@ async fn handle_static_file_download(
|
||||
}
|
||||
|
||||
fn extract_lang_header(headers: &http::HeaderMap) -> Option<String> {
|
||||
if let Some(raw_cookie) = headers.get("COOKIE") {
|
||||
if let Ok(cookie) = raw_cookie.to_str() {
|
||||
return tools::extract_cookie(cookie, "PBSLangCookie");
|
||||
}
|
||||
if let Some(Ok(cookie)) = headers.get("COOKIE").map(|v| v.to_str()) {
|
||||
return tools::extract_cookie(cookie, "PBSLangCookie");
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
// FIXME: support handling multiple compression methods
|
||||
fn extract_compression_method(headers: &http::HeaderMap) -> Option<CompressionMethod> {
|
||||
if let Some(raw_encoding) = headers.get(header::ACCEPT_ENCODING) {
|
||||
if let Ok(encoding) = raw_encoding.to_str() {
|
||||
for encoding in encoding.split(&[',', ' '][..]) {
|
||||
if let Ok(method) = encoding.parse() {
|
||||
return Some(method);
|
||||
}
|
||||
if let Some(Ok(encodings)) = headers.get(header::ACCEPT_ENCODING).map(|v| v.to_str()) {
|
||||
for encoding in encodings.split(&[',', ' '][..]) {
|
||||
if let Ok(method) = encoding.parse() {
|
||||
return Some(method);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user