diff --git a/lib/url.js b/lib/url.js index bacf201dd6e..09e9cceb42a 100644 --- a/lib/url.js +++ b/lib/url.js @@ -318,7 +318,7 @@ Url.prototype.parse = function(url, parseQueryString, slashesDenoteHost) { this.query = {}; } if (rest) this.pathname = rest; - if (slashedProtocol[proto] && + if (slashedProtocol[lowerProto] && this.hostname && !this.pathname) { this.pathname = '/'; } diff --git a/test/simple/test-url.js b/test/simple/test-url.js index d27abbab8a3..57d0a6d5a61 100644 --- a/test/simple/test-url.js +++ b/test/simple/test-url.js @@ -44,6 +44,16 @@ var parseTests = { 'path': '/' }, + 'HTTP://www.example.com' : { + 'href': 'http://www.example.com/', + 'protocol': 'http:', + 'slashes': true, + 'host': 'www.example.com', + 'hostname': 'www.example.com', + 'pathname': '/', + 'path': '/' + }, + 'http://www.ExAmPlE.com/' : { 'href': 'http://www.example.com/', 'protocol': 'http:',