v0.35.2
This commit is contained in:
1 parent
09414dfb09
commit
f4606cce18
36 files changed
+641
-74
No files matched your search
@@ -99,6 +99,8 @@ pub struct HealthCheck {
|
||||
pub mode: HealthMode,
|
||||
pub path: String,
|
||||
pub host: Option<String>,
|
||||
pub port: Option<u16>,
|
||||
pub expect_body: Option<String>,
|
||||
pub interval_ms: u64,
|
||||
pub timeout_ms: u64,
|
||||
pub slow_response_ms: u64,
|
||||
@@ -113,6 +115,8 @@ impl Default for HealthCheck {
|
||||
mode: HealthMode::Tcp,
|
||||
path: "/".into(),
|
||||
host: None,
|
||||
port: None,
|
||||
expect_body: None,
|
||||
interval_ms: 5000,
|
||||
timeout_ms: 2000,
|
||||
slow_response_ms: 1500,
|
||||
@@ -261,6 +265,13 @@ impl Settings {
|
||||
&& !h.path.bytes().any(|b| b <= 32 || b == 127),
|
||||
"invalid health HTTP path"
|
||||
);
|
||||
ensure!(h.port != Some(0), "health check port must be 1..65535");
|
||||
if let Some(expected) = &h.expect_body {
|
||||
ensure!(
|
||||
!expected.is_empty() && expected.len() <= 256 && !expected.chars().any(char::is_control),
|
||||
"health check expected body text must be 1..256 printable characters"
|
||||
);
|
||||
}
|
||||
if let Some(host) = &h.host {
|
||||
crate::config::request_host(host)?;
|
||||
let _: HeaderValue = host.parse()?;
|
||||
|
||||
Reference in new issue
Block a user