pub struct Request {
pub method: Vec<u8>,
pub headers: Headers,
pub target: Vec<u8>,
pub http_version: Vec<u8>,
}Expand description
HTTP request head event.
Use Request::new or Request::new_http11 for fallible construction.
Direct struct literals are possible, but callers should run
Request::validate before sending values built from untrusted input.
Fields§
§method: Vec<u8>Request method bytes, for example GET or POST.
headers: HeadersNormalized request headers with original casing preserved.
target: Vec<u8>Request target bytes.
http_version: Vec<u8>HTTP version without the HTTP/ prefix, for example 1.1.
Implementations§
Source§impl Request
impl Request
Sourcepub fn new<M, T, V>(
method: M,
headers: Headers,
target: T,
http_version: V,
) -> Result<Self, ProtocolError>
pub fn new<M, T, V>( method: M, headers: Headers, target: T, http_version: V, ) -> Result<Self, ProtocolError>
Builds and validates a request with an explicit HTTP version.
Sourcepub fn new_http11<M, T>(
method: M,
headers: Headers,
target: T,
) -> Result<Self, ProtocolError>
pub fn new_http11<M, T>( method: M, headers: Headers, target: T, ) -> Result<Self, ProtocolError>
Builds and validates an HTTP/1.1 request.
Sourcepub fn validate(&self) -> Result<(), ProtocolError>
pub fn validate(&self) -> Result<(), ProtocolError>
Validates request method, target, HTTP version, and Host header rules.
Trait Implementations§
impl Eq for Request
impl StructuralPartialEq for Request
Auto Trait Implementations§
impl Freeze for Request
impl RefUnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
impl UnwindSafe for Request
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