pub struct HttpConfig {
pub allowed_hosts: Vec<String>,
pub allow_private_addresses: bool,
pub max_response_bytes: u64,
pub connect_timeout_ms: u64,
pub timeout_ms: u64,
}Expand description
Package-level [http] configuration.
[http]
# Egress allowlist. When non-empty only these hosts can be requested;
# "*.example.com" matches any subdomain but not example.com itself.
allowed-hosts = ["api.example.com", "*.example.org"]
# Opt-in for internal/on-prem endpoints. Cloud metadata addresses stay
# blocked even when this is true.
allow-private-addresses = false
# Hard cap on a response body; larger bodies fail the act.
max-response-bytes = 67108864
# Connect timeout; defaults to 10000 (1..=300000)
connect-timeout-ms = 10000
# Whole-request timeout, including reading the body; defaults to 30000
# (1..=3600000)
timeout-ms = 30000Both timeouts are always in force: there is no value that disables them,
and a value outside its range is a startup error rather than a silent
clamp. An act’s own timeout-ms param overrides timeout-ms for that act
(never above [MAX_TIMEOUT_MS]).
Fields§
§allowed_hosts: Vec<String>Hosts allowed to be requested. Empty means any host (subject to the address checks below).
allow_private_addresses: boolAllow loopback/RFC1918/link-local/unique-local addresses. Cloud metadata endpoints are rejected regardless.
max_response_bytes: u64Maximum response body size in bytes; the act fails beyond it.
connect_timeout_ms: u64Connection establishment timeout in milliseconds, in
1..=MAX_CONNECT_TIMEOUT_MS.
timeout_ms: u64Total request timeout in milliseconds, including reading the body, in
1..=MAX_TIMEOUT_MS.
Trait Implementations§
Source§impl Clone for HttpConfig
impl Clone for HttpConfig
Source§fn clone(&self) -> HttpConfig
fn clone(&self) -> HttpConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HttpConfig
impl Debug for HttpConfig
Source§impl Default for HttpConfig
impl Default for HttpConfig
Source§impl<'de> Deserialize<'de> for HttpConfig
impl<'de> Deserialize<'de> for HttpConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for HttpConfig
impl RefUnwindSafe for HttpConfig
impl Send for HttpConfig
impl Sync for HttpConfig
impl Unpin for HttpConfig
impl UnsafeUnpin for HttpConfig
impl UnwindSafe for HttpConfig
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more