summaryrefslogtreecommitdiffstats
path: root/lib/libfetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2003-03-11 08:20:58 +0000
committerdes <des@FreeBSD.org>2003-03-11 08:20:58 +0000
commit2d46bf6bbe227b10fa418d61d049c9bf1a984ac9 (patch)
tree8aa030b87e93c4ace4debb91dc4978fa0fed48c8 /lib/libfetch
parent1e928d54806ca69c465ef9643ecf10508b692377 (diff)
downloadFreeBSD-src-2d46bf6bbe227b10fa418d61d049c9bf1a984ac9.zip
FreeBSD-src-2d46bf6bbe227b10fa418d61d049c9bf1a984ac9.tar.gz
Don't parse the proxy URL unless we're actually going to use it. No real
functional difference, but debugging output will be less confusing.
Diffstat (limited to 'lib/libfetch')
-rw-r--r--lib/libfetch/ftp.c15
-rw-r--r--lib/libfetch/http.c9
2 files changed, 16 insertions, 8 deletions
diff --git a/lib/libfetch/ftp.c b/lib/libfetch/ftp.c
index 56d0bf5..b2550b1 100644
--- a/lib/libfetch/ftp.c
+++ b/lib/libfetch/ftp.c
@@ -889,11 +889,13 @@ _ftp_cached_connect(struct url *url, struct url *purl, const char *flags)
* Check the proxy settings
*/
static struct url *
-_ftp_get_proxy(void)
+_ftp_get_proxy(const char *flags)
{
struct url *purl;
char *p;
+ if (strchr(flags, 'd') != NULL)
+ return (NULL);
if (((p = getenv("FTP_PROXY")) || (p = getenv("ftp_proxy")) ||
(p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
*p && (purl = fetchParseURL(p)) != NULL) {
@@ -970,7 +972,7 @@ _ftp_request(struct url *url, const char *op, struct url_stat *us,
FILE *
fetchXGetFTP(struct url *url, struct url_stat *us, const char *flags)
{
- return (_ftp_request(url, "RETR", us, _ftp_get_proxy(), flags));
+ return (_ftp_request(url, "RETR", us, _ftp_get_proxy(flags), flags));
}
/*
@@ -989,8 +991,8 @@ FILE *
fetchPutFTP(struct url *url, const char *flags)
{
- return _ftp_request(url, CHECK_FLAG('a') ? "APPE" : "STOR", NULL,
- _ftp_get_proxy(), flags);
+ return (_ftp_request(url, CHECK_FLAG('a') ? "APPE" : "STOR", NULL,
+ _ftp_get_proxy(flags), flags));
}
/*
@@ -999,9 +1001,12 @@ fetchPutFTP(struct url *url, const char *flags)
int
fetchStatFTP(struct url *url, struct url_stat *us, const char *flags)
{
+ FILE *f;
- if (_ftp_request(url, "STAT", us, _ftp_get_proxy(), flags) == NULL)
+ f = _ftp_request(url, "STAT", us, _ftp_get_proxy(flags), flags);
+ if (f == NULL)
return (-1);
+ fclose(f);
return (0);
}
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c
index 5f44c53..1fc4cd5 100644
--- a/lib/libfetch/http.c
+++ b/lib/libfetch/http.c
@@ -696,11 +696,13 @@ _http_connect(struct url *URL, struct url *purl, const char *flags)
}
static struct url *
-_http_get_proxy(void)
+_http_get_proxy(const char *flags)
{
struct url *purl;
char *p;
+ if (strchr(flags, 'd') != NULL)
+ return (NULL);
if (((p = getenv("HTTP_PROXY")) || (p = getenv("http_proxy"))) &&
(purl = fetchParseURL(p))) {
if (!*purl->scheme)
@@ -1108,7 +1110,7 @@ ouch:
FILE *
fetchXGetHTTP(struct url *URL, struct url_stat *us, const char *flags)
{
- return (_http_request(URL, "GET", us, _http_get_proxy(), flags));
+ return (_http_request(URL, "GET", us, _http_get_proxy(flags), flags));
}
/*
@@ -1138,7 +1140,8 @@ fetchStatHTTP(struct url *URL, struct url_stat *us, const char *flags)
{
FILE *f;
- if ((f = _http_request(URL, "HEAD", us, _http_get_proxy(), flags)) == NULL)
+ f = _http_request(URL, "HEAD", us, _http_get_proxy(flags), flags);
+ if (f == NULL)
return (-1);
fclose(f);
return (0);
OpenPOWER on IntegriCloud