tafia/hyper-proxy

Visibility on proxy corruption

lwus opened this issue · 0 comments

lwus commented

Is there a way to diagnose where a proxy connector might be introducing corruption when working with TLS? I'm running the example http_proxy and am able to successfully connect through reqwest but not this crate. My setup is

let mut http = hyper::client::connect::HttpConnector::new();
http.enforce_http(false);

let proxy_uri = "https://127.0.0.1:8100".to_string();
let mut proxy = hyper_proxy::Proxy::new(
    hyper_proxy::Intercept::All,
    proxy_uri.parse::<http::Uri>()
        .map_err(|err| Error::InvalidUri(proxy_uri, err.to_string()))?,
);
proxy.set_header(
    http::header::HeaderName::from_static("proxy-connection"),
    http::header::HeaderValue::from_static("Keep-Alive"),
);
endpoint.connect_with_connector(
    hyper_proxy::ProxyConnector::from_proxy(http, proxy)?).await.unwrap()

where endpoint is a tonic Channel. The handshake seems to kick off but then a tonic::transport::Error(Transport, hyper::Error(Connect, Custom { kind: InvalidData, error: CorruptMessage })) is returned.