Re: [PATCH][v2] http authentication via prompts (with correct line lengths)
- From
Mike Ralphson <mike.ralphson@gmail.com>
- Date
- Mar 12, 2009, 08:53 UTC
- Message-ID
- <e2b179460903120153u5fdb58b6tf3027eea23673df0@mail.gmail.com>
- In-Reply-To
- <7v63ihdgy6.fsf@gitster.siamese.dyndns.org>
2009/3/10 Junio C Hamano <gitster@pobox.com>:
Show 30 quoted lines
> 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