1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

Check stricter for supported URL scheme.

This commit is contained in:
Steven Schubiger 2010-03-02 21:41:32 +01:00
parent f391a5b5b0
commit 33d8b23dfd
4 changed files with 18 additions and 1 deletions

View File

@ -1,3 +1,12 @@
2010-03-02 Steven Schubiger <stsc@member.fsf.org>
* retr.c (retrieve_from_file): Improve checking for a URL
by invoking url_valid_scheme instead of url_has_scheme.
* url.c (url_valid_scheme): New function.
* url.h: Add declaration for url_valid_scheme.
2010-03-02 Steven Schubiger <stsc@member.fsf.org>
* retr.c (retrieve_from_file): Free memory of input file.

View File

@ -899,7 +899,7 @@ retrieve_from_file (const char *file, bool html, int *count)
set_uri_encoding (iri, opt.locale, true);
set_content_encoding (iri, opt.locale);
if (url_has_scheme (url))
if (url_valid_scheme (url))
{
int dt,url_err;
uerr_t status;

View File

@ -463,6 +463,13 @@ url_has_scheme (const char *url)
return *p == ':';
}
bool
url_valid_scheme (const char *url)
{
enum url_scheme scheme = url_scheme (url);
return scheme != SCHEME_INVALID;
}
int
scheme_default_port (enum url_scheme scheme)
{

View File

@ -94,6 +94,7 @@ void url_free (struct url *);
enum url_scheme url_scheme (const char *);
bool url_has_scheme (const char *);
bool url_valid_scheme (const char *);
int scheme_default_port (enum url_scheme);
void scheme_disable (enum url_scheme);