pub struct ConnectTarget { /* private fields */ }Expand description
CONNECT destination in authority form.
Holds a validated host and port. ConnectTarget::authority renders
the exact host:port string used for both the CONNECT request-target
and the Host header so they cannot diverge.
Implementations§
Source§impl ConnectTarget
impl ConnectTarget
Sourcepub fn new(host: impl Into<String>, port: u16) -> Result<Self, ConnectError>
pub fn new(host: impl Into<String>, port: u16) -> Result<Self, ConnectError>
Create a CONNECT target.
§Errors
Returns ConnectError::InvalidTarget when the host is empty,
contains request-line control bytes (CR, LF, other C0 controls,
DEL, or space), request-target delimiters (/, ?, #, @),
or has malformed IPv6 brackets. Bracketed
([::1]) and unbracketed (::1) IPv6 literals are both accepted
and normalize to the same bracketed authority. No path, query, or
body semantics exist in this type.
Render the authority-form host:port target.
Domains render as example.com:443, IPv4 as 127.0.0.1:443,
and IPv6 bracketed as [::1]:443. Pre-bracketed and unbracketed
IPv6 normalize to the same bracketed form.