Struct ws::Request[][src]

pub struct Request { /* fields omitted */ }

The handshake request.

Methods

impl Request
[src]

Get the value of the first instance of an HTTP header.

Edit the value of the first instance of an HTTP header.

Important traits for Vec<u8>

Access the request headers.

Important traits for Vec<u8>

Edit the request headers.

Get the origin of the request if it comes from a browser.

Get the unhashed WebSocket key sent in the request.

Get the hashed WebSocket key from this request.

Get the WebSocket protocol version from the request (should be 13).

Get the request method.

Get the path of the request.

Get the possible protocols for the WebSocket connection.

Add a possible protocol to this request. This may result in duplicate protocols listed.

Remove a possible protocol from this request.

Get the possible extensions for the WebSocket connection.

Add a possible extension to this request. This may result in duplicate extensions listed. Also, the order of extensions indicates preference, so if the preference matters, consider using the Sec-WebSocket-Protocol header directly.

Remove a possible extension from this request. This will remove all configurations of the extension.

Get the IP address of the client.

This method will attempt to retrieve the most likely IP address of the requester in the following manner:

If the X-Forwarded-For header exists, this method will return the left most address in the list.

If the Forwarded HTTP Header Field exits, this method will return the left most address indicated by the for parameter, if it exists.

Note

This method does not ensure that the address is a valid IP address.

Attempt to parse an HTTP request from a buffer. If the buffer does not contain a complete request, this will return Ok(None).

Construct a new WebSocket handshake HTTP request from a url.

Write a request out to a buffer

Trait Implementations

impl Debug for Request
[src]

Formats the value using the given formatter. Read more

impl Display for Request
[src]

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl Send for Request

impl Sync for Request