Node: URL: Don't accept port numbers for file urls

Created on 4 Jan 2017  路  6Comments  路  Source: nodejs/node

Per: https://github.com/whatwg/url/issues/97

Given the test case:

var m = new url.URL('file:///example/foo');
m.host = 'example.net:81';

The resulting URL is:

URL {
  href: file://example.net:81/example/foo
  protocol: file:
  hostname: example.net
  port: 81
  pathname: /example/foo
}

The host setter needs to take into consideration the fact that this is a file URL. PR incoming shortly.

whatwg-url

Most helpful comment

Awesome. I just want to say that I really love your responsiveness to spec updates; it's important that living standards have living implementations to benefit from these kind of bug fixes, and you've done a great job ensuring that stays the case.

All 6 comments

It seems like the spec isn't completely decided here though, from the discussions in https://github.com/whatwg/url/issues/97, so it might be worth holding off?

Ok. I can prepare the basic PR but I'll keep an eye out for the spec changes

Awesome. I just want to say that I really love your responsiveness to spec updates; it's important that living standards have living implementations to benefit from these kind of bug fixes, and you've done a great job ensuring that stays the case.

Definitely wanting to make sure we keep up. One favor I would ask: while the new URL parser in Node.js is still experimental, significant changes are easier to make. Once it moves up to a fully supported API, we will need to be more careful about potentially breaking changes. We'll need to make sure that we can go through a proper deprecation cycle for old behavior if necessary which means getting as much advance notice of breaking changes as possible. I know that breaking changes are generally avoided as much as possible in the WHATWG specs but if we can continue to get active heads up when changes are being considered, it would be extremely helpful! I really appreciate the help you've already provided!!

cc @nodejs/url

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fanjunzhi picture fanjunzhi  路  3Comments

addaleax picture addaleax  路  3Comments

vsemozhetbyt picture vsemozhetbyt  路  3Comments

stevenvachon picture stevenvachon  路  3Comments

dfahlander picture dfahlander  路  3Comments