[whatwg/url] Definition of "valid opaque-host string" contradicts parser (#437)

Per the definitions in https://url.spec.whatwg.org/#urls, I believe that the following is a [*valid URL string*](https://url.spec.whatwg.org/#valid-url-string)

```
qwe://foobar/baz
```

with a *valid opaque-host string* of `foobar`, whereas

```
qwe://foo^bar/baz
```

is not a valid URL string because `^` is not a ["URL unit"](https://url.spec.whatwg.org/#url-units) and therefore `foo^bar` is not a valid opaque-host string (which is defined to be made up of code units).

However, the parser disagrees. If I step through the [parsing algorithm](https://url.spec.whatwg.org/#concept-basic-url-parser) with `qwe://foo^bar/baz` as input, then `foo^baz` ultimately gets passed to the [opaque-host parser](https://url.spec.whatwg.org/#concept-opaque-host-parser) without any validation error being triggered, and then the opaque-host parser in turn returns `foo^bar` without a validation error.

I believe this is a spec bug; as I understand https://url.spec.whatwg.org/#urls, a string is meant to be a "valid URL string" if and only if it does not trigger an error from the URL parser. But `qwe://foo^bar/baz`, which is not a "valid URL string" per the definition at https://url.spec.whatwg.org/#valid-url-string, does not trigger an error.

-- 
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/issues/437

Received on Saturday, 27 April 2019 18:33:36 UTC