Skip to content

Commit

Permalink
remove unnecessary lowercase conversion when parsing uri
Browse files Browse the repository at this point in the history
Signed-off-by: Dan Bond <[email protected]>
  • Loading branch information
loshz committed May 22, 2024
1 parent 418481d commit ea4056d
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,13 @@ fn parse_uri(mut uri: String) -> String {
uri.insert(0, '/');
}

let u = match Uri::from_str(&uri) {
Ok(u) => u.path().to_string(),
match Uri::from_str(&uri) {
Ok(u) => u.path().to_lowercase(),
Err(_) => {
error!("invalid uri, defaulting to {}", DEFAULT_METRICS_PATH);
return DEFAULT_METRICS_PATH.to_string();
DEFAULT_METRICS_PATH.to_string()
}
};

u.to_lowercase()
}
}

// Responds to a given request and logs in an Apache-like format.
Expand Down

0 comments on commit ea4056d

Please sign in to comment.