pub struct Request { /* private fields */ }
Expand description

The handshake request.

Implementations

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

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

Access the request headers.

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

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Should always be Self

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.