use crate::Stream;
use std::pin::Pin;
#[derive(Debug)]
pub struct InnerRequest {
pub buffer: Pin<Box<[u8]>>,
pub _headers: Vec<httparse::Header<'static>>,
pub req: httparse::Request<'static, 'static>,
pub body_offset: usize,
pub body_len: usize,
}
#[derive(Debug)]
pub struct Request {
pub inner: InnerRequest,
pub socket: *mut Stream,
pub keep_alive: bool,
pub content_read: usize,
pub content_length: Option<u64>,
pub remaining_chunk_size: Option<usize>,
pub te_chunked: bool,
pub expect_continue: bool,
}
unsafe impl Send for Request {}
impl Request {
#[inline(always)]
pub fn socket<'a>(&self) -> &'a mut Stream {
unsafe { &mut *self.socket }
}
#[inline(always)]
pub fn method(&self) -> &str {
self.inner.req.method.unwrap()
}
}