[whatwg/url] Verify domain is not empty after "domain to ASCII" (#497)

The empty host is not allowed in special non-"file" URLs, but
`domain to ASCII` result can be the empty string, even if the
input is not empty, for example:

* the input consists entirely of IDNA ignored code points;
* the input is `xn--`.

The `domain to ASCII` do not fail when it is called from `host parser`,
because `VerifyDnsLength` is false.
So we need additional check after it.

An interesting case is with file URLS, as empty host is allowed. But most
browsers report failure as well. I tested URLs with the `U+00AD`
percent encoded in host:

| URL               | Chrome    | Firefox     | Safari    |
|-------------------|-----------|-------------|-----------|
| `file://%C2%AD/p` | TypeError | `file:///p` | TypeError |
| `http://%C2%AD/p` | TypeError | TypeError   | TypeError |

Note. To find more IDNA ignored code points refer to IDNA Mapping Table:
https://unicode.org/reports/tr46/#IDNA_Mapping_Table


<!--
Thank you for contributing to the URL Standard! Please describe the change you are making and complete the checklist below if your change is not editorial.
-->

- [ ] At least two implementers are interested (and none opposed):
   * …
   * …
- [ ] [Tests](https://github.com/web-platform-tests/wpt) are written and can be reviewed and commented upon at:
   * …
- [ ] [Implementation bugs](https://github.com/whatwg/meta/blob/master/MAINTAINERS.md#handling-pull-requests) are filed:
   * Chrome: …
   * Firefox: …
   * Safari: …

(See [WHATWG Working Mode: Changes](https://whatwg.org/working-mode#changes) for more details.)

You can view, comment on, or merge this pull request online at:

  https://github.com/whatwg/url/pull/497


-- Commit Summary --

  * Verify domain is not empty after "domain to ASCII"

-- File Changes --

    M url.bs (2)

-- Patch Links --

https://github.com/whatwg/url/pull/497.patch

https://github.com/whatwg/url/pull/497.diff


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/url/pull/497

Received on Wednesday, 6 May 2020 14:54:17 UTC