Struct kvarn::application::Http1Body

source ·
pub struct Http1Body<R: AsyncRead + Unpin> { /* private fields */ }
Expand description

A HTTP/1 body.

The reason of this type and the inner buffer is described in super::Body::Http1

Implementations§

source§

impl<R: AsyncRead + Unpin> Http1Body<R>

source

pub fn new(reader: Arc<Mutex<R>>, bytes: Bytes, content_length: usize) -> Self

Creates a new body.

content_length should be the total length of the body, found in the Request::headers.

source

pub async fn read_to_bytes(&mut self, max_len: usize) -> Result<Bytes>

Reads all bytes from self to a