pub struct HttpRequest<'a> {
pub method: HttpMethod,
pub path: &'a str,
pub version: &'a str,
pub headers: Vec<HttpHeader<'a>, MAX_HEADERS>,
pub body: &'a [u8],
}Expand description
HTTP request parsed from client
Fieldsยง
ยงmethod: HttpMethodHTTP method
path: &'a strRequest path
version: &'a strHTTP version (e.g., โHTTP/1.1โ)
headers: Vec<HttpHeader<'a>, MAX_HEADERS>Request headers
body: &'a [u8]Request body (if present)
Implementationsยง
Sourceยงimpl<'a> HttpRequest<'a>
impl<'a> HttpRequest<'a>
Sourcepub fn parse_from(headers_str: &'a str, body: &'a [u8]) -> Result<Self, Error>
pub fn parse_from(headers_str: &'a str, body: &'a [u8]) -> Result<Self, Error>
Parse an HTTP request from headers string and body bytes
ยงErrors
Returns an error if:
- The request line is missing or malformed
- The HTTP method is invalid or unsupported
- Required parts (method, path, version) are missing
- Too many headers are provided (exceeds
MAX_HEADERS)
Trait Implementationsยง
Sourceยงimpl<'a> Debug for HttpRequest<'a>
impl<'a> Debug for HttpRequest<'a>
Auto 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> 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