Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

url.parse fails on file protocol #562

tmcw opened this Issue Jan 14, 2011 · 2 comments


None yet
3 participants

tmcw commented Jan 14, 2011

URLs with the file:// protocol aren't correctly parsed - the pathname contains the hostname and pathname, including the // after file. This is, at least, in conflict with the Python implementation, which claims to comply with the URL RFC.

I'm also experiencing this bug.

I've written a patch for this and submitted a pull request to Joyent:


Hopefully this will get pulled into an upcoming release and resolved.

@isaacs isaacs added a commit to isaacs/node-v0.x-archive that referenced this issue May 27, 2011

@ryanpetrello @isaacs ryanpetrello + isaacs Close #562 Close #1078 Parse file:// urls properly
The file:// protocol *always* has a hostname; it's frequently
abbreviated as an empty string, which represents 'localhost'

According to RFC 1738 (http://tools.ietf.org/html/rfc1738):

A file URL takes the form:


where <host> is the fully qualified domain name of the system on
which the <path> is accessible...

As a special case, <host> can be the string "localhost" or the empty
string; this is interpreted as 'the machine from which the URL is
being interpreted'.

@isaacs isaacs closed this in 58a1d7e May 27, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment