Bug 377052 - nsBaseURLParser::ParseURL doesn't handle spaces embedded in the scheme properly r=mcmanus

This commit is contained in:
Valentin Gosu 2016-02-01 14:07:16 +01:00
parent 8fa824bcaf
commit f2674e1627

View File

@ -62,17 +62,21 @@ nsBaseURLParser::ParseURL(const char *spec, int32_t specLen,
const char *stop = nullptr;
const char *colon = nullptr;
const char *slash = nullptr;
const char *p;
const char *p = spec;
uint32_t offset = 0;
int32_t len = specLen;
for (p = spec; len && *p && !colon && !slash; ++p, --len) {
// skip leading whitespace
if (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') {
while (*p == ' ' || *p == '\n' || *p == '\r' || *p == '\t') {
spec++;
specLen--;
offset++;
continue;
p++;
len--;
}
for (; len && *p && !colon && !slash; ++p, --len) {
switch (*p) {
case ':':
if (!colon)