Blame SOURCES/0023-curl-7.61.1-no-https-proxy-crash.patch

e88b99
From 9d5903ebcbcbcc4f3a997ec7d5552721c5383b9f Mon Sep 17 00:00:00 2001
e88b99
From: =?UTF-8?q?Martin=20Ba=C5=A1ti?= <mbasti@redhat.com>
e88b99
Date: Thu, 27 Aug 2020 23:09:56 +0200
e88b99
Subject: [PATCH] http_proxy: do not crash with HTTPS_PROXY and NO_PROXY set
e88b99
e88b99
... in case NO_PROXY takes an effect
e88b99
e88b99
Without this patch, the following command crashes:
e88b99
e88b99
    $ GIT_CURL_VERBOSE=1 NO_PROXY=github.com HTTPS_PROXY=https://example.com \
e88b99
        git clone https://github.com/curl/curl.git
e88b99
e88b99
Minimal libcurl-based reproducer:
e88b99
e88b99
    #include <curl/curl.h>
e88b99
e88b99
    int main() {
e88b99
      CURL *curl = curl_easy_init();
e88b99
      if(curl) {
e88b99
        CURLcode ret;
e88b99
        curl_easy_setopt(curl, CURLOPT_URL, "https://github.com/");
e88b99
        curl_easy_setopt(curl, CURLOPT_PROXY, "example.com");
e88b99
        /* set the proxy type */
e88b99
        curl_easy_setopt(curl, CURLOPT_PROXYTYPE, CURLPROXY_HTTPS);
e88b99
        curl_easy_setopt(curl, CURLOPT_NOPROXY, "github.com");
e88b99
        curl_easy_setopt(curl, CURLOPT_VERBOSE, 1L);
e88b99
        ret = curl_easy_perform(curl);
e88b99
        curl_easy_cleanup(curl);
e88b99
        return ret;
e88b99
      }
e88b99
      return -1;
e88b99
    }
e88b99
e88b99
Assisted-by: Kamil Dudka
e88b99
Bug: https://bugzilla.redhat.com/1873327
e88b99
Closes #5902
e88b99
e88b99
Upstream-commit: 3eff1c5092e542819ac7e6454a70c94b36ab2a40
e88b99
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
e88b99
---
e88b99
 lib/url.c | 3 +++
e88b99
 1 file changed, 3 insertions(+)
e88b99
e88b99
diff --git a/lib/url.c b/lib/url.c
e88b99
index d65d17d..e77f391 100644
e88b99
--- a/lib/url.c
e88b99
+++ b/lib/url.c
e88b99
@@ -3074,6 +3074,9 @@ static CURLcode create_conn_helper_init_proxy(struct connectdata *conn)
e88b99
     conn->bits.socksproxy = FALSE;
e88b99
     conn->bits.proxy_user_passwd = FALSE;
e88b99
     conn->bits.tunnel_proxy = FALSE;
e88b99
+    /* CURLPROXY_HTTPS does not have its own flag in conn->bits, yet we need
e88b99
+       to signal that CURLPROXY_HTTPS is not used for this connection */
e88b99
+    conn->http_proxy.proxytype = CURLPROXY_HTTP;
e88b99
   }
e88b99
 
e88b99
 out:
e88b99
-- 
e88b99
2.25.4
e88b99