url: fix resolving from non-file to file URLs.
authorJeffrey Jagoda <jeffrey.jagoda@gmail.com>
Thu, 26 Mar 2015 19:34:16 +0000 (15:34 -0400)
committerPetka Antonov <petka_antonov@hotmail.com>
Sat, 4 Apr 2015 10:25:32 +0000 (13:25 +0300)
commit1e94057c05fdb810017074f82346b5d971bf5e9f
treed0bf259adecf9e2850cae862f5e8677a2df9a55a
parent8c6c376a9403496a7e4aab3a667c708e3e65ea33
url: fix resolving from non-file to file URLs.

When resolving a reference URL with the 'file' scheme an no host
against a base URL without the 'file' scheme, the first path element
of the reference URL is used as the host for the target URL. This
results in an invalid target URL.

This change makes an exception for file URLs so that the host is not
mangled during URL resolution.

PR-URL: https://github.com/iojs/io.js/pull/1277
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Petka Antonov <petka_antonov@hotmail.com>
lib/url.js
test/parallel/test-url.js