[lxd-import] shared/proxy: allow SOCKS5 proxy

Signed-off-by: montag451 <montag451@laposte.net>
This commit is contained in:
montag451 2023-07-21 22:27:26 +02:00 committed by Stéphane Graber
parent fc097b3991
commit df94d23e89
No known key found for this signature in database
GPG Key ID: C638974D64792D67

View File

@ -94,7 +94,7 @@ func FromConfig(httpsProxy string, httpProxy string, noProxy string) func(req *h
}
proxyURL, err := url.Parse(proxy)
if err != nil || !strings.HasPrefix(proxyURL.Scheme, "http") {
if err != nil || (!strings.HasPrefix(proxyURL.Scheme, "http") && proxyURL.Scheme != "socks5") {
// proxy was bogus. Try prepending "http://" to it and
// see if that parses correctly. If not, we fall
// through and complain about the original one.