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 authored and algesten committed Mar 26, 2024
1 parent 489b305 commit fce56bb
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 fce56bb

Please sign in to comment.