Closed Bug 287452 Opened 19 years ago Closed 19 years ago

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

Categories

(Core :: Networking, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

VERIFIED WORKSFORME

People

(Reporter: timeless, Assigned: darin.moz)

Details

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
Closed: 19 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
)
oops. thanks
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.