pub struct ClientRequest { /* private fields */ }server only.Expand description
Details about an incoming relay client connection.
Passed to AccessControl::on_connect to decide whether to admit the connection.
Implementations§
Source§impl ClientRequest
impl ClientRequest
Sourcepub fn new(
endpoint_id: EndpointId,
protocol_version: ProtocolVersion,
request: Parts,
) -> Self
pub fn new( endpoint_id: EndpointId, protocol_version: ProtocolVersion, request: Parts, ) -> Self
Creates a new ClientRequest from an EndpointId and HTTP request parts.
The EndpointId must be proven by the relay handshake. The request parts
come from the client’s WebSocket request. A fresh ConnectionId is assigned.
Sourcepub fn connection_id(&self) -> ConnectionId
pub fn connection_id(&self) -> ConnectionId
Returns the ConnectionId assigned to this connection.
Sourcepub fn protocol_version(&self) -> ProtocolVersion
pub fn protocol_version(&self) -> ProtocolVersion
Returns the ProtocolVersion negotiated for this connection.
Sourcepub fn endpoint_id(&self) -> EndpointId
pub fn endpoint_id(&self) -> EndpointId
Returns the EndpointId of the client.
The relay handshake authenticates this id before the access hook is invoked. The client proves possession of the secret key for this public key by either signing keying material exported from the TLS session or a challenge issued by the server.
Sourcepub fn query_pairs(&self) -> impl Iterator<Item = (Cow<'_, str>, Cow<'_, str>)>
pub fn query_pairs(&self) -> impl Iterator<Item = (Cow<'_, str>, Cow<'_, str>)>
Returns an iterator over the query parameters set in the URI of the HTTP request.
Each item is a (name, value) pair. Both names and values are percent-decoded.
The query string is parsed in order, and the same name may appear more than once.
Sourcepub fn headers(&self) -> &HeaderMap
pub fn headers(&self) -> &HeaderMap
Returns the headers of the HTTP request with which the client connected.
Sourcepub fn auth_token(&self) -> Option<String>
pub fn auth_token(&self) -> Option<String>
Returns the authorization token from the client’s HTTP request, if any.
Walks the Authorization headers in order and returns the value of
the first one whose scheme is Bearer (matched case-insensitively).
Headers with a different scheme are skipped.
If none of the Authorization headers carries a Bearer scheme,
returns the value of the token URL query parameter, or None if
the URL has no token parameter.
If an Authorization header value is not valid UTF-8 the function returns
None immediately, without checking later headers or the URL query.
Trait Implementations§
Source§impl Clone for ClientRequest
impl Clone for ClientRequest
Source§fn clone(&self) -> ClientRequest
fn clone(&self) -> ClientRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl !Freeze for ClientRequest
impl !RefUnwindSafe for ClientRequest
impl Send for ClientRequest
impl Sync for ClientRequest
impl Unpin for ClientRequest
impl !UnwindSafe for ClientRequest
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more