nsIURI.equals doesn't treat IDN and mixed case hosts the same

VERIFIED WORKSFORME

Status

()

Core
Networking
VERIFIED WORKSFORME
13 years ago
13 years ago

People

(Reporter: timeless, Assigned: Darin Fisher)

Tracking

Trunk
x86
Windows XP
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

13 years ago
www.tegumeƄ.nu
www.xn--tegume-nua.nu

www.google.com
WWW.GOOGLE.COM

js>
ios=Components.classes["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService)
[xpconnect wrapped nsIIOService @ 0xc0df68]
js> tegumUTF8=ios.newURI("http://www.tegume\ue5.nu/",null,null)
[xpconnect wrapped nsIURI @ 0x15b3cc8]
js> tegumPuny=ios.newURI("http://www.xn--tegume-nua.nu/",null,null)
[xpconnect wrapped nsIURI @ 0x1577aa0]
js> googleLOW=ios.newURI("http://www.google.com",null,null)
[xpconnect wrapped nsIURI @ 0x1578140]
js> googleUPP=ios.newURI("http://WWW.GOOGLE.COM",null,null)
[xpconnect wrapped nsIURI @ 0x1578488]
js> googleLOW.equals(googleUPP)
true
js> tegumUTF8.equals(tegumPuny)
false

why shouldn't we make that last line say true :)

the paired urls listed above *are* equivalent, not just in ui. the utf8 thing
*resolves* to the punicode *equivalent*. i'd like to argue that the comparison
for utf8/punicode should have the same equivalences as uppercase/lowercase.
currently it does not.
js> "\ue5" != "\u00e5"
true


js>  tegumUTF8=ios.newURI("http://www.tegume\u00e5.nu/",null,null)
[xpconnect wrapped nsIURI]
js> tegumUTF8.equals(tegumPuny)
true

Status: UNCONFIRMED → RESOLVED
Last Resolved: 13 years ago
Resolution: --- → WORKSFORME
(for completeness's sake:
js> prefs.setBoolPref("network.IDN_show_punycode", false);
js> tegumPuny=ios.newURI("http://www.xn--tegume-nua.nu/",null,null)
[xpconnect wrapped nsIURI]
js> tegumPuny.spec
http://www.tegume\uffff.nu/
js> tegumUTF8=ios.newURI("http://www.tegume\u00e5.nu/",null,null)
[xpconnect wrapped nsIURI]
js> tegumUTF8.spec
http://www.tegume\uffff.nu/
js> tegumUTF8.equals(tegumPuny)
true

not sure what to blame for the \uffff; personally I'd like to blame xpcshell
)
(Reporter)

Comment 3

13 years ago
oops. thanks
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.