Skip to content

url: ensure host setter matches parse for file url

Technically, file URLs are not permitted to have a port. There is currently an ambiguity in the URL spec. In the current spec having a port in a file URL is undefined behavior. In the current implementation, the port is ignored and handled as if it were part of the host name. This will be changing once the ambiguity is resolved in the spec. The spec change may involve either ignoring the port if specified or throwing with an Invalid URL error if the port is specified. For now, this test verifies the currently implemented behavior.

Fixes: https://github.com/nodejs/node/issues/10608

/cc @domenic

Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

url

Merge request reports

Loading