[][src]Struct rocket::http::hyper::Request

pub struct Request<'a, 'b> where
    'b: 'a, 
{ pub remote_addr: SocketAddr, pub method: Method, pub headers: Headers, pub uri: RequestUri, pub version: HttpVersion, // some fields omitted }

A request bundles several parts of an incoming NetworkStream, given to a Handler.


remote_addr: SocketAddr

The IP address of the remote connection.

method: Method

The Method, such as Get, Post, etc.

headers: Headers

The headers of the incoming request.

uri: RequestUri

The target request-uri for this request.

version: HttpVersion

The version of HTTP for this request.


impl<'a, 'b> Request<'a, 'b> where
    'b: 'a, 

pub fn new(
    stream: &'a mut BufReader<&'b mut (dyn NetworkStream + 'static)>,
    addr: SocketAddr
) -> Result<Request<'a, 'b>, Error>

Create a new Request, reading the StartLine and Headers so they are immediately useful.

pub fn set_read_timeout(&self, timeout: Option<Duration>) -> Result<(), Error>[src]

Set the read timeout of the underlying NetworkStream.

pub fn downcast_ref<T>(&self) -> Option<&T> where
    T: NetworkStream

Get a reference to the underlying NetworkStream.

pub fn ssl<T>(&self) -> Option<&T> where
    T: NetworkStream

Get a reference to the underlying Ssl stream, if connected over HTTPS.

This is actually just an alias for downcast_ref.

pub fn deconstruct(
) -> (SocketAddr, Method, Headers, RequestUri, HttpVersion, HttpReader<&'a mut BufReader<&'b mut (dyn NetworkStream + 'static)>>)

Deconstruct a Request into its constituent parts.

Trait Implementations

impl<'a, 'b> Read for Request<'a, 'b>[src]

Auto Trait Implementations

impl<'a, 'b> !RefUnwindSafe for Request<'a, 'b>

impl<'a, 'b> Send for Request<'a, 'b>

impl<'a, 'b> !Sync for Request<'a, 'b>

impl<'a, 'b> Unpin for Request<'a, 'b> where
    'b: 'a, 

impl<'a, 'b> !UnwindSafe for Request<'a, 'b>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized

impl<T, I> AsResult<T, I> for T where
    I: Input, 

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> IntoCollection<T> for T

impl<R> ReadBytesExt for R where
    R: Read + ?Sized

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Typeable for T where
    T: Any

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,