pub struct HttpConfig {
pub tls_verify: bool,
pub tls_cacerts: Option<TlsCacerts>,
pub user_agent: Option<String>,
pub timeout: Option<f64>,
}Expand description
Sphinx’s shared HTTP configuration group plus intersphinx_timeout
(ext/intersphinx/_load.py:211-227, _InvConfig).
Fields§
§tls_verify: bool§tls_cacerts: Option<TlsCacerts>§user_agent: Option<String>§timeout: Option<f64>Seconds. None is Sphinx’s default and means no timeout — the
value is handed to requests as timeout=None
(ext/intersphinx/__init__.py:70-72).
Implementations§
Source§impl HttpConfig
impl HttpConfig
Sourcepub fn user_agent(&self) -> &str
pub fn user_agent(&self) -> &str
headers.setdefault('User-Agent', _user_agent or _USER_AGENT)
(util/requests.py:96-97): an empty configured value is falsy in
Python and so also falls back to the default.
Sourcepub fn timeout_duration(&self) -> Option<Duration>
pub fn timeout_duration(&self) -> Option<Duration>
timeout as a Duration, or None for “no timeout” — which is
both Sphinx’s default and what an unusable value degrades to.
intersphinx_timeout arrives from conf.py as an unvalidated
f64, and Duration::from_secs_f64 panics on a negative, NaN or
overflowing one. intersphinx_timeout = -1 is a natural thing to
write (intersphinx_cache_limit = -1 is the documented Sphinx idiom
for “never expire”), and with panic = "abort" in the release
profile that panic is a bare SIGABRT naming neither the config key
nor the file. Sphinx wraps the whole fetch in except Exception
(ext/intersphinx/_load.py:302-313), so a bad value there is one
entry in failures and the build carries on; this degrades the same
way, and says which value it rejected.
Sourcepub fn ca_bundle_for(&self, url: &str) -> Option<&str>
pub fn ca_bundle_for(&self, url: &str) -> Option<&str>
_get_tls_cacert(url, tls_cacerts) (util/requests.py:34-45): a
plain string is the bundle for every URL; a mapping is keyed by the
URL’s netloc with userinfo stripped, and a host it does not name
falls back to the default trust store.
Trait Implementations§
Source§impl Clone for HttpConfig
impl Clone for HttpConfig
Source§fn clone(&self) -> HttpConfig
fn clone(&self) -> HttpConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HttpConfig
impl Debug for HttpConfig
Source§impl Default for HttpConfig
Hand-written rather than derived: bool::default() is false, and a
default that silently turns off certificate verification is not a default
anyone should be able to reach by accident. Sphinx’s tls_verify default
is True (config.py:286), and so is this one.
impl Default for HttpConfig
Hand-written rather than derived: bool::default() is false, and a
default that silently turns off certificate verification is not a default
anyone should be able to reach by accident. Sphinx’s tls_verify default
is True (config.py:286), and so is this one.
Source§impl PartialEq for HttpConfig
impl PartialEq for HttpConfig
impl StructuralPartialEq for HttpConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more