After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 747376 - Doesn't show IDN domain names
Doesn't show IDN domain names
Status: RESOLVED FIXED
Product: epiphany
Classification: Core
Component: General
3.16.x (obsolete)
Other Linux
: Normal normal
: ---
Assigned To: Epiphany Maintainers
Epiphany Maintainers
Depends on:
Blocks:
 
 
Reported: 2015-04-05 16:12 UTC by Bastien Nocera
Modified: 2016-12-18 21:15 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
uri-helpers: Use ICU to decode punycode for display (4.59 KB, patch)
2016-12-16 17:59 UTC, Michael Catanzaro
committed Details | Review
uri-helpers: Cache the UTS #46 context (2.72 KB, patch)
2016-12-16 18:29 UTC, Michael Catanzaro
committed Details | Review
uri-helpers: be robust to NULL SoupURIs (1.37 KB, patch)
2016-12-16 18:29 UTC, Michael Catanzaro
committed Details | Review
uri-helpers: Pass larger buffer to ICU (1.94 KB, patch)
2016-12-18 21:15 UTC, Michael Catanzaro
committed Details | Review

Description Bastien Nocera 2015-04-05 16:12:40 UTC
Go to:
http://thepiratebay.xn--q9jyb4c/

Epiphany shows:
http://thepiratebay.xn--q9jyb4c/
as the URL

when it should show:
http://thepiratebay.みんな/
Comment 1 Michael Catanzaro 2016-12-16 00:11:54 UTC
Here's a test page that requires a bit less bravery to visit:

http://xn--rksmrgs-5wao1o.josefsson.org/

It should be displayed as:

http://räksmörgås.josefsson.org

Unfortunately I have no clue what to do here. It's not reasonable for Epiphany to implement this itself, so I guess WebKit should expose a function to format such URIs for display.

The page itself hints at another problem: that first link is going to stop working in WebKit soon, since we've finally switched from IDNA2003 to IDNA2008....
Comment 2 Michael Catanzaro 2016-12-16 00:13:57 UTC
It looks like this is exposed by ICU. We could probably use that in Epiphany. It's already an indirect dependency via WebKit, and it would probably be better than adding new WebKit API.
Comment 3 Michael Catanzaro 2016-12-16 00:28:36 UTC
https://bugs.webkit.org/show_bug.cgi?id=126627 is a problem, though: this would expose us to IDN homograph attacks which even WebKit doesn't yet have a solution to.
Comment 4 Michael Catanzaro 2016-12-16 00:53:54 UTC
(In reply to Michael Catanzaro from comment #1) 
> The page itself hints at another problem: that first link is going to stop
> working in WebKit soon, since we've finally switched from IDNA2003 to
> IDNA2008....

There's a spec for this too: http://www.unicode.org/reports/tr46/
Comment 5 Michael Catanzaro 2016-12-16 17:59:25 UTC
The following fix has been pushed:
6b7c6de uri-helpers: Use ICU to decode punycode for display
Comment 6 Michael Catanzaro 2016-12-16 17:59:28 UTC
Created attachment 342081 [details] [review]
uri-helpers: Use ICU to decode punycode for display

This adds support for properly displaying IDNA URIs, instead of showing
punycode-encoded URIs.

ICU is already a dependency of WebKit.
Comment 7 Michael Catanzaro 2016-12-16 18:28:51 UTC
The following fixes have been pushed:
fc88dce uri-helpers: Cache the UTS #46 context
05d81a5 uri-helpers: be robust to NULL SoupURIs
Comment 8 Michael Catanzaro 2016-12-16 18:29:00 UTC
Created attachment 342083 [details] [review]
uri-helpers: Cache the UTS #46 context

We need a mutex to do this, to ensure that we don't leak in the
unlikely event that this function is called for the first time in
multiple threads at once.

Originally, I thought it made sense to create a new context for each
call to this function, to avoid the mutex lock, but it uses a mutex
internally during creation anyway, so that's an illusory cost, and it
seems to do a substantial amount of work.
Comment 9 Michael Catanzaro 2016-12-16 18:29:04 UTC
Created attachment 342084 [details] [review]
uri-helpers: be robust to NULL SoupURIs

This probably should never happen here, but there's no reason to crash
if it does.
Comment 10 Michael Catanzaro 2016-12-18 21:15:25 UTC
The following fix has been pushed:
90c7799 uri-helpers: Pass larger buffer to ICU
Comment 11 Michael Catanzaro 2016-12-18 21:15:28 UTC
Created attachment 342184 [details] [review]
uri-helpers: Pass larger buffer to ICU

Our buffer was one byte too small to hold the longest-possible domain
name.

Also, we need to make sure the buffer is one byte longer than we tell
ICU. Fill it with zeroes so that we can guarantee it remains NUL-
terminated. It's hard to believe that U_STRING_NOT_TERMINATED_WARNING
is a thing, but it is and we don't want to hit it....