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

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