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 4, 2024
1 parent 2300a5b commit d6c890c
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(match proto {
Proto::HTTP => 80,
Proto::SOCKS4 | Proto::SOCKS4A | Proto::SOCKS5 => 1080,
}),
proto,
})
}
Expand Down

0 comments on commit d6c890c

Please sign in to comment.