Skip to content

Commit 3eff1c5

Browse files
MartinBastibagder
authored andcommitted
http_proxy: do not crash with HTTPS_PROXY and NO_PROXY set
... in case NO_PROXY takes an effect Without this patch, the following command crashes: $ GIT_CURL_VERBOSE=1 NO_PROXY=github.com HTTPS_PROXY=https://example.com \ git clone https://github.com/curl/curl.git Minimal libcurl-based reproducer: #include <curl/curl.h> int main() { CURL *curl = curl_easy_init(); if(curl) { CURLcode ret; curl_easy_setopt(curl, CURLOPT_URL, "https://github.com/"); curl_easy_setopt(curl, CURLOPT_PROXY, "example.com"); /* set the proxy type */ curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS); curl_easy_setopt(curl, CURLOPT_NOPROXY, "github.com"); curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L); ret = curl_easy_perform(curl); curl_easy_cleanup(curl); return ret; } return -1; } Assisted-by: Kamil Dudka Bug: https://bugzilla.redhat.com/1873327 Closes #5902
1 parent 63a111a commit 3eff1c5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/url.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2556,6 +2556,9 @@ static CURLcode create_conn_helper_init_proxy(struct connectdata *conn)
25562556
conn->bits.socksproxy = FALSE;
25572557
conn->bits.proxy_user_passwd = FALSE;
25582558
conn->bits.tunnel_proxy = FALSE;
2559+
/* CURLPROXY_HTTPS does not have its own flag in conn->bits, yet we need
2560+
to signal that CURLPROXY_HTTPS is not used for this connection */
2561+
conn->http_proxy.proxytype = CURLPROXY_HTTP;
25592562
}
25602563

25612564
out:

0 commit comments

Comments
 (0)