v0.26.2
This commit is contained in:
1 parent
b9d137eee1
commit
32e6875980
51 files changed
+1255
-452
No files matched your search
+19
-10
@@ -13,10 +13,7 @@ const LIVE_LOG_COLUMNS: &[&str] = &[
|
||||
"websocket",
|
||||
"upstream_error",
|
||||
];
|
||||
const FILE_LOG_COLUMNS: &[&str] = &[
|
||||
"time", "event", "status", "client_ip", "vhost", "transport", "matched_by", "sni",
|
||||
"authority", "record", "source",
|
||||
];
|
||||
const FILE_LOG_COLUMN_MAX: usize = 64;
|
||||
const BACKEND_TABLE_COLUMNS: &[&str] = &[
|
||||
"vhost",
|
||||
"backend",
|
||||
@@ -38,10 +35,18 @@ fn default_admin_theme() -> String {
|
||||
"dark".to_owned()
|
||||
}
|
||||
fn default_file_log_columns() -> Vec<String> {
|
||||
["time", "event", "status", "client_ip", "vhost", "record", "source"]
|
||||
.into_iter()
|
||||
.map(str::to_owned)
|
||||
.collect()
|
||||
[
|
||||
"time",
|
||||
"event",
|
||||
"status",
|
||||
"client_ip",
|
||||
"vhost",
|
||||
"record",
|
||||
"source",
|
||||
]
|
||||
.into_iter()
|
||||
.map(str::to_owned)
|
||||
.collect()
|
||||
}
|
||||
fn default_backend_table_columns() -> Vec<String> {
|
||||
BACKEND_TABLE_COLUMNS
|
||||
@@ -104,7 +109,7 @@ fn validate_admin_preferences(preferences: &AdminPreferences) -> Result<(), ApiE
|
||||
}
|
||||
}
|
||||
if preferences.file_log_columns.is_empty()
|
||||
|| preferences.file_log_columns.len() > FILE_LOG_COLUMNS.len()
|
||||
|| preferences.file_log_columns.len() > FILE_LOG_COLUMN_MAX
|
||||
{
|
||||
return Err(ApiError(
|
||||
StatusCode::UNPROCESSABLE_ENTITY,
|
||||
@@ -113,7 +118,11 @@ fn validate_admin_preferences(preferences: &AdminPreferences) -> Result<(), ApiE
|
||||
}
|
||||
let mut seen = std::collections::HashSet::new();
|
||||
for column in &preferences.file_log_columns {
|
||||
if !FILE_LOG_COLUMNS.contains(&column.as_str()) || !seen.insert(column.as_str()) {
|
||||
if column.is_empty()
|
||||
|| column.len() > 128
|
||||
|| column.chars().any(char::is_control)
|
||||
|| !seen.insert(column.as_str())
|
||||
{
|
||||
return Err(ApiError(
|
||||
StatusCode::UNPROCESSABLE_ENTITY,
|
||||
"invalid stored-log column preference".into(),
|
||||
|
||||
Reference in new issue
Block a user