Skip to main content

handle_connect

Function handle_connect 

Source
pub async fn handle_connect(
    stream: BoxStream,
    require_auth: bool,
    valid_credentials: Option<(&str, &str)>,
) -> Result<(ConnectRequest, BoxStream), HttpError>
Expand description

Handle an HTTP CONNECT request from a client stream.

Parses the CONNECT request, validates it, and returns the stream ready for bidirectional forwarding after sending a 200 response.

§Arguments

  • stream - The client stream to read the CONNECT request from
  • require_auth - Whether proxy authentication is required
  • valid_credentials - Valid (username, password) pair for auth validation

§Returns

The parsed CONNECT request and the stream (with any bytes after the request head preserved).