[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-wget] wget-1.12.1-devel: 'Unsupported scheme' and windows pathn
Re: [Bug-wget] wget-1.12.1-devel: 'Unsupported scheme' and windows pathnames
Sat, 12 Dec 2009 22:17:32 -0800 (PST)
On windows this is valid:
C:\Users\Internet\Desktop>if exist c://file.txt echo hi
Rarely have I seen something output using double forward slashes but "mixed"
scripts could use that format although probably not intentional.
I can't find any valid single character schemes. Would it break anything to
return false if the scheme name is only one character? That would be stricter.
I rewrote url_has_scheme(), patch attached. This supersedes the patch I
submitted for retr.c
--- On Sat, 12/12/09, Steven Schubiger <address@hidden> wrote:
From: Steven Schubiger <address@hidden>
Subject: Re: [Bug-wget] wget-1.12.1-devel: 'Unsupported scheme' and windows
To: "Ray Satiro" <address@hidden>
Date: Saturday, December 12, 2009, 9:14 AM
Ray Satiro <address@hidden> wrote:
> 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
I'd prefer patching url_has_scheme() to test for schemes more strictly;
the implementation would add a check for a double slash at the end of
the scheme and colon (which are part of the URL).
Attached a patch for review.
Description: Text Data