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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Spencer E. Olson" <olsonse@xxxxxxxxx> writes:

> 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 ")".

>  
>  	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...
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]