Uh oh!
There was an error while loading. Please reload this page.
Consistently use CreateProxyUri in WebProxy ctors - #62338
Conversation
ghost
commented
Dec 3, 2021
Tagging subscribers to this area: @dotnet/ncl Issue Details
The If you happentocreate a We should either check if the host is already an absolute Uri like we do for other overloads (this PR), or we should throw. cc: @ManickaP who noticed our blog posts announcing
|
Uh oh!
There was an error while loading. Please reload this page.
WebProxyhasnew(Uri Address),new(string Address),new(string Host, int Port)constructors that all behave differently.The
new(string)overload will check if the address is an absolute Uri and add a"http://"prefix otherwise.The
new(string, int)overload will blindly concat the host and port$"http://{Host}:{Port}".If you happentocreate a
WebProxyobject likenew WebProxy("socks5://127.0.0.1", 9050), what you actually end up with is a proxy to"http://socks5://127.0.0.1:9050"- an http proxy with the hostsocks5and a default port.We should either check if the host is already an absolute Uri like we do for other overloads (this PR), or we should throw.
socks5://127.0.0.1is not a valid host, it just happens to be interpreted as:Host:
socks5Port:
:(empty port is allowed and means "default for the scheme")Path:
//127.0.0.1cc: @ManickaP who noticed our blog posts announcing
sockssupport have broken code snippets.