http_connect

Function http_connect 

Source
pub async fn http_connect<T>(
    stream: &mut T,
    address: &Address,
    auth_method: &AuthMethod,
) -> Result<()>
where T: AsyncRead + AsyncWrite + Unpin,
Available on crate feature http only.
Expand description

Establishes an HTTP proxy connection to a target server.

This function sends an HTTP CONNECT request to a proxy server with the specified target address and authentication credentials, then verifies the response.

§Arguments

  • stream - A mutable reference to an asynchronous stream implementing AsyncRead + AsyncWrite + Unpin.
  • address - The target address to connect to.
  • auth_method - The authentication method to use for this connection.

§Returns

  • Result<()> - Success if the connection is established, or an error if the request fails, authentication is rejected, or the server returns a non-200 status code.