This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Absolute URL parsing bug


Andrew Haley wrote:
This URL is an absolute URL because its path begins with a "/":

"jar:file:/usr/src/redhat/BUILD/jonas-4.3.3/jonas/output/JONAS_4_3_3/examples/webservices/beans/ws/temp/ejbjars/ws.jar!/META-INF/wsdl/ssbEndpoint.wsdl"

[ An absolute file URL can look like:

   absoluteURI = "file" ":" abs_path
   abs_path = "/" path_segments

That is, there is no need for "//".

I don't see that in any of the specs. Technically, "file:/tmp/foo.html" is not a valid URI, as far as I can tell. I notice that firefox rewrites it (in the navigation bar) to "file:///tmp/foo.html".


Now in practice we may want to allow "file:/tmp/foo.html", but it should be viewed as an unofficial short-hand for "file:///tmp/foo.html".

And indeed, the URL spec in the
SDK docs says 'If the spec's path component begins with a slash
character "/" then the path is treated as absolute...' ]

The *path* is absolute, but the URI isn't.


This matters when resolving a relative URL against a base URI, such as he URL of the containing document.

If we have a base URI "http://bar.com/baz/index.html"; and a reference "/tmp/foo.html" then the resolved URI is "http://bar.com/tmp/foo.html";.

But we parse the spec looking for "//" to determine if a URL is
absolute,

A URL is absolute *only* if it has a "scheme".



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]