Support NTLM-Authentication against proxy.
I have include a minimal patch set to support NTLM authentification against a proxy server.
The patch adds a boolean configuration variable "http.proxyauthany" to enable CURLOPT_PROXYAUTH = CURLAUTH_ANY.
I'm not conform with your patch submitting policy. I had no chance to track the git repository from my current location.
Marco Schmidt
From 8a3892eca69a0c603a53b3d3aa052f45c4a5b648 Mon Sep 17 00:00:00 2001 From: Marco Schmidt <Marco.Schmidt@cassidian.com> Date: Fri, 27 Jan 2012 13:08:44 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Einf=FChren=20der=20HTTP=20Proxy=20Authentifi?= =?UTF-8?q?zierung?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit
--- http.c | 11 +++++++++++ 1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/http.c b/http.c index f3b2c90..dc51d41 100644 --- a/http.c +++ b/http.c @@ -41,6 +41,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 int curl_http_proxyauthany = 0; static const char *curl_cookie_file; static char *user_name, *user_pass, *description; static const char *user_agent; @@ -222,6 +223,10 @@ 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.proxyauthany", var)) { + curl_http_proxyauthany = git_config_bool(var, value); + } if (!strcmp("http.cookiefile", var)) return git_config_string(&curl_cookie_file, var, value); @@ -330,6 +335,12 @@ static CURL *get_curl_handle(void) if (curl_http_proxy) curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy); + + if (curl_http_proxyauthany) { + curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY); + printf("CURLOPT_PROXYAUTH!!!!"); + } + return result; }
--
1.7.8
From 2b7336c4959fc4df30da9e68f652f2c5941f0c91 Mon Sep 17 00:00:00 2001
From: Marco Schmidt <Marco.Schmidt@cassidian.com>
Date: Fri, 27 Jan 2012 14:35:15 +0100
Subject: [PATCH 3/4] First working step
---
http.c | 9 ++++++++-
1 files changed, 8 insertions(+), 1 deletions(-)
diff --git a/http.c b/http.c
index dc51d41..3dbd390 100644
--- a/http.c
+++ b/http.c
@@ -173,6 +173,8 @@ static int git_config_path(const char **result,
static int http_options(const char *var, const char *value, void *cb)
{
+ fprintf(stderr, "http_options: %s = %s\n", var, value);
+
if (!strcmp("http.sslverify", var)) {
curl_ssl_verify = git_config_bool(var, value);
return 0;
@@ -226,6 +228,8 @@ static int http_options(const char *var, const char *value, void *cb)
if (!strcmp("http.proxyauthany", var)) {
curl_http_proxyauthany = git_config_bool(var, value);
+ fprintf(stderr, "http_options: curl_http_proxyauthany = %i", curl_http_proxyauthany);
+ return 0;
}
if (!strcmp("http.cookiefile", var))
@@ -336,9 +340,12 @@ static CURL *get_curl_handle(void)
if (curl_http_proxy)
curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
+ fprintf(stderr, "DEBUG: curl_http_proxyauthany\n");
+
+ /* http proxy could be set from enviroment - set CURLOPT_PROXYAUTH */
if (curl_http_proxyauthany) {
curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
- printf("CURLOPT_PROXYAUTH!!!!");
+ fprintf(stderr, "curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);\n");
}
--
1.7.8
From 55b76b5f658904d240db29bb0d59f8c1dcedd4b5 Mon Sep 17 00:00:00 2001
From: Marco Schmidt <Marco.Schmidt@cassidian.com>
Date: Fri, 27 Jan 2012 14:40:57 +0100
Subject: [PATCH 4/4] remove debug information
---
http.c | 8 ++------
1 files changed, 2 insertions(+), 6 deletions(-)
diff --git a/http.c b/http.c
index 3dbd390..fbc52f0 100644
--- a/http.c
+++ b/http.c
@@ -173,8 +173,6 @@ static int git_config_path(const char **result,
static int http_options(const char *var, const char *value, void *cb)
{
- fprintf(stderr, "http_options: %s = %s\n", var, value);
-
if (!strcmp("http.sslverify", var)) {
curl_ssl_verify = git_config_bool(var, value);
return 0;
@@ -228,7 +226,6 @@ static int http_options(const char *var, const char *value, void *cb)
if (!strcmp("http.proxyauthany", var)) {
curl_http_proxyauthany = git_config_bool(var, value);
- fprintf(stderr, "http_options: curl_http_proxyauthany = %i", curl_http_proxyauthany);
return 0;
}
@@ -340,13 +337,12 @@ static CURL *get_curl_handle(void)
if (curl_http_proxy)
curl_easy_setopt(result, CURLOPT_PROXY, curl_http_proxy);
- fprintf(stderr, "DEBUG: curl_http_proxyauthany\n");
-
+#ifdef LIBCURL_CAN_HANDLE_AUTH_ANY
/* http proxy could be set from enviroment - set CURLOPT_PROXYAUTH */
if (curl_http_proxyauthany) {
curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);
- fprintf(stderr, "curl_easy_setopt(result, CURLOPT_PROXYAUTH, CURLAUTH_ANY);\n");
}
+#endif
return result;
--
1.7.8