pub struct HeaderAccumulator {
buffer: Vec<u8>,
max_size: usize,
}Expand description
Internal state for accumulating headers.
Fields§
§buffer: Vec<u8>Raw header data
max_size: usizeMaximum header size (prevent DoS)
Implementations§
Source§impl HeaderAccumulator
impl HeaderAccumulator
const DEFAULT_MAX_SIZE: usize = 16_384usize
fn new() -> Self
Sourcefn append(&mut self, data: &[u8]) -> Result<bool, HttpError>
fn append(&mut self, data: &[u8]) -> Result<bool, HttpError>
Append data to buffer. Returns true if headers complete (\r\n\r\n found).
Sourcefn find_header_end(&self) -> Option<usize>
fn find_header_end(&self) -> Option<usize>
Find position of header/body separator.
Sourcefn parse(&self) -> Result<(HttpResponseInfo, &[u8]), HttpError>
fn parse(&self) -> Result<(HttpResponseInfo, &[u8]), HttpError>
Parse headers and return body data.
Sourcefn parse_headers(data: &[u8]) -> Result<HttpResponseInfo, HttpError>
fn parse_headers(data: &[u8]) -> Result<HttpResponseInfo, HttpError>
Parse HTTP response headers.
Sourcefn default_reason(code: u16) -> &'static str
fn default_reason(code: u16) -> &'static str
Default reason phrase for status code.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HeaderAccumulator
impl RefUnwindSafe for HeaderAccumulator
impl Send for HeaderAccumulator
impl Sync for HeaderAccumulator
impl Unpin for HeaderAccumulator
impl UnwindSafe for HeaderAccumulator
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