hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 35148] - URI.parseUriReference treats strings with leading ':' as absolute URIs with zero-length scheme
Date Wed, 01 Jun 2005 19:44:13 GMT
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





------- Additional Comments From gojomo@archive.org  2005-06-01 21:43 -------
Definitely, it's an ambiguous case. But given that the class has to do something
when presented with such input, I think two relevant questions would be:

(1) Is the current behavior desirable?

I don't think so. Interpreting a potential URI ":foo" as an absolute URI results
in an illegal, uninterpretable URI. I think this is highlighted by the example
in my initial report:

(new URI(new URI("http://www.example.com/path/page"), new URI(":foo"))).toString(); 

Having this return ":foo" causes the nonsensical interpretation to spread to
another instance (losing the original context). In contrast, having this return
"http://www.example.com/path/:foo" means the only possible legal URI has been
made from an ambiguous situation. 

It would in my opinion be better to raise an exception than have the current
behavior. Then wrapping code could note the problem and attempt a workaround
like encoding or prepending a "./" to force path-interpretation. But then that
would force the question: is ":foo" definitively prohibited by rfc2396 section 5
(or rfc3986 section 4.2), or is it simply a case not contemplated by its language?

(2) Is there any situation where the current behavior (or alternatively, raising
an exception) would be preferable to the suggested behavior of treating
URI-strings that begin with a ':' as relative references?

I can't think of any such situation, save for a hypothetical pedantic URI-format
checker, which would not want the current behavior, but rather a warning of some
sort that an ambiguous case has been encountered. 

Short of that, while I'd agree harmonization with browser behavior is not
all-important, it is very valuable unless there's a clear justification to do
otherwise. Any ambiguous URI-writing practice that nonetheless works in browsers
is likely to persist. 

-- 
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


Mime
View raw message