|
|
@ -1267,7 +1267,7 @@ PDFJS.compatibilityChecked = true; |
|
|
|
cursor = 0; |
|
|
|
cursor = 0; |
|
|
|
state = 'no scheme'; |
|
|
|
state = 'no scheme'; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} else if (EOF === c) { |
|
|
|
} else if (c === EOF) { |
|
|
|
break loop; |
|
|
|
break loop; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
err('Code point not allowed in scheme: ' + c); |
|
|
|
err('Code point not allowed in scheme: ' + c); |
|
|
@ -1284,7 +1284,7 @@ PDFJS.compatibilityChecked = true; |
|
|
|
state = 'fragment'; |
|
|
|
state = 'fragment'; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// XXX error handling
|
|
|
|
// XXX error handling
|
|
|
|
if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { |
|
|
|
if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { |
|
|
|
this._schemeData += percentEscape(c); |
|
|
|
this._schemeData += percentEscape(c); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -1312,10 +1312,10 @@ PDFJS.compatibilityChecked = true; |
|
|
|
|
|
|
|
|
|
|
|
case 'relative': |
|
|
|
case 'relative': |
|
|
|
this._isRelative = true; |
|
|
|
this._isRelative = true; |
|
|
|
if ('file' !== this._scheme) { |
|
|
|
if (this._scheme !== 'file') { |
|
|
|
this._scheme = base._scheme; |
|
|
|
this._scheme = base._scheme; |
|
|
|
} |
|
|
|
} |
|
|
|
if (EOF === c) { |
|
|
|
if (c === EOF) { |
|
|
|
this._host = base._host; |
|
|
|
this._host = base._host; |
|
|
|
this._port = base._port; |
|
|
|
this._port = base._port; |
|
|
|
this._path = base._path.slice(); |
|
|
|
this._path = base._path.slice(); |
|
|
@ -1348,10 +1348,10 @@ PDFJS.compatibilityChecked = true; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
var nextC = input[cursor + 1]; |
|
|
|
var nextC = input[cursor + 1]; |
|
|
|
var nextNextC = input[cursor + 2]; |
|
|
|
var nextNextC = input[cursor + 2]; |
|
|
|
if ('file' !== this._scheme || !ALPHA.test(c) || |
|
|
|
if (this._scheme !== 'file' || !ALPHA.test(c) || |
|
|
|
(nextC !== ':' && nextC !== '|') || |
|
|
|
(nextC !== ':' && nextC !== '|') || |
|
|
|
(EOF !== nextNextC && '/' !== nextNextC && '\\' !== nextNextC && |
|
|
|
(nextNextC !== EOF && nextNextC !== '/' && nextNextC !== '\\' && |
|
|
|
'?' !== nextNextC && '#' !== nextNextC)) { |
|
|
|
nextNextC !== '?' && nextNextC !== '#')) { |
|
|
|
this._host = base._host; |
|
|
|
this._host = base._host; |
|
|
|
this._port = base._port; |
|
|
|
this._port = base._port; |
|
|
|
this._username = base._username; |
|
|
|
this._username = base._username; |
|
|
@ -1375,7 +1375,7 @@ PDFJS.compatibilityChecked = true; |
|
|
|
state = 'authority ignore slashes'; |
|
|
|
state = 'authority ignore slashes'; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if ('file' !== this._scheme) { |
|
|
|
if (this._scheme !== 'file') { |
|
|
|
this._host = base._host; |
|
|
|
this._host = base._host; |
|
|
|
this._port = base._port; |
|
|
|
this._port = base._port; |
|
|
|
this._username = base._username; |
|
|
|
this._username = base._username; |
|
|
@ -1398,14 +1398,14 @@ PDFJS.compatibilityChecked = true; |
|
|
|
|
|
|
|
|
|
|
|
case 'authority second slash': |
|
|
|
case 'authority second slash': |
|
|
|
state = 'authority ignore slashes'; |
|
|
|
state = 'authority ignore slashes'; |
|
|
|
if ('/' !== c) { |
|
|
|
if (c !== '/') { |
|
|
|
err('Expected \'/\', got: ' + c); |
|
|
|
err('Expected \'/\', got: ' + c); |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'authority ignore slashes': |
|
|
|
case 'authority ignore slashes': |
|
|
|
if ('/' !== c && '\\' !== c) { |
|
|
|
if (c !== '/' && c !== '\\') { |
|
|
|
state = 'authority'; |
|
|
|
state = 'authority'; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} else { |
|
|
|
} else { |
|
|
@ -1432,7 +1432,7 @@ PDFJS.compatibilityChecked = true; |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
var tempC = percentEscape(cp); |
|
|
|
var tempC = percentEscape(cp); |
|
|
|
if (null !== this._password) { |
|
|
|
if (this._password !== null) { |
|
|
|
this._password += tempC; |
|
|
|
this._password += tempC; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
this._username += tempC; |
|
|
|
this._username += tempC; |
|
|
@ -1489,7 +1489,7 @@ PDFJS.compatibilityChecked = true; |
|
|
|
break loop; |
|
|
|
break loop; |
|
|
|
} |
|
|
|
} |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} else if ('\t' !== c && '\n' !== c && '\r' !== c) { |
|
|
|
} else if (c !== '\t' && c !== '\n' && c !== '\r') { |
|
|
|
if (c === '[') { |
|
|
|
if (c === '[') { |
|
|
|
seenBracket = true; |
|
|
|
seenBracket = true; |
|
|
|
} else if (c === ']') { |
|
|
|
} else if (c === ']') { |
|
|
@ -1506,7 +1506,7 @@ PDFJS.compatibilityChecked = true; |
|
|
|
buffer += c; |
|
|
|
buffer += c; |
|
|
|
} else if (c === EOF || c === '/' || c === '\\' || |
|
|
|
} else if (c === EOF || c === '/' || c === '\\' || |
|
|
|
c === '?' || c === '#' || stateOverride) { |
|
|
|
c === '?' || c === '#' || stateOverride) { |
|
|
|
if ('' !== buffer) { |
|
|
|
if (buffer !== '') { |
|
|
|
var temp = parseInt(buffer, 10); |
|
|
|
var temp = parseInt(buffer, 10); |
|
|
|
if (temp !== relative[this._scheme]) { |
|
|
|
if (temp !== relative[this._scheme]) { |
|
|
|
this._port = temp + ''; |
|
|
|
this._port = temp + ''; |
|
|
@ -1530,7 +1530,7 @@ PDFJS.compatibilityChecked = true; |
|
|
|
err('\'\\\' not allowed in path.'); |
|
|
|
err('\'\\\' not allowed in path.'); |
|
|
|
} |
|
|
|
} |
|
|
|
state = 'relative path'; |
|
|
|
state = 'relative path'; |
|
|
|
if ('/' !== c && '\\' !== c) { |
|
|
|
if (c !== '/' && c !== '\\') { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
@ -1547,12 +1547,12 @@ PDFJS.compatibilityChecked = true; |
|
|
|
} |
|
|
|
} |
|
|
|
if (buffer === '..') { |
|
|
|
if (buffer === '..') { |
|
|
|
this._path.pop(); |
|
|
|
this._path.pop(); |
|
|
|
if ('/' !== c && '\\' !== c) { |
|
|
|
if (c !== '/' && c !== '\\') { |
|
|
|
this._path.push(''); |
|
|
|
this._path.push(''); |
|
|
|
} |
|
|
|
} |
|
|
|
} else if (buffer === '.' && '/' !== c && '\\' !== c) { |
|
|
|
} else if (buffer === '.' && c !== '/' && c !== '\\') { |
|
|
|
this._path.push(''); |
|
|
|
this._path.push(''); |
|
|
|
} else if ('.' !== buffer) { |
|
|
|
} else if (buffer !== '.') { |
|
|
|
if (this._scheme === 'file' && this._path.length === 0 && |
|
|
|
if (this._scheme === 'file' && this._path.length === 0 && |
|
|
|
buffer.length === 2 && ALPHA.test(buffer[0]) && |
|
|
|
buffer.length === 2 && ALPHA.test(buffer[0]) && |
|
|
|
buffer[1] === '|') { |
|
|
|
buffer[1] === '|') { |
|
|
@ -1568,7 +1568,7 @@ PDFJS.compatibilityChecked = true; |
|
|
|
this._fragment = '#'; |
|
|
|
this._fragment = '#'; |
|
|
|
state = 'fragment'; |
|
|
|
state = 'fragment'; |
|
|
|
} |
|
|
|
} |
|
|
|
} else if ('\t' !== c && '\n' !== c && '\r' !== c) { |
|
|
|
} else if (c !== '\t' && c !== '\n' && c !== '\r') { |
|
|
|
buffer += percentEscape(c); |
|
|
|
buffer += percentEscape(c); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
@ -1577,13 +1577,13 @@ PDFJS.compatibilityChecked = true; |
|
|
|
if (!stateOverride && c === '#') { |
|
|
|
if (!stateOverride && c === '#') { |
|
|
|
this._fragment = '#'; |
|
|
|
this._fragment = '#'; |
|
|
|
state = 'fragment'; |
|
|
|
state = 'fragment'; |
|
|
|
} else if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { |
|
|
|
} else if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { |
|
|
|
this._query += percentEscapeQuery(c); |
|
|
|
this._query += percentEscapeQuery(c); |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
|
|
|
|
|
|
|
|
|
case 'fragment': |
|
|
|
case 'fragment': |
|
|
|
if (EOF !== c && '\t' !== c && '\n' !== c && '\r' !== c) { |
|
|
|
if (c !== EOF && c !== '\t' && c !== '\n' && c !== '\r') { |
|
|
|
this._fragment += c; |
|
|
|
this._fragment += c; |
|
|
|
} |
|
|
|
} |
|
|
|
break; |
|
|
|
break; |
|
|
@ -1632,9 +1632,9 @@ PDFJS.compatibilityChecked = true; |
|
|
|
return this._url; |
|
|
|
return this._url; |
|
|
|
} |
|
|
|
} |
|
|
|
var authority = ''; |
|
|
|
var authority = ''; |
|
|
|
if ('' !== this._username || null !== this._password) { |
|
|
|
if (this._username !== '' || this._password !== null) { |
|
|
|
authority = this._username + |
|
|
|
authority = this._username + |
|
|
|
(null !== this._password ? ':' + this._password : '') + '@'; |
|
|
|
(this._password !== null ? ':' + this._password : '') + '@'; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this.protocol + |
|
|
|
return this.protocol + |
|
|
|