pub struct Authority {
pub host: String,
pub port: u16,
}Expand description
Host and port extracted from HTTP request targets (RFC 9110 §7.2).
Represents the authority component of a URI, containing the host (domain name or IP address) and port number. Used for routing proxy requests to origin servers.
Fields§
§host: StringHostname or IP literal (without brackets for IPv6).
port: u16Port number.
Implementations§
Source§impl Authority
impl Authority
Sourcepub fn new(host: String, port: u16) -> Self
pub fn new(host: String, port: u16) -> Self
Creates an authority from host and port components.
Parses an authority-form request target (RFC 9110 §7.1).
Authority-form is used with CONNECT requests: host:port with no scheme or path.
§Errors
Returns an error if the URI contains a scheme, path, or lacks a port.
Sourcepub fn from_absolute_uri(uri: &Uri) -> Result<Self>
pub fn from_absolute_uri(uri: &Uri) -> Result<Self>
Parses an absolute-form request target (RFC 9110 §7.1).
Absolute-form includes scheme, host, and optional port: http://host:port/path.
If no port is specified, defaults to 80 for HTTP or 443 for HTTPS.
§Errors
Returns an error if the URI lacks an authority or has an unsupported scheme without an explicit port.
Parses an authority-form string (host:port).
See from_authority_uri for details.
Sourcepub fn from_absolute_uri_str(s: &str) -> Result<Self>
pub fn from_absolute_uri_str(s: &str) -> Result<Self>
Parses an absolute-form URI string.
See from_absolute_uri for details.
Trait Implementations§
Source§impl Ord for Authority
impl Ord for Authority
Source§impl PartialOrd for Authority
impl PartialOrd for Authority
impl Eq for Authority
impl StructuralPartialEq for Authority
Auto Trait Implementations§
impl Freeze for Authority
impl RefUnwindSafe for Authority
impl Send for Authority
impl Sync for Authority
impl Unpin for Authority
impl UnsafeUnpin for Authority
impl UnwindSafe for Authority
Blanket Implementations§
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,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.