Hello,
This is a follow up to my message from October 2009 re successful
wget-1.12.1-devel mingw compile. We have since pushed that build out as an
optional supplemental utility for the GetGnuWin32 downloader.
I notice that there is a bug when specifying an input file. If I try something
like this it fails:
-------
C:\Users\Internet\Desktop>wget-1.12 -N -i "C:\users\internet\desktop\link.txt"
C:/users/internet/desktop/link.txt: Unsupported scheme `C'.
No URLs found in C:/users/internet/desktop/link.txt.
-------
I checked the source and it appears that the 'unsupported scheme' error is
caused because the path on windows can be misinterpreted as a URL. This traces
back to retrieve_from_file() in src/retr.c.
1.12.1-devel retrieve_from_file() is different from 1.11.4 in the way it
handles checking for a URL as the input file. Changes could be made to retr.c
retrieve_from_file() or maybe url.c url_has_scheme(), which doesn't really
validate any type of scheme.
Attached is a patch that eliminates the check in retrieve_from_file() for
url_has_scheme() and instead checks url_parse() to see determine if the input
file is a URL. This is probably sufficient since url_parse() checks
url_scheme().
Thanks,
Jay Satiro on behalf of GetGnuWin32 project
--- wget-1.12.1-devel-orig/src/retr.c 2009-09-09 19:59:46 -0400
+++ wget-1.12.1-devel/src/retr.c 2009-12-10 22:53:01 -0500
@@ -890,7 +890,9 @@
struct iri *iri = iri_new();
char *input_file = NULL;
- const char *url = file;
+
+ int url_err = 0;
+ struct url *url_parsed = NULL;
status = RETROK; /* Suppose everything is OK. */
*count = 0; /* Reset the URL count. */
@@ -899,19 +901,13 @@
set_uri_encoding (iri, opt.locale, true);
set_content_encoding (iri, opt.locale);
- if (url_has_scheme (url))
+ url_parsed = url_parse( file, &url_err, iri, true );
+ /* Check if input file is a URL */
+ if( url_parsed )
{
- int dt,url_err;
+ const char *url = file;
+ int dt = 0;
uerr_t status;
- struct url * url_parsed = url_parse(url, &url_err, iri, true);
-
- if (!url_parsed)
- {
- char *error = url_error (url, url_err);
- logprintf (LOG_NOTQUIET, "%s: %s.\n", url, error);
- xfree (error);
- return URLERROR;
- }
if (!opt.base_href)
opt.base_href = xstrdup (url);
@@ -934,7 +930,7 @@
xfree_null (iri->orig_url);
iri->orig_url = NULL;
}
- else
+ else /* input file is not a URL */
input_file = (char *) file;
url_list = (html ? get_urls_html (input_file, NULL, NULL, iri)