Skip to content

Opaque Host and domain encoding #220

@rubycon

Description

@rubycon

What is the issue with the URL Pattern Standard?

Here's a test case from the WPT test suite, it's expected to succeed (Chrome 123 pass).

const up1 = new URLPattern({ hostname : "xn--caf-dma.com" });
up1.exec({ hostname: "café.com" });

The test expect the hostname "café.com" to be converted to "xn--caf-dma.com" and to match the pattern.

But as per the spec, without a special scheme the host is considered an opaque host and not a domain name, therefore it should be percent-encoded to "caf%C3%A9.com" and not IDNA encoded to "xn--caf-dma.com". The pattern won't match.

Is it an oversight in the test suite/Chrome implementation or should hostname always be considered domain name ?

In some case the specs already allows opaque URL to be treated as special (cf. process pathname for init) and default the URL processing to the most common (most expected??) behaviour.

Should it be the case here too ? Or maybe only in some cases... Like forcing the URL to a special scheme when the host is not an address and domain labels are detected ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions