aboutsummaryrefslogtreecommitdiff
path: root/src/util.rs
diff options
context:
space:
mode:
authorBlackDex <[email protected]>2023-03-09 16:31:28 +0100
committerBlackDex <[email protected]>2023-03-11 16:58:32 +0100
commit9e5b94924f5fea4ef405fa1f8aeb836b52f85a73 (patch)
tree83dcde146ea7557e0ef0a3209d681128a6dbc803 /src/util.rs
parentf21089900e86274c8a89a15a6ff79dfb9c433ca2 (diff)
downloadvaultwarden-9e5b94924f5fea4ef405fa1f8aeb836b52f85a73.tar.gz
vaultwarden-9e5b94924f5fea4ef405fa1f8aeb836b52f85a73.zip
Merge ClientIp with Headers.
Since we now use the `ClientIp` Guard on a lot more places, it also increases the size of binary, and the macro generated code because of this extra Guard. By merging the `ClientIp` Guard with the several `Header` guards we have it reduces the amount of code generated (including LLVM IR), but also a small speedup in build time. I also spotted some small `json!()` optimizations which also reduced the amount of code generated.
Diffstat (limited to 'src/util.rs')
-rw-r--r--src/util.rs7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/util.rs b/src/util.rs
index 18adea70..a9e94405 100644
--- a/src/util.rs
+++ b/src/util.rs
@@ -231,8 +231,7 @@ impl<'r> FromParam<'r> for SafeString {
// Log all the routes from the main paths list, and the attachments endpoint
// Effectively ignores, any static file route, and the alive endpoint
-const LOGGED_ROUTES: [&str; 6] =
- ["/api", "/admin", "/identity", "/icons", "/notifications/hub/negotiate", "/attachments"];
+const LOGGED_ROUTES: [&str; 5] = ["/api", "/admin", "/identity", "/icons", "/attachments"];
// Boolean is extra debug, when true, we ignore the whitelist above and also print the mounts
pub struct BetterLogging(pub bool);
@@ -588,7 +587,7 @@ impl<'de> Visitor<'de> for UpCaseVisitor {
fn upcase_value(value: Value) -> Value {
if let Value::Object(map) = value {
- let mut new_value = json!({});
+ let mut new_value = Value::Object(serde_json::Map::new());
for (key, val) in map.into_iter() {
let processed_key = _process_key(&key);
@@ -597,7 +596,7 @@ fn upcase_value(value: Value) -> Value {
new_value
} else if let Value::Array(array) = value {
// Initialize array with null values
- let mut new_value = json!(vec![Value::Null; array.len()]);
+ let mut new_value = Value::Array(vec![Value::Null; array.len()]);
for (index, val) in array.into_iter().enumerate() {
new_value[index] = upcase_value(val);