git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/6] http: try http_proxy env var when http.proxy config option is not set

From
Junio C Hamano <gitster@pobox.com>
Date
May 3, 2012, 18:05 UTC
Message-ID
<7vk40tf8cy.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4FA2B4D3.90809@seap.minhap.es>
Nelson Benitez Leon <nelsonjesus.benitez@seap.minhap.es> writes:
Show 21 quoted lines
> cURL already reads it, but if $http_proxy has username but no password
> cURL will not ask you for the password and so failed to authenticate
> returning a 407 error code. So we read it ourselves to detect that and
> ask for the password. Also we read it prior to connection to be able to
> make a proactive authentication in case the flag http_proactive_auth is
> set.
>
> We also take care to read env proxy var according to protocol being
> used in the destination url, e.g.  when the url to retrieve is a https
> one, then the proxy env var we look at is https_proxy. We also look at
> the uppercase version of these if the lowercase is not found, with the
> exception of HTTP_PROXY because cURL ignores it. To make this possible
> we now passed destination url parameter to get_active_slot() and
> get_curl_handle() functions.
>
> We also read no_proxy env var so to ignore aforementioned proxy env var
> if no_proxy contains an asterisk ('*') or contains the host used in url
> destination.
>
> Signed-off-by: Nelson Benitez Leon <nbenitezl@gmail.com>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>

I'll trust Peff to point out anything I missed, but from a cursory look, the result looks much cleaner than the previous round.

Show 8 quoted lines
> diff --git a/http.c b/http.c
> index 5cb87f1..64df7b1 100644
> --- a/http.c
> +++ b/http.c
> @@ -229,6 +229,37 @@ static void init_curl_http_auth(CURL *result)
> ...
> +static int host_allowed_by_noproxy_env (const char *host)
> +{

I'll queue the updated series with s/_env (/_env(/; here, and also add a missing explanation on the bulk of "noise" in the patch at the end of the log message:

    In order to be able to determine what proxy settings is needed from
    the very beginning of a request, get_active_slot() learns to take the
    destination URL, as it needs to pass it to get_curl_handle() that
    implements the logic to pick proxies based on the protocol used.
Thanks.
Previous: Nelson Benitez LeonNext: Jeff King
Message 2 of 9 in “http: try http_proxy env var when http.proxy config option is not set”
  1. 1/6 http: try http_proxy env var when http.proxy config option is not setNelson Benitez Leon, May 3, 2012
  2. Junio C HamanoMay 3, 2012
  3. Jeff KingMay 4, 2012
  4. Daniel StenbergMay 4, 2012
  5. Jeff KingMay 4, 2012
  6. Daniel StenbergMay 4, 2012
  7. Junio C HamanoMay 4, 2012
  8. Jeff KingMay 4, 2012
  9. Junio C HamanoMay 4, 2012

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.