pub struct HttpRequest {
pub method: String,
pub url: String,
pub headers: HashMap<String, String>,
pub body: Option<Vec<u8>>,
pub timeout_ms: u64,
pub max_response_bytes: usize,
}Expand description
Validated and normalized HTTP proxy request.
Fields§
§method: StringHTTP method to send on the host side, such as GET or POST.
url: StringTarget HTTPS URL after guest payload normalization.
headers: HashMap<String, String>Request headers to forward to the target server.
body: Option<Vec<u8>>Optional raw request body bytes.
timeout_ms: u64Request timeout in milliseconds.
max_response_bytes: usizeMaximum response body size allowed before the proxy aborts the read.
Implementations§
Source§impl HttpRequest
impl HttpRequest
Sourcepub fn new(
method: impl Into<String>,
url: impl Into<String>,
headers: HashMap<String, String>,
body: Option<Vec<u8>>,
timeout_ms: Option<u64>,
max_response_bytes: Option<usize>,
) -> Result<Self, HttpProxyError>
pub fn new( method: impl Into<String>, url: impl Into<String>, headers: HashMap<String, String>, body: Option<Vec<u8>>, timeout_ms: Option<u64>, max_response_bytes: Option<usize>, ) -> Result<Self, HttpProxyError>
Constructs a new HTTP proxy request and applies default limits.
The request body is rejected when it exceeds the maximum guest-to-host body size accepted by the proxy protocol.
Sourcepub fn from_json(json: &str) -> Result<Self, HttpProxyError>
pub fn from_json(json: &str) -> Result<Self, HttpProxyError>
Parses an HTTP proxy request from a guest JSON payload.
Missing timeout and response-size fields are replaced with crate defaults.
Trait Implementations§
Source§impl Clone for HttpRequest
impl Clone for HttpRequest
Source§fn clone(&self) -> HttpRequest
fn clone(&self) -> HttpRequest
Returns a duplicate of the value. Read more
1.0.0 · 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 HttpRequest
impl Debug for HttpRequest
Source§impl PartialEq for HttpRequest
impl PartialEq for HttpRequest
impl Eq for HttpRequest
impl StructuralPartialEq for HttpRequest
Auto Trait Implementations§
impl Freeze for HttpRequest
impl RefUnwindSafe for HttpRequest
impl Send for HttpRequest
impl Sync for HttpRequest
impl Unpin for HttpRequest
impl UnsafeUnpin for HttpRequest
impl UnwindSafe for HttpRequest
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