|
@ -31,7 +31,7 @@ exports.format = urlFormat; |
|
|
// define these here so at least they only have to be
|
|
|
// define these here so at least they only have to be
|
|
|
// compiled once on the first module load.
|
|
|
// compiled once on the first module load.
|
|
|
var protocolPattern = /^([a-z0-9.+-]+:)/i, |
|
|
var protocolPattern = /^([a-z0-9.+-]+:)/i, |
|
|
portPattern = /:[0-9]+$/, |
|
|
portPattern = /:[0-9]*$/, |
|
|
// RFC 2396: characters reserved for delimiting URLs.
|
|
|
// RFC 2396: characters reserved for delimiting URLs.
|
|
|
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], |
|
|
delims = ['<', '>', '"', '`', ' ', '\r', '\n', '\t'], |
|
|
// RFC 2396: characters not allowed for various reasons.
|
|
|
// RFC 2396: characters not allowed for various reasons.
|
|
@ -625,7 +625,9 @@ function parseHost(host) { |
|
|
var port = portPattern.exec(host); |
|
|
var port = portPattern.exec(host); |
|
|
if (port) { |
|
|
if (port) { |
|
|
port = port[0]; |
|
|
port = port[0]; |
|
|
out.port = port.substr(1); |
|
|
if (port !== ':') { |
|
|
|
|
|
out.port = port.substr(1); |
|
|
|
|
|
} |
|
|
host = host.substr(0, host.length - port.length); |
|
|
host = host.substr(0, host.length - port.length); |
|
|
} |
|
|
} |
|
|
if (host) out.hostname = host; |
|
|
if (host) out.hostname = host; |
|
|