From fce56bb2600bcf4bdaebf194667ea25c5e11727e Mon Sep 17 00:00:00 2001 From: DanGould Date: Sat, 3 Feb 2024 13:06:54 -0500 Subject: [PATCH] Set default proxy ports to spec For HTTP "If the port is empty or not given, port 80 is assumed." See: https://www.rfc-editor.org/rfc/rfc2616#section-3.2.2 For SOCKS "The SOCKS service is conventionally located on TCP port 1080." See: https://datatracker.ietf.org/doc/html/rfc1928#section-3 --- src/proxy.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/proxy.rs b/src/proxy.rs index df1baba9..3746cfdc 100644 --- a/src/proxy.rs +++ b/src/proxy.rs @@ -153,7 +153,10 @@ impl Proxy { server, user, password, - port: port.unwrap_or(8080), + port: port.unwrap_or(match proto { + Proto::HTTP => 80, + Proto::SOCKS4 | Proto::SOCKS4A | Proto::SOCKS5 => 1080, + }), proto, }) }