pub struct HttpConn {
pub remote_addr: SocketAddr,
pub buf: FixedBuf<8192>,
pub stream: TcpStream,
pub read_state: ReadState,
pub write_state: WriteState,
}
Fields
remote_addr: SocketAddr
buf: FixedBuf<8192>
stream: TcpStream
read_state: ReadState
write_state: WriteState
Implementations
sourceimpl HttpConn
impl HttpConn
pub fn new(remote_addr: SocketAddr, stream: TcpStream) -> Self
pub fn is_ready(&self) -> bool
pub fn shutdown_write(&mut self)
pub fn shutdown_write_on_err<T, E>(
&mut self,
result: Result<T, E>
) -> Result<T, E>
sourcepub async fn read_request(&mut self) -> Result<Request, HttpError>
pub async fn read_request(&mut self) -> Result<Request, HttpError>
Errors
Returns an error when:
- we did not send a response to the previous request
- the connection is closed
- we did not read the response body of the previous request
- we fail to read the request
- we fail to parse the request
sourcepub async fn write_http_continue(&mut self) -> Result<(), HttpError>
pub async fn write_http_continue(&mut self) -> Result<(), HttpError>
Errors
Returns an error when:
- the connection is closed
- a response was already sent
- we fail to send the response
sourcepub async fn read_body_to_vec(&mut self) -> Result<RequestBody, HttpError>
pub async fn read_body_to_vec(&mut self) -> Result<RequestBody, HttpError>
Errors
Returns an error when:
- the client did not send a request body
- the request body was already read from the client
- the client used an unsupported transfer encoding
- we fail to read the request body
sourcepub async fn read_body_to_file(
&mut self,
dir: &Path,
max_len: u64
) -> Result<RequestBody, HttpError>
pub async fn read_body_to_file(
&mut self,
dir: &Path,
max_len: u64
) -> Result<RequestBody, HttpError>
Errors
Returns an error when:
- the client did not send a request body
- the request body was already read from the client
- the client used an unsupported transfer encoding
- the client sends a request body that is larger than
max_len
- we fail to read the request body
- we fail to create or write the temporary file
Auto Trait Implementations
impl RefUnwindSafe for HttpConn
impl Send for HttpConn
impl Sync for HttpConn
impl Unpin for HttpConn
impl UnwindSafe for HttpConn
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more