diff options
author | Daniel Stenberg <daniel@haxx.se> | 2016-08-15 10:46:27 +0200 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2016-08-15 10:46:27 +0200 |
commit | a96319ebb934ac8d3df4b88c8eb0d7ba00d5f883 (patch) | |
tree | dacbce1c3092220e96d0830795796c4517008ffc | |
parent | a5174b022bc8190eeda999418e7df56caa15b0c8 (diff) |
proxy: reject attempts to use unsupported proxy schemes
I discovered some people have been using "https://example.com" style
strings as proxy and it "works" (curl doesn't complain) because curl
ignores unknown schemes and then assumes plain HTTP instead.
I think this misleads users into believing curl uses HTTPS to proxies
when it doesn't. Now curl rejects proxy strings using unsupported
schemes instead of just ignoring and defaulting to HTTP.
-rw-r--r-- | lib/url.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -4706,7 +4706,13 @@ static CURLcode parse_proxy(struct Curl_easy *data, conn->proxytype = CURLPROXY_SOCKS4A; else if(checkprefix("socks4", proxy) || checkprefix("socks", proxy)) conn->proxytype = CURLPROXY_SOCKS4; - /* Any other xxx:// : change to http proxy */ + else if(checkprefix("http:", proxy)) + ; /* leave it as HTTP or HTTP/1.0 */ + else { + /* Any other xxx:// reject! */ + failf(data, "No support for proxy over the \'%s\' scheme", proxy); + return CURLE_COULDNT_CONNECT; + } } else proxyptr = proxy; /* No xxx:// head: It's a HTTP proxy */ |