Thread (6 messages) flat view 6 messages, 3 authors, 2016-06-15

Re: [PATCH][v2] http authentication via prompts (with correct line lengths)

From: Mike Ralphson <hidden>
Date: 2016-06-15 22:46:22

Possibly related (same subject, not in this thread)

2009/3/10 Junio C Hamano [off-list ref]:
quoted hunk ↗ jump to hunk
diff --git a/http.c b/http.c
index f4f0bf6..3d5caa6 100644
--- a/http.c
+++ b/http.c
@@ -25,6 +25,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 char *user_name, *user_pass;

 static struct curl_slist *pragma_header;
@@ -135,6 +136,20 @@ static int http_options(const char *var, const char *value, void *cb)
       return git_default_config(var, value, cb);
 }

+static void init_curl_http_auth(CURL *result)
+{
+       if (!user_name)
+               curl_easy_setopt(result, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
+       else {
+               struct strbuf up = STRBUF_INIT;
+               if (!user_pass)
+                       user_pass = xstrdup(getpass("Password: "));
+               strbuf_addf(&up, "%s:%s", user_name, user_pass);
+               curl_easy_setopt(result, CURLOPT_USERPWD,
+                                strbuf_detach(&up, NULL));
+       }
+}
+
Elsewhere we seem to protect use of CURL_NETRC_OPTIONAL by checking
for LIBCURL_VERSION_NUM >= 0x070907. I have an ancient curl here
(curl-7.9.3-2ssl) which doesn't seem to have this option, so building
next is broken on AIX for me from this morning (c33976cb).

Is there a specific minimum version of curl we want to continue supporting?

Mike
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help