Closed
Bug 502644
Opened 15 years ago
Closed 14 years ago
Links in "view source" for IDN pages refer wrong URIs
Categories
(Toolkit :: View Source, defect, P2)
Toolkit
View Source
Tracking
()
RESOLVED
FIXED
mozilla6
People
(Reporter: yuki, Assigned: niklas)
References
()
Details
Attachments
(2 files)
(deleted),
patch
|
bzbarsky
:
review-
|
Details | Diff | Splinter Review |
(deleted),
patch
|
mrbkap
:
review+
|
Details | Diff | Splinter Review |
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.1pre) Gecko/20090704 Shiretoko/3.5.1pre (.NET CLR 3.5.30729)
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1.1pre) Gecko/20090704 Shiretoko/3.5.1pre (.NET CLR 3.5.30729)
In "view source", "href" and other attributes are linkified automatically. However, if the URI of the original page has IDN, most links don't work correctly.
Reproducible: Always
Steps to Reproduce:
1. Go to "http://例え.テスト/" (this is an IDN, punycode version is "http://xn--r8jz45g.xn--zckzah/")
2. "View" => "Page Source"
3. Click a link in the tag:
<link rel="shortcut icon" href="/images/favicon.ico" />
Actual Results:
Firefox tries to load "view-source:http://%c3%a4%c2%be%c2%8b%c3%a3%c2%81%c2%88.%c3%a3%c2%83%c2%86%c3%a3%c2%82%c2%b9%c3%a3%c2%83%c2%88/images/favicon.ico" and shows "Server not found" error.
Expected Results:
Firefox loads "view-source:http://xn--r8jz45g.xn--zckzah/images/favicon.ico".
Reporter | ||
Comment 1•15 years ago
|
||
FYI: the protocol handler for "view-source:" uses "asciiSpec" instead of "spec", to get punycode version of the URI.
http://mxr.mozilla.org/mozilla-central/source/netwerk/protocol/viewsource/src/nsViewSourceHandler.cpp#78
Updated•15 years ago
|
Component: General → View Source
Product: Firefox → Toolkit
QA Contact: general → view.source
Version: unspecified → 1.9.1 Branch
Comment 2•15 years ago
|
||
Confirmed on Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.1) Gecko/20090624 Firefox/3.5
Status: UNCONFIRMED → NEW
Ever confirmed: true
Comment 3•15 years ago
|
||
I can confirm this bug on Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.3a2pre) Gecko/20100216 Minefield/3.7a2pre.
This bug appears only if used top level domain is whitelisted to interprest punycode.
Updated•14 years ago
|
Version: 1.9.1 Branch → Trunk
Updated•14 years ago
|
OS: Windows Vista → All
Hardware: x86 → All
Comment 5•14 years ago
|
||
I just noticed this bug on http://företag.stockholm.se/
Assignee | ||
Comment 6•14 years ago
|
||
I can confirm this with latest hg checkout, patch attached.
I use the same method as documented in /netwerk/protocol/viewsource/nsViewSourceHandler.cpp, Line 85
Assignee | ||
Updated•14 years ago
|
Attachment #504150 -
Flags: review?(jst)
Updated•14 years ago
|
Assignee: nobody → niklas
Assignee | ||
Updated•14 years ago
|
Attachment #504150 -
Flags: review?(jst) → review?(bzbarsky)
Comment 8•14 years ago
|
||
Hmm. But GetSpec should work as well, I'd think, as long as the encoding is not confused.... Is the problem in the output of GetSpec (in that it's %-escaping inside the hostname before returning the value) or in what code later on does with the string GetSpec produced?
Comment 9•14 years ago
|
||
Niklas, ping?
Comment 10•14 years ago
|
||
Comment on attachment 504150 [details] [diff] [review]
Fetch the absolute URL, convert it according to IDNA
I believe the real problem is here, further down in the method in question:
viewSourceUrl.AppendWithConversion(absoluteLinkUrl);
That converts absoluteLinkUrl to UTF-16 by byte-inflating instead of doing a proper UTF-8 to UTF-16 conversion.
Attachment #504150 -
Flags: review?(bzbarsky) → review-
Comment 11•14 years ago
|
||
And indeed, fixing that fixes the behavior of the steps from comment 0.
Attachment #527722 -
Flags: review?(mrbkap)
Comment 12•14 years ago
|
||
Stealing so I can track this.
Niklas, are you OK with me crediting you for the fix from comment 11? It's basically your work, since you found where things are going wrong....
Assignee: niklas → bzbarsky
Priority: -- → P2
Whiteboard: [need review]
Assignee | ||
Comment 13•14 years ago
|
||
Hey, sorry for not replying to your questions but i didn't have the sourcecode checked out anymore and i thought i would do it when i had time.
I didn't really understood what went wrong, i just applied the same method that was used in nsViewSourceHandler.cpp. As long as it is now fixed (correctly even), i'm happy. Credit is fine, no credit is also fine. Thanks for looking at it. :)
Comment 14•14 years ago
|
||
No problem. Now all I need is to get Blake to review... ;)
Updated•14 years ago
|
Attachment #527722 -
Flags: review?(mrbkap) → review+
Updated•14 years ago
|
Whiteboard: [need review] → [need landing]
Comment 15•14 years ago
|
||
Assignee: bzbarsky → niklas
Status: NEW → RESOLVED
Closed: 14 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Whiteboard: [need landing]
Target Milestone: --- → mozilla6
You need to log in
before you can comment on or make changes to this bug.
Description
•