Struct parity_ws::Request [−][src]
pub struct Request { /* fields omitted */ }
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.
Get the origin of the request if it comes from a browser.
Get the hashed WebSocket key from this request.
Get the WebSocket protocol version from the request (should be 13).
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.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Request
impl UnwindSafe for Request