Skip to content

Provide the right flags to IDN methods for HttpClient #44091

@j-bernard

Description

@j-bernard

Symfony version(s) affected

5.3

Description

Symfony HttpClient supports IDN but does not provide the right flags to the intl IDN methods (idn_to_ascii and idn_to_utf8) to be fully IDNA 2008 compliant (RFC 5891).
For example, fußball.test should be converted as xn--fuball-cta.test instead of fussball.test.

See the affected line for conversion to ASCII.

How to reproduce

$client = HttpClient::create();
$response = $client->request('GET', $url);

If $url is fußball.test it should make a query to xn--fuball-cta.test instead of fussball.test.

Possible Solution

The following flags should be provided to be the most compliant possible with IDNA 2008:
IDNA_DEFAULT | IDNA_USE_STD3_RULES | IDNA_CHECK_BIDI | IDNA_CHECK_CONTEXTJ | IDNA_NONTRANSITIONAL_TO_ASCII

Additional Context

Unicode IDNA compatibility processing

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions