[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
lynx-dev resolving weird URL types
From: |
Leonid Pauzner |
Subject: |
lynx-dev resolving weird URL types |
Date: |
Thu, 13 May 1999 14:58:07 +0400 (MSD) |
Example: press 'g' and enter xyz://aaa.bbb.cc URL.
Apparently, lynx will not reject weird URL schemes
at LYEnsureAbsoluteURL() / LYConvertURL() stage,
it will try to resolve DNS first.
Such URL prefixes normally rejected by is_url() in getfile()
with "Badly formed address" alert message
but user defined URLs (startfile, etc.) does serve another way.
Lynx Trace Log (2.8.2pre.3)
User message: Trace ON!
'xyz://aaa.bbb.cc' is not a URL
Converted 'xyz://aaa.bbb.cc' to 'c:/lynx/dist28/pre3/xyz://aaa.bbb.cc'
Can't stat() or fopen() 'c:/lynx/dist28/pre3/xyz://aaa.bbb.cc'
Looking up xyz: first.
In fact, there are two unsupported url types:
one without "://" so guessing is possible
and the other with unsupported prefix before "://" string (no guessing),
but is_url() use a single UNKNOWN_URL_TYPE.
IMO, LYEnsureAbsoluteURL() should filter out such urls itself. BTW,
LYConvertToURL() is used by LYEnsureAbsoluteURL() only (not public).
/*
** This function ensures that an href will be
** converted to a fully resolved, absolute URL,
** with guessing of the host or expansions of
** lead tildes via LYConvertToURL() if needed,
** and tweaking/simplifying via HTParse(). It
** is used for LynxHome, startfile, homepage,
** an 'g'oto entries, after they have been
** passed to LYFillLocalFileURL(). - FM
*/
PUBLIC void LYEnsureAbsoluteURL ARGS2(
char **, href,
CONST char *, name)
{
char *temp = NULL;
if (!(*href && *(*href)))
return;
/*
* If it is not a URL then make it one.
*/
if (!strcasecomp(*href, "news:")) {
StrAllocCat(*href, "*");
} else if (!strcasecomp(*href, "nntp:") ||
!strcasecomp(*href, "snews:")) {
StrAllocCat(*href, "/*");
}
if (!is_url(*href)) {
CTRACE(tfp, "%s%s'%s' is not a URL\n",
(name ? name : ""), (name ? " " : ""), *href);
LYConvertToURL(href);
}
if ((temp = HTParse(*href, "", PARSE_ALL)) != NULL && *temp != '\0')
StrAllocCopy(*href, temp);
FREE(temp);
}
/*
* Rewrite and reallocate a previously allocated string
* as a file URL if the string resolves to a file or
* directory on the local system, otherwise as an
* http URL. - FM
*/
PUBLIC void LYConvertToURL ARGS1(
char **, AllocatedString)
...
- lynx-dev resolving weird URL types,
Leonid Pauzner <=