diff options
| author | Junio C Hamano <gitster@pobox.com> | 2010-08-21 23:28:38 -0700 |
|---|---|---|
| committer | Junio C Hamano <gitster@pobox.com> | 2010-08-21 23:28:38 -0700 |
| commit | dfdb1e4150fb9c9ee86186e89987dc565bc91ead (patch) | |
| tree | 3c30de8114e7e3ff1c67fc388e1ed9b36ed46ce4 /http.c | |
| parent | e40b34b1ec2c91aaed5572116cd8d01afff7851f (diff) | |
| parent | b1d1058cc348a985a6209f920fab0db592dc83de (diff) | |
| download | git-dfdb1e4150fb9c9ee86186e89987dc565bc91ead.tar.xz | |
Merge branch 'so/http-user-agent'
* so/http-user-agent:
Allow HTTP user agent string to be modified.
Diffstat (limited to 'http.c')
| -rw-r--r-- | http.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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_HTTP_USER_AGENT); 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_HTTP_USER_AGENT"); + low_speed_limit = getenv("GIT_HTTP_LOW_SPEED_LIMIT"); if (low_speed_limit != NULL) curl_low_speed_limit = strtol(low_speed_limit, NULL, 10); |
