[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [cp-patches] RFC: prevent URL degeneration - v3
From: |
Robert Schuster |
Subject: |
Re: [cp-patches] RFC: prevent URL degeneration - v3 |
Date: |
Thu, 13 Oct 2005 16:20:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; de-AT; rv:1.7.12) Gecko/20051005 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Committed.
Robert Schuster wrote:
> Hi,
> I liked Marks suggestion but refined it a bit:
>
> The "//" + authority variant is only used if ambiguity would occur, that means
> if the file part starts with "//".
>
> 2005-10-11 Robert Schuster <address@hidden>
>
> * java/net/URLStreamHandler.java:
> (toExternalForm): Use "//" + authority format when file part starts
> with two slashes.
>
> This time I carefully tested with mauve. It 'breaks':
>
> FAIL: gnu.testlet.java.net.URL.URLTest: new URL(string) (number 1)
> got file:////c:/pub/files/foobar.txt but expected
> file://c:/pub/files/foobar.txt
>
> FAIL: gnu.testlet.java.net.URL.URLTest: new URL(string) (number 19)
> got file:////hpjavant/bgee/foobar.txt but expected
> file://hpjavant/bgee/foobar.txt
>
> FAIL: gnu.testlet.java.net.URL.URLTest: new URL(protocol, host, file) (number
> 45)
> got file:////hpjavant/bgee/foobar.txt but expected
> file://hpjavant/bgee/foobar.txt
>
> FAIL: gnu.testlet.java.net.URL.URLTest: new URL(protocol, host, file) (number
> 53)
> got file:////hpjavant/bgee/foobar.txt but expected
> file://hpjavant/bgee/foobar.txt
>
> However I consider these tests wrong because they violate the URL spec.
>
> proto:////p1/p2
>
> is not the same as
>
> proto://p1/p2
>
> Furthermore this is exactly the bug which causes trouble in our XML parser and
> since the other implementation contains it too I send Sun a problem report.
>
> I am going to fix these tests afterwards. Obviously they will then fail on
> Sun-based VMs until they fix the problem, too.
>
> Comments?
>
> cu
> Robert
>
>
> ------------------------------------------------------------------------
>
> Index: java/net/URLStreamHandler.java
> ===================================================================
> RCS file: /cvsroot/classpath/classpath/java/net/URLStreamHandler.java,v
> retrieving revision 1.35
> diff -u -r1.35 URLStreamHandler.java
> --- java/net/URLStreamHandler.java 2 Oct 2005 22:58:41 -0000 1.35
> +++ java/net/URLStreamHandler.java 10 Oct 2005 22:21:48 -0000
> @@ -515,12 +515,18 @@
> sb.append(":");
> }
>
> - if (authority.length() != 0)
> - {
> - sb.append("//").append(authority);
> - }
> -
> - sb.append(file);
> + // If we have superfluous leading slashes (that means, at least 2)
> + // we always add the authority component ("//" + host) to
> + // avoid ambiguity. Otherwise we would generate an URL like
> + // proto://home/foo
> + // where we meant:
> + // host: <empty> - file: //home/foo
> + // but URL spec says it is:
> + // host: home - file: /foo
> + if (authority.length() != 0 || file.startsWith("//") )
> + sb.append("//").append(authority).append(file);
> + else
> + sb.append(file);
>
> if (ref != null)
> sb.append('#').append(ref);
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Classpath-patches mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/classpath-patches
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD4DBQFDTm1EG9cfwmwwEtoRAtgXAJiV5NHtRiGz+nohXRQMPHICAKFdAJ0T9eS6
yb9Gw7d0HuR6n8OuEcFeFA==
=V1nF
-----END PGP SIGNATURE-----
- [cp-patches] RFC: prevent URL degeneration, Robert Schuster, 2005/10/09
- Re: [cp-patches] RFC: prevent URL degeneration - v2, Robert Schuster, 2005/10/09
- Re: [cp-patches] RFC: prevent URL degeneration - v2, Mark Wielaard, 2005/10/09
- Re: [cp-patches] RFC: prevent URL degeneration - v2b, Robert Schuster, 2005/10/09
- Re: [cp-patches] RFC: prevent URL degeneration - v2b, Mark Wielaard, 2005/10/10
- Re: [cp-patches] RFC: prevent URL degeneration - v2b, Chris Burdess, 2005/10/10
- Re: [cp-patches] RFC: prevent URL degeneration - v2b, Mark Wielaard, 2005/10/10
- Re: [cp-patches] RFC: prevent URL degeneration - v3, Robert Schuster, 2005/10/10
- Re: [cp-patches] RFC: prevent URL degeneration - v3,
Robert Schuster <=
- Re: [cp-patches] RFC: prevent URL degeneration - v3, Mark Wielaard, 2005/10/14
- Re: [cp-patches] RFC: prevent URL degeneration - v3, Mark Wielaard, 2005/10/14
Re: [cp-patches] RFC: prevent URL degeneration, Chris Burdess, 2005/10/10