Closed Bug 27930 Opened 25 years ago Closed 25 years ago

URL parser should support RFC 2732 - IPv6 address literals

Categories

(Core :: Networking, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED

People

(Reporter: jgmyers, Assigned: gagan)

References

()

Details

(Whiteboard: [nsbeta2-]0d have fix)

Attachments

(5 files)

The URL parser should support RFC 2732 syntax. For example, it should handle http://[207.200.73.41]/
Oops, bracketed IPv4 addresses are not legal per RFC 2732. This bug then depends on IPv6 support. Reassigning to myself until bug 23811 is resolved.
Assignee: gagan → jgmyers
Depends on: 23811
Status: NEW → ASSIGNED
Attached patch proposed fixSplinter Review
Assign to module owner for review and checkin. This can be checked in before 23811, but cannot be tested until 23811 is fixed.
Assignee: jgmyers → gagan
Status: ASSIGNED → NEW
Keywords: patch
Target Milestone: M15
Summary: URL parser should support RFC 2732 → URL parser should support RFC 2732 - IPv6 address literals
Keywords: beta2
The changes look good to me from a first peek at them.
Moving what's not done for M15 to M16.
Target Milestone: M15 → M16
Someone pointed out to me that there is an alternative syntax for specifying literal IPv6 addresses in URL's: http://www.ics.uci.edu/pub/ietf/uri/draft-masinter-url-ipv6-02.txt Quoted from this Internet-Draft: The syntax is best described as a transformation of the normal IPv6 syntax as defined in section 2.2 of [RFC2373]; starting with such an address: 1) replace every colon ":" with a "-" 2) append ".ipv6" to the end Thus, an HTTP service available at port 70 of IPv6 address "ABCD:EF01::2345:10.9.8.7" could be written as http://ABCD-EF01--2345-10.9.8.7.ipv6:70/
This alternativ syntax is really nice since we do not have to change the urlparser for it.
Whiteboard: have fix
The alternative syntax is a year-old internet draft. RFC 2732, which is implemented by the patch attached to this bug, is a Proposed Standard.
Whiteboard: have fix → 0d have fix
Keywords: nsbeta2
Working on an updated patch
Assignee: gagan → jgmyers
Keywords: beta2
Status: NEW → ASSIGNED
Attached patch updated patchSplinter Review
Reassign for review.
Assignee: jgmyers → gagan
Status: ASSIGNED → NEW
I'm concerned that my patch doesn't include any changes to nsNoAuthURLParser. How can I construct a test case that excercises this parser?
Use a file url ...
Ahemmm ... of course as the name says there is not authority -> no host in these cases. So you don't have to be concerned.
Regarding the alternative syntax, Larry Masinter <LM@att.com> says in netscape.public.mozilla.netlib: This is obsolete; after much discussion, it was clear that this approach wasn't going to work for a lot of reasons. Don't do this. The draft should have expired by now.
I reviewed jgmyers's latest patch (id=7929). I have the following questions. 1. In this code fragment: case '[': if (brk == i_Spec) { rv = ParseAtHost(i_Spec, o_Host, o_Port, o_Path); if (rv != NS_ERROR_MALFORMED_URI) return rv; // Try something else CRTFREEIF(*o_Host); *o_Port = -1; } rv = ParseAtPath(i_Spec, o_Path); return rv; is it really necessary to free *o_Host and reset *o_Port when ParseAtHost fails with NS_ERROR_MALFORMED_URI? What about *o_Path? It would be better to ensure that ParseAtHost does not allocate *o_Host and *o_Path when it fails. 2. In ParseAtHost, the new switch statement is missing the case of '#', which is a member of 'delimiters'. switch (*fwdPtr) { case '\0': // everything is a host return NS_OK; case '/' : case '?' : rv = ParseAtPath(fwdPtr, o_Path); return rv; case ':' : rv = ParseAtPort(fwdPtr+1, o_Port, o_Path); return rv; default: NS_ASSERTION(0, "This just can't be!"); break; } Some comments explaining the difference between ESCAPED and HOSTESCAPED in nsStdURL.h or nsStdURL::AppendString would be nice. In particular the fact that HOSTESCAPED implies ESCAPED is not obvious. Other than these two questions, I think this patch is good. Caveat: I am not familiar with the Necko code, so my code review is limited to the code that this patch modifies. By the way, I found that in nsAuthURLParser.cpp and nsStdURLParser.cpp, the local variable 'fwdPtr' casts away the const of 'i_Spec'. Is that intentional?
Review replies: 1. This code follows the convention established by the "Try something else" code following calls to ParseAtPreHost(). o_Path need not be tested as it is the last argument--if it is filled in, then the URI is not malformed. I agree it would be better to ensure that the ParseAt* routines do not allocate output parameters on failure, but do not want this patch to change the interface contract. 2. Added the '#' case in the updated patch. In the updated patch, the fwdPtr local added by the patch is now const. The patch does not change existing fwdPtr declarations. In the updated patch, there are now comments added to nsStdURL.h. I would not say that HOSTESCAPED implies ESCAPED. HOSTESCAPED is just a different set of escaping rules. It is similar to but distinct from ESCAPED.
Attachment id=8272 has Windows line endings. If you want to apply the patch on Unix, be sure to convert the line endings first. Gagan, are you planning to check in this patch before 5/16?
Putting on [nsbeta2+][5/16] radar. This is a feature MUST complete work by 05/16 or we may pull this feature for PR2.
Whiteboard: 0d have fix → [nsbeta2+][5/16]0d have fix
Hi John, don't forget to look at nsNoAuthURLParser.cpp. The hostname sneaked back in over the weekend, you have to look there too for IP6-Adresses.
If IPv6 address literals could contain '/' characters, that would be an issue. As they currently cannot, it is not an issue.
r=gagan, per email sent 5/10.
I will check this in tonite.
Status: NEW → ASSIGNED
checked in.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
I have reopened this bug because the host was back in nsNoAuthURLParser before the IP6 stuff was checked in. Currently we do not watch for IP6 adresses there and consequently sometimes add [] around a hostname that looks like an IP6 address.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Could you provide a test case?
You can always use urltest with a file url like file://[::ffff:207.200.73.41]/
Check it on linux/unix.
Putting on [nsbeta2-] radar. Missed the feature train. Please set to MFuture.
Whiteboard: [nsbeta2+][5/16]0d have fix → [nsbeta2-]0d have fix
leger: why did it miss the feature train? IPv6 suport is in, it is just missing at one place in the code. nsStdURL now expects correct IPv6 handling which is not done inside nsNoAuthURLParser. This is no missing feature, just a plain bug.
Andreas: since you are not a Netscape employee, my understanding is that your checkins only need to be approved by the module owner and brendan or waterson.
fix checked in
Status: REOPENED → RESOLVED
Closed: 25 years ago25 years ago
Resolution: --- → FIXED
Relieving tever of IPv6 related QA.
QA Contact: tever → benc
+verifyme I won't be looking at IPv6 until marketing tells me it's a feature
Keywords: verifyme
off netscape radar.
QA Contact: benc → ipv6
mass remove verifyme requests greater than 4 months old
Keywords: verifyme
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: