diff options
-rw-r--r-- | abuild-fetch.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/abuild-fetch.c b/abuild-fetch.c index 7145d7e..5adb5fc 100644 --- a/abuild-fetch.c +++ b/abuild-fetch.c @@ -81,7 +81,8 @@ int fetch(char *url, const char *destdir) { int lockfd, status=0; char outfile[PATH_MAX], partfile[PATH_MAX]; - char *name, *p; + char agent[50]; + char *name, *p, *env; struct flock fl = { .l_type = F_WRLCK, .l_whence = SEEK_SET, @@ -140,6 +141,18 @@ int fetch(char *url, const char *destdir) add_opt(&wgetcmd, "-c"); } + add_opt(&curlcmd, "-A"); + add_opt(&wgetcmd, "-U"); + env = getenv("ABUILD_USER_AGENT"); + if (env != NULL) { + add_opt(&curlcmd, env); + add_opt(&wgetcmd, env); + } else { + snprintf(agent, sizeof(agent), "abuild/%s", VERSTR); + add_opt(&curlcmd, agent); + add_opt(&wgetcmd, agent); + } + add_opt(&curlcmd, url); add_opt(&wgetcmd, url); |