pub struct HttpRequest {
pub method: String,
pub url: String,
pub headers: BTreeMap<String, String>,
pub body: Option<Vec<u8>>,
pub max_bytes: Option<u64>,
pub max_redirects: u8,
pub public_only: bool,
pub internal_target: bool,
}Fields§
§method: String§url: String§headers: BTreeMap<String, String>§body: Option<Vec<u8>>§max_bytes: Option<u64>Largest response body this caller will accept, in bytes. None puts
no ceiling on it.
max_redirects: u8How many redirects the provider may follow on this caller’s behalf.
Zero hands the 3xx back instead, which is what a caller wants when the
redirect target is itself a decision — WebFetch returns it to the
model rather than chasing it.
public_only: boolRefuse every hop whose destination is an internal address, whoever chose it.
For an endpoint an operator wrote down whose content still comes from
outside — an HTTP hook is a URL in a settings file a repository can
ship. Origin::Agent requests get the same refusal without asking.
internal_target: boolWith public_only, the host and port url names may be internal:
a hop to exactly that target is let through, every other hop is still
held to public_only. An Origin::Agent request gains nothing from it.
Implementations§
Source§impl HttpRequest
impl HttpRequest
pub fn new(method: impl Into<String>, url: impl Into<String>) -> Self
pub fn public_only(self) -> Self
Sourcepub fn public_only_but_target(self) -> Self
pub fn public_only_but_target(self) -> Self
public_only, except that the target url names may be internal.