Skip over credentials when lower casing host

svn path=/trunk/netsurf/; revision=12624
This commit is contained in:
John Mark Bell 2011-07-24 12:11:11 +00:00
parent cefcce0197
commit 3e1bd0d0bf
1 changed files with 13 additions and 1 deletions

View File

@ -288,9 +288,21 @@ url_func_result url_normalize(const char *url, char **result)
/* make host lower-case */ /* make host lower-case */
if (match[URL_RE_AUTHORITY].rm_so != -1) { if (match[URL_RE_AUTHORITY].rm_so != -1) {
/* Find @ delimiting credentials from host, if any */
for (i = match[URL_RE_AUTHORITY].rm_so; for (i = match[URL_RE_AUTHORITY].rm_so;
(regoff_t) i != match[URL_RE_AUTHORITY].rm_eo; (regoff_t) i != match[URL_RE_AUTHORITY].rm_eo;
i++) { i++) {
if (norm[i] == '@') {
i++;
break;
}
}
/* No credentials; transform entire host */
if ((regoff_t) i == match[URL_RE_AUTHORITY].rm_eo)
i = match[URL_RE_AUTHORITY].rm_so;
for (; (regoff_t) i != match[URL_RE_AUTHORITY].rm_eo; i++) {
if (norm[i] == ':' && (i + 3) < len) { if (norm[i] == ':' && (i + 3) < len) {
if (http && norm[i + 1] == '8' && if (http && norm[i + 1] == '8' &&
norm[i + 2] == '0' && norm[i + 2] == '0' &&