pub struct HttpRequest<'a> {
pub method: &'a str,
pub uri: &'a str,
pub version: &'a str,
pub headers: Vec<(&'a str, &'a str)>,
pub body_offset: usize,
}Expand description
A parsed HTTP/1.x request.
All string fields are lifetimed references back into the buffer that was
passed to HttpRequest::parse. The body_offset field records where the
body begins in that same buffer.
Fields§
§method: &'a strHTTP method (e.g. "GET", "POST").
uri: &'a strRequest-URI (e.g. "/", "/api/v1/resource").
version: &'a strHTTP version string (e.g. "HTTP/1.1").
headers: Vec<(&'a str, &'a str)>Parsed headers as (name, value) pairs. Header names retain their
original casing from the wire; callers should compare case-insensitively.
body_offset: usizeByte offset in the original buffer at which the message body starts.
Points to the byte immediately after the blank line (\r\n\r\n) that
separates headers from body. When there is no body this equals the
buffer length.
Implementations§
Source§impl<'a> HttpRequest<'a>
impl<'a> HttpRequest<'a>
Trait Implementations§
Source§impl<'a> Clone for HttpRequest<'a>
impl<'a> Clone for HttpRequest<'a>
Source§fn clone(&self) -> HttpRequest<'a>
fn clone(&self) -> HttpRequest<'a>
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 moreAuto Trait Implementations§
impl<'a> Freeze for HttpRequest<'a>
impl<'a> RefUnwindSafe for HttpRequest<'a>
impl<'a> Send for HttpRequest<'a>
impl<'a> Sync for HttpRequest<'a>
impl<'a> Unpin for HttpRequest<'a>
impl<'a> UnsafeUnpin for HttpRequest<'a>
impl<'a> UnwindSafe for HttpRequest<'a>
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
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>
Converts
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>
Converts
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