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

Re: [PATCH v3] Allow HTTP user agent string to be modified.

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 11, 2010, 20:08 UTC
Message-ID
<7v62zgyks6.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1281504288-31836-1-git-send-email-olsonse@umich.edu>
"Spencer E. Olson" <olsonse@umich.edu> writes:
Show 29 quoted lines
> diff --git a/http.c b/http.c
> index 1320c50..b0b6925 100644
> --- a/http.c
> +++ b/http.c
> @@ -41,6 +41,7 @@ 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 const char *user_agent;
>  
>  #if LIBCURL_VERSION_NUM >= 0x071700
>  /* Use CURLOPT_KEYPASSWD as is */
> @@ -196,6 +197,9 @@ static int http_options(const char *var, const char *value, void *cb)
>  		return 0;
>  	}
>  
> +	if (!strcmp("http.useragent", var))
> +		return git_config_string(&user_agent, var, value);
> +
>  	/* Fall back on the default ones */
>  	return git_default_config(var, value, cb);
>  }
> @@ -279,7 +283,8 @@ static CURL *get_curl_handle(void)
>  	if (getenv("GIT_CURL_VERBOSE"))
>  		curl_easy_setopt(result, CURLOPT_VERBOSE, 1);
>  
> -	curl_easy_setopt(result, CURLOPT_USERAGENT, GIT_USER_AGENT);
> +	curl_easy_setopt(result, CURLOPT_USERAGENT,
> +		user_agent ? user_agent : GIT_USER_AGENT );
Excess space before ")".
Show 8 quoted lines
>  
>  	if (curl_ftp_no_epsv)
>  		curl_easy_setopt(result, CURLOPT_FTP_USE_EPSV, 0);
> @@ -380,6 +385,8 @@ void http_init(struct remote *remote)
>  #endif
>  	set_from_env(&ssl_cainfo, "GIT_SSL_CAINFO");
>  
> +	set_from_env(&user_agent, "GIT_USER_AGENT");

The name GIT_USER_AGENT may be Ok as an internal token used in our http implementation, but the environment variable is an end-user facing entity.

Don't we want to say HTTP somewhere, e.g. "GIT_HTTP_USER_AGENT"?

If "User Agent" means the "browser claims to be..." thing to everybody without much context then I won't worry too much, but MUA is a mail user agent, and we do use the term in our docs when describing send-email, so...

Previous: Tay Ray ChuanNext: Spencer E. Olson
Message 10 of 14 in “Allow HTTP user agent string to be modified.”
  1. Allow HTTP user agent string to be modified.Spencer E. Olson, Aug 7, 2010
  2. Ævar Arnfjörð BjarmasonAug 7, 2010
  3. Spencer E. OlsonAug 7, 2010
  4. Ævar Arnfjörð BjarmasonAug 7, 2010
  5. Tay Ray ChuanAug 8, 2010
  6. Tay Ray ChuanAug 8, 2010
  7. Spencer E. OlsonAug 8, 2010
  8. Allow HTTP user agent string to be modified.Spencer E. Olson, Aug 11, 2010
  9. Tay Ray ChuanAug 11, 2010
  10. Junio C HamanoAug 11, 2010
  11. Allow HTTP user agent string to be modified.Spencer E. Olson, Aug 11, 2010
  12. Jacob HelwigAug 11, 2010
  13. Allow HTTP user agent string to be modified.Spencer E. Olson, Aug 11, 2010
  14. Junio C HamanoAug 12, 2010

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.