diff options
author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2007-12-18 11:03:07 +0000 |
---|---|---|
committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2007-12-18 11:03:07 +0000 |
commit | 62a2681c93b202959570b3ddecdbf40ced6bdebe (patch) | |
tree | f5124fad1675d5be07f4721b1851e7bf4d8359a5 /lib/libfetch/http.c | |
parent | 836e34eeae25a1ac5c6f284907308bb68fa8ba3d (diff) | |
download | src-62a2681c93b202959570b3ddecdbf40ced6bdebe.tar.gz src-62a2681c93b202959570b3ddecdbf40ced6bdebe.zip |
Add support for the NO_PROXY / no_proxy environment variable as used by
lynx, curl etc. Note that this patch differs significantly from that
in the PR, as the submitter refined it after submitting the PR.
PR: 110388
Submitted by: Alexander Pohoyda <alexander.pohoyda@gmx.net>
MFC after: 3 weeks
Notes
Notes:
svn path=/head/; revision=174752
Diffstat (limited to 'lib/libfetch/http.c')
-rw-r--r-- | lib/libfetch/http.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index 909b91c82975..c89f5f1c02ce 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -719,13 +719,15 @@ http_connect(struct url *URL, struct url *purl, const char *flags) } static struct url * -http_get_proxy(const char *flags) +http_get_proxy(struct url * url, const char *flags) { struct url *purl; char *p; if (flags != NULL && strchr(flags, 'd') != NULL) return (NULL); + if (fetch_no_proxy_match(url->host)) + return (NULL); if (((p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) && *p && (purl = fetchParseURL(p))) { if (!*purl->scheme) @@ -1168,7 +1170,7 @@ ouch: FILE * fetchXGetHTTP(struct url *URL, struct url_stat *us, const char *flags) { - return (http_request(URL, "GET", us, http_get_proxy(flags), flags)); + return (http_request(URL, "GET", us, http_get_proxy(URL, flags), flags)); } /* @@ -1198,7 +1200,7 @@ fetchStatHTTP(struct url *URL, struct url_stat *us, const char *flags) { FILE *f; - f = http_request(URL, "HEAD", us, http_get_proxy(flags), flags); + f = http_request(URL, "HEAD", us, http_get_proxy(URL, flags), flags); if (f == NULL) return (-1); fclose(f); |