diff --git a/Cargo.lock b/Cargo.lock index c9d4d569..eb881a2f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1435,9 +1435,9 @@ dependencies = [ [[package]] name = "ureq-proto" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76790855073cbbdf9a23a7a622741480cebaec1d9b9b06b6ed2c55611fed37c" +checksum = "a27729fd2c15426f48992a911ce31bd1f29c1cd0898c2c86b410d24f51c99eb3" dependencies = [ "base64", "http", diff --git a/Cargo.toml b/Cargo.toml index 2ecaebc1..14a9e191 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ features = ["rustls", "platform-verifier", "native-tls", "socks-proxy", "cookies [dependencies] base64 = "0.22.1" -ureq-proto = "0.2.2" +ureq-proto = "0.2.3" # ureq-proto = { path = "../ureq-proto" } log = "0.4.22" once_cell = "1.19.0" diff --git a/src/lib.rs b/src/lib.rs index 58f06cb7..c8460fc5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -913,6 +913,22 @@ pub(crate) mod test { let _ = agent.get("http://cookie.test/cookie-test").call().unwrap(); } + #[test] + #[cfg(feature = "_test")] + fn http_connect_proxy() { + init_test_log(); + + let proxy = Proxy::new("http://my_proxy:1234/connect-proxy").unwrap(); + + let agent = Agent::config_builder() + .proxy(Some(proxy)) + .build() + .new_agent(); + + let mut res = agent.get("http://httpbin.org/get").call().unwrap(); + res.body_mut().read_to_string().unwrap(); + } + // This doesn't need to run, just compile. fn _ensure_send_sync() { fn is_send(_t: impl Send) {} diff --git a/src/unversioned/transport/test.rs b/src/unversioned/transport/test.rs index d5716e5d..b1be72ec 100644 --- a/src/unversioned/transport/test.rs +++ b/src/unversioned/transport/test.rs @@ -338,6 +338,25 @@ fn setup_default_handlers(handlers: &mut Vec) { handlers, ); + maybe_add( + TestHandler::new("/connect-proxy", |_uri, req, w| { + assert_eq!(req.uri(), "httpbin.org:80"); + write!( + w, + "HTTP/1.1 200 OK\r\n\ + \r\n\ + HTTP/1.1 200 OK\r\n\ + Content-Type: application/json\r\n\ + Content-Length: {}\r\n\ + \r\n", + HTTPBIN_GET.as_bytes().len() + )?; + w.write_all(HTTPBIN_GET.as_bytes())?; + Ok(()) + }), + handlers, + ); + #[cfg(feature = "charset")] { let (cow, _, _) =