Skip to content

http_proxy: do not crash with HTTPS_PROXY and NO_PROXY set#5902

Closed
kdudka wants to merge 1 commit intocurl:masterfrom
kdudka:https-no-proxy
Closed

http_proxy: do not crash with HTTPS_PROXY and NO_PROXY set#5902
kdudka wants to merge 1 commit intocurl:masterfrom
kdudka:https-no-proxy

Conversation

@kdudka
Copy link
Contributor

@kdudka kdudka commented Sep 1, 2020

... 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

... 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
Copy link
Member

@bagder bagder left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch!

@bagder
Copy link
Member

bagder commented Sep 3, 2020

Thanks!

@kdudka kdudka deleted the https-no-proxy branch October 1, 2020 14:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants