[prev in list] [next in list] [prev in thread] [next in thread] 

List:       httpclient-commons-dev
Subject:    DO NOT REPLY [Bug 35148]  New:  -
From:       bugzilla () apache ! org
Date:       2005-05-31 23:04:18
Message-ID: 20050531230418.BDC90181 () ajax ! apache ! org
[Download RAW message or body]

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=35148>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=35148

           Summary: URI.parseUriReference treats strings with leading ':' as
                    absolute URIs with zero-length scheme
           Product: HttpClient
           Version: 3.0 Final
          Platform: All
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Commons HttpClient
        AssignedTo: httpclient-dev@jakarta.apache.org
        ReportedBy: gojomo@archive.org


URI.parseUriReference treats strings with leading ':' as absolute URIs with a
zero-length scheme. If you then try to derelativize such a URI against a base
URI, you just get the same URI with leading ':'. 

IE and Firefox treat URI strings with a leading ':' as relative URIs. For
example, an HREF of ":foo" in the context of base URI
"http://www.example.com/path/page" would derelativize as
"http://www.example.com/path/:foo". (Only if another character comes before the
colon is it interpreted as a URI scheme.)

It'd be desirable for HTTPClient URI to do the same thing.

Example code to demonstrate:

import org.apache.commons.httpclient.URI;
URI base = new URI("http://www.example.com/path/page");
URI rel1 = new URI(":foo/boo");
System.out.println((new URI(base,rel1)).toString()); // displays just ":foo"

A potential fix would be for URI.parseUriReference() to avoid interpreting a ':'
in the zero position as indicating a zero-length scheme:

-       if (atColon < 0 || (atSlash >= 0 && atSlash < atColon)) {
+       if (atColon <= 0 || (atSlash >= 0 && atSlash < atColon)) {

and

-        if (at < length && tmp.charAt(at) == ':') {
+        if (at > 0 && at < length && tmp.charAt(at) == ':') {

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpclient-dev-help@jakarta.apache.org

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic