-
Notifications
You must be signed in to change notification settings - Fork 177
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set default proxy ports to spec #717
Conversation
Hit @DanGould, welcome to ureq! Is there a spec regarding this for proxies? I don't know why this is 8080 for the proxy. Could just be a mistake. |
Based on some examples [using 8080 in this codebase], I have a feeling it was just a mistake carried over in testing. The RFC that defines HTTP and the CONNECT method says 80 is assumed to be the default. HTTP proxy is just plain http with this method as I understand. However, curl does default the http proxy to 1080 for "purely historical" reasons, but if the proxy is https (not yet supported by ureq) it defaults to 443 in my experience. |
Looks like SOCKS conventionally listens on port 1080 by spec actually, so I've adjusted the default behavior to match that too |
718c972
to
3077979
Compare
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
3077979
to
d6c890c
Compare
force pushed to fix clippy lints |
In further testing, I discovered that The fact that default port numbers are elided by parsing is documented in the I certainly interpret the behavior before the change this PR makes as a bug. |
So what are we saying the behavior for http://example.com:80 should be with regards to the proxy port? |
Current behavior
Desired behavior
|
Alright! This is ready to merge then? Is this a potential breaking change? |
Yes. I think this is a breaking change for anyone depending on the 8080 default. That's an odd behavior to depend on but I wouldn't say it's impossible. |
I think it can be argued that depending on 8080 being the default is not correct behavior. |
Thanks for sticking with me and merging this. I think this makes #719 a bit easier so I'll have a revisit to that now |
Thank you! |
"If the port number is not specified, 80 is always assumed for HTTP."
See: https://www.w3.org/Protocols/HTTP/AsImplemented.html
It was strange behavior to me to default to 8080