From 3f51773542ff65075706f08088b91af6bf9e278e Mon Sep 17 00:00:00 2001 From: hniksic Date: Tue, 21 Nov 2006 14:18:12 -0800 Subject: [PATCH] [svn] Fixed problem with recursive FTP retrieval. --- src/ChangeLog | 9 +++++++++ src/main.c | 2 +- src/retr.c | 16 +++++++++++++++- src/retr.h | 2 ++ 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/ChangeLog b/src/ChangeLog index 64177542..d4fc68fd 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,12 @@ +2006-11-21 Hrvoje Niksic + + * retr.c (retrieve_from_file): Ditto. + (url_uses_proxy): New function. + + * main.c (main): Don't check for opt.use_proxy when deciding + whether to call retrieve_url or retrieve_tree; check whether the + proxy would be used for *this* URL. + 2006-10-17 Mike Grant * ftp.c (ftp_loop_internal): Would incorrectly skip changing diff --git a/src/main.c b/src/main.c index 1f3880fd..790b0279 100644 --- a/src/main.c +++ b/src/main.c @@ -967,7 +967,7 @@ Can't timestamp and not clobber old files at the same time.\n")); int dt; if ((opt.recursive || opt.page_requisites) - && (url_scheme (*t) != SCHEME_FTP || opt.use_proxy)) + && (url_scheme (*t) != SCHEME_FTP || url_uses_proxy (*t))) { int old_follow_ftp = opt.follow_ftp; diff --git a/src/retr.c b/src/retr.c index 469433ca..a2d462a8 100644 --- a/src/retr.c +++ b/src/retr.c @@ -844,7 +844,7 @@ retrieve_from_file (const char *file, bool html, int *count) break; } if ((opt.recursive || opt.page_requisites) - && (cur_url->url->scheme != SCHEME_FTP || opt.use_proxy)) + && (cur_url->url->scheme != SCHEME_FTP || getproxy (cur_url->url))) { int old_follow_ftp = opt.follow_ftp; @@ -1022,6 +1022,20 @@ getproxy (struct url *u) return proxy; } +/* Returns true if URL would be downloaded through a proxy. */ + +bool +url_uses_proxy (const char *url) +{ + bool ret; + struct url *u = url_parse (url, NULL); + if (!u) + return false; + ret = getproxy (u) != NULL; + url_free (u); + return ret; +} + /* Should a host be accessed through proxy, concerning no_proxy? */ static bool no_proxy_match (const char *host, const char **no_proxy) diff --git a/src/retr.h b/src/retr.h index 645fde55..930f7000 100644 --- a/src/retr.h +++ b/src/retr.h @@ -61,4 +61,6 @@ void sleep_between_retrievals (int); void rotate_backups (const char *); +bool url_uses_proxy (const char *); + #endif /* RETR_H */ -- 2.39.2