summaryrefslogtreecommitdiff
path: root/lib/libalpm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/dload.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index a6225fa4..482cf11d 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -157,7 +157,7 @@ static int curl_download_internal(const char *url, const char *localpath,
{
int ret = -1;
FILE *localf = NULL;
- char *destfile, *tempfile;
+ char *useragent, *destfile, *tempfile;
char hostname[256]; /* RFC1123 states applications should support this length */
struct stat st;
long httpresp, timecond, remote_time, local_time;
@@ -187,6 +187,11 @@ static int curl_download_internal(const char *url, const char *localpath,
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSFUNCTION, curl_progress);
curl_easy_setopt(handle->curl, CURLOPT_PROGRESSDATA, (void*)&dlfile);
+ useragent = getenv("HTTP_USER_AGENT");
+ if (useragent != NULL) {
+ curl_easy_setopt(handle->curl, CURLOPT_USERAGENT, useragent);
+ }
+
if(!force && stat(destfile, &st) == 0) {
/* assume its a sync, so we're starting from scratch. but, only download
* our local is out of date. */