diff options
author | Dave Reisner <d@falconindy.com> | 2011-03-17 23:33:34 +0100 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-03-28 03:12:29 +0200 |
commit | 55f790ebe49ebf5a7d2084682735fd75f6d4903b (patch) | |
tree | 2c372ab1e6697d450e47b17f4bb48289f3d8e82a /lib/libalpm | |
parent | 283bf7e87cab1fa187334830fe2d05dd28bc5b77 (diff) | |
download | pacman-55f790ebe49ebf5a7d2084682735fd75f6d4903b.tar.gz pacman-55f790ebe49ebf5a7d2084682735fd75f6d4903b.tar.xz |
pacman/pacman.c: fix setting of useragent string
libcurl doesn't natively honor the HTTP_USER_AGENT environment variable.
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/dload.c | 7 |
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. */ |