Skip to content

Commit

Permalink
Set default proxy ports to spec
Browse files Browse the repository at this point in the history
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
  • Loading branch information
DanGould committed Feb 3, 2024
1 parent 2300a5b commit 3077979
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ impl Proxy {
server,
user,
password,
port: port.unwrap_or(8080),
port: port.unwrap_or_else(|| match proto {

Check failure on line 156 in src/proxy.rs

View workflow job for this annotation

GitHub Actions / Lint

unnecessary closure used to substitute value for `Option::None`
Proto::HTTP => 80,
Proto::SOCKS4 | Proto::SOCKS4A | Proto::SOCKS5 => 1080,
}),
proto,
})
}
Expand Down

0 comments on commit 3077979

Please sign in to comment.