summaryrefslogtreecommitdiff
path: root/lib/libfetch/http.c
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2014-06-05 20:27:16 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2014-06-05 20:27:16 +0000
commitc257f99e9b780a17756af5200ff895551f4f04fe (patch)
tree3b18ae8a5a7ff67e34ec08986a9202fa9a8326c8 /lib/libfetch/http.c
parentc835c70600b00de5948e87e34049ca54d538de6f (diff)
Notes
Diffstat (limited to 'lib/libfetch/http.c')
-rw-r--r--lib/libfetch/http.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index cbbb8a8d351f..983936c9a693 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -1683,10 +1683,15 @@ http_request(struct url *URL, const char *op, struct url_stat *us,
else
http_cmd(conn, "Referer: %s", p);
}
- if ((p = getenv("HTTP_USER_AGENT")) != NULL && *p != '\0')
- http_cmd(conn, "User-Agent: %s", p);
- else
- http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER, getprogname());
+ if ((p = getenv("HTTP_USER_AGENT")) != NULL) {
+ /* no User-Agent if defined but empty */
+ if (*p != '\0')
+ http_cmd(conn, "User-Agent: %s", p);
+ } else {
+ /* default User-Agent */
+ http_cmd(conn, "User-Agent: %s " _LIBFETCH_VER,
+ getprogname());
+ }
if (url->offset > 0)
http_cmd(conn, "Range: bytes=%lld-", (long long)url->offset);
http_cmd(conn, "Connection: close");