mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Implement a HTTP_USER_AGENT environment variable.
PR: 27669 Submitted by: Eoin Lawless <eoin@maths.tcd.ie>
This commit is contained in:
parent
5ef824ed2b
commit
6a0cf64bce
2 changed files with 8 additions and 1 deletions
|
|
@ -512,6 +512,10 @@ variable.
|
|||
This variable is used if and only if connected to an HTTP proxy, and
|
||||
is ignored if a user and/or a password were specified in the proxy
|
||||
URL.
|
||||
.It Ev HTTP_USER_AGENT
|
||||
Specifies the User-Agent string to use for HTTP requests.
|
||||
This can be useful when working with HTTP origin or proxy servers that
|
||||
differentiate between usder agents.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr fetch 1 ,
|
||||
|
|
|
|||
|
|
@ -777,7 +777,10 @@ _http_request(struct url *URL, const char *op, struct url_stat *us,
|
|||
}
|
||||
|
||||
/* other headers */
|
||||
_http_cmd(fd, "User-Agent: %s " _LIBFETCH_VER, __progname);
|
||||
if ((p = getenv("HTTP_USER_AGENT")) != NULL && *p != '\0')
|
||||
_http_cmd(fd, "User-Agent: %s", p);
|
||||
else
|
||||
_http_cmd(fd, "User-Agent: %s " _LIBFETCH_VER, __progname);
|
||||
if (url->offset)
|
||||
_http_cmd(fd, "Range: bytes=%lld-", url->offset);
|
||||
_http_cmd(fd, "Connection: close");
|
||||
|
|
|
|||
Loading…
Reference in a new issue