Closed
Bug 429347
Opened 16 years ago
Closed 16 years ago
URL parser gets confused by ref with no path
Categories
(Core :: Networking, defect)
Tracking
()
RESOLVED
FIXED
mozilla1.9.1b1
People
(Reporter: bzbarsky, Assigned: michal)
Details
Attachments
(1 file, 3 obsolete files)
3.72 KB,
patch
|
Biesinger
:
superreview+
|
Details | Diff | Splinter Review |
Parsing "http://example.com#bar" produces an nsStandardURL with an mBasename segment with pos == 0, len == -1. Parsing "http://example.com/#bar" gives an mBasename segment with pos == 18, len == 0. The resulting URI objects serialize to the same thing, but don't test equal via equals(). This is wrong. See bug 429128 comment 12 and bug 429128 comment 14.
Assignee | ||
Comment 1•16 years ago
|
||
Reporter | ||
Comment 2•16 years ago
|
||
Wouldn't it be better to fix ParsePath? I guess that pretty purposefully does the -1 thing.... If we do want to do this, wouldn't it make more sense to adjust the filename len first, _then_ do the > 0 compare and ensuing block?
Assignee | ||
Comment 3•16 years ago
|
||
fixed nsBaseURLParser::ParsePath()
Attachment #324810 -
Attachment is obsolete: true
Attachment #340919 -
Flags: review?(bzbarsky)
Attachment #324810 -
Flags: review?(cbiesinger)
Reporter | ||
Comment 4•16 years ago
|
||
So with that patch, how do we parse "http://example.com" as compared to "http://example.com/"? Do both end up with mBasename of len == -1? Or len == 0? Or something else?
Assignee | ||
Comment 5•16 years ago
|
||
This isn't affected by this patch and both are mBasename = {mPos = 19, mLen = 0}.
Reporter | ||
Updated•16 years ago
|
Attachment #340919 -
Flags: superreview?(cbiesinger)
Attachment #340919 -
Flags: review?(bzbarsky)
Attachment #340919 -
Flags: review+
Reporter | ||
Comment 6•16 years ago
|
||
Comment on attachment 340919 [details] [diff] [review] patch v2 >Index: netwerk/base/src/nsURLParsers.cpp >+ // an empty file path is no file path only if there is neither param/query/ref s/neither/no/ >Index: netwerk/test/unit/test_bug429347.js Add as a test the thing I asked about with no query/param/ref? I still don't see how that works; do we never even hit this function in that case? Depending on that seems pretty fragile... r=bzbarsky with that satisfactorily explained.
Reporter | ||
Comment 7•16 years ago
|
||
Oh, I'd like biesi to ok this too.
Assignee | ||
Comment 8•16 years ago
|
||
I think I've found a better place to fix this bug. Please have a look at the new patch.
Attachment #340919 -
Attachment is obsolete: true
Attachment #341035 -
Flags: review?(bzbarsky)
Attachment #340919 -
Flags: superreview?(cbiesinger)
Reporter | ||
Comment 9•16 years ago
|
||
Comment on attachment 341035 [details] [diff] [review] patch v3 This also looks good to me (and still needs a glance from biesi)
Attachment #341035 -
Flags: review?(cbiesinger)
Attachment #341035 -
Flags: review?(bzbarsky)
Attachment #341035 -
Flags: review+
Updated•16 years ago
|
Attachment #341035 -
Flags: review?(cbiesinger) → review+
Comment 10•16 years ago
|
||
Comment on attachment 341035 [details] [diff] [review] patch v3 You can reenable the line in netwerk/test/unit/test_standardurl.js now, right?
Assignee | ||
Comment 11•16 years ago
|
||
(In reply to comment #10) > (From update of attachment 341035 [details] [diff] [review]) > You can reenable the line in netwerk/test/unit/test_standardurl.js now, right? You're right.
Attachment #341035 -
Attachment is obsolete: true
Attachment #341123 -
Flags: superreview?(cbiesinger)
Updated•16 years ago
|
Attachment #341123 -
Flags: superreview?(cbiesinger) → superreview+
Assignee | ||
Updated•16 years ago
|
Keywords: checkin-needed
Comment 12•16 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/3fcf14282433
Status: ASSIGNED → RESOLVED
Closed: 16 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b1
Updated•16 years ago
|
Flags: in-testsuite+
Comment 13•13 years ago
|
||
Note that a fix for 665706 will affect a test case over here: // see https://bugzilla.mozilla.org/show_bug.cgi?id=665706 // ";" is not parsed as special anymore and thus ends up // in the authority component (see RFC 3986) uri1.spec = "http://example.com;bar"; uri2.spec = "http://example.com/;bar"; do_check_false(uri1.equals(uri2)); ...so these two intentionally do not compare equal anymore.
You need to log in
before you can comment on or make changes to this bug.
Description
•