Skip to content

Instantly share code, notes, and snippets.

@tanacasino
Created August 23, 2013 05:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tanacasino/6315788 to your computer and use it in GitHub Desktop.
Save tanacasino/6315788 to your computer and use it in GitHub Desktop.
diff --git a/http.c b/http.c
index 92aba59..8f49e63 100644
--- a/http.c
+++ b/http.c
@@ -44,6 +44,7 @@ static long curl_low_speed_limit = -1;
static long curl_low_speed_time = -1;
static int curl_ftp_no_epsv;
static const char *curl_http_proxy;
+static const char *curl_http_noproxy;
static const char *curl_cookie_file;
static struct credential http_auth = CREDENTIAL_INIT;
static int http_proactive_auth;
@@ -198,6 +199,9 @@ static int http_options(const char *var, const char *value, void *cb)
if (!strcmp("http.proxy", var))
return git_config_string(&curl_http_proxy, var, value);
+ if (!strcmp("http.noproxy", var))
+ return git_config_string(&curl_http_noproxy, var, value);
+
if (!strcmp("http.cookiefile", var))
return git_config_string(&curl_cookie_file, var, value);
@@ -319,6 +323,7 @@ static CURL *get_curl_handle(void)
if (curl_http_proxy) {
curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
+ curl_easy_setopt(result, CURLOPT_NOPROXY, curl_http_noproxy);
}
return result;
@@ -447,6 +452,11 @@ void http_cleanup(void)
curl_http_proxy = NULL;
}
+ if (curl_http_noproxy) {
+ free((void *)curl_http_noproxy);
+ curl_http_noproxy = NULL;
+ }
+
if (cert_auth.password != NULL) {
memset(cert_auth.password, 0, strlen(cert_auth.password));
free(cert_auth.password);
@tanacasino
Copy link
Author

Ubuntu 12.04

$ sudo apt-get build-dep git
$ wget http://git-core.googlecode.com/files/git-1.8.3.2.tar.gz
$ tar xzf git-1.8.3.2.tar.gz
$ cd git-1.8.3.2

# apply patch

$ ./configure --prefix=$HOME/local/packages/git-1.8.3.2-noproxy
$ make
$ make install
$ $HOME/local/packages/git-1.8.3.2/bin/git --version
git version 1.8.3.2
# gitconfig
[http]
    proxy = http://proxy.example.com:8080
    noproxy = localhost,192.168.32.118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment