This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libgcj/13972] New: gcj's URL() does not handle ContextURL + "/redir?http://domain2.com/index.html" correctly.
- From: "k dot allan-gcc at au dot darkbluesea dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Feb 2004 01:22:13 -0000
- Subject: [Bug libgcj/13972] New: gcj's URL() does not handle ContextURL + "/redir?http://domain2.com/index.html" correctly.
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hi,
I noticed that the URL function in libgcj's java.net.URL does not properly
process requests like:
URL("http://domain.com", "/redir?http://domain2.com/index.html");
This is because at the start of the function, context is set to null if spec
contains a :// anywhere, but even in the comment at the top of that function it
is mentioned that:
/* A protocol is defined by the doc as the substring before a ':'
* as long as the ':' occurs before any '/'.
Hence I submit the following diff against CVS:
--- URL.java 31 Dec 2003 10:55:40 -0000 1.34
+++ URL.java 2 Feb 2004 01:18:04 -0000
@@ -379,12 +379,12 @@
// An absolute URL must have chars prior to "://" but cannot have a colon
// right after the "://". The second colon is for an optional port value
// and implies that the host from the context is used if available.
- int colon;
+ int colon, slash;
if ((colon = spec.indexOf("://", 1)) > 0 &&
+ ((colon < (slash = spec.indexOf('/')) || slash < 0)) &&
! spec.regionMatches(colon, "://:", 0, 4))
context = null;
- int slash;
if ((colon = spec.indexOf(':')) > 0 &&
(colon < (slash = spec.indexOf('/')) || slash < 0))
{
My gcc version information:
Configured with: ../gcc/configure --enable-threads=posix --prefix=/opt/gcc
--enable-shared --enable-languages=c++,java
Thread model: posix
gcc version 3.5.0 20040121 (experimental)
--
Summary: gcj's URL() does not handle ContextURL +
"/redir?http://domain2.com/index.html" correctly.
Product: gcc
Version: 3.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: libgcj
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: k dot allan-gcc at au dot darkbluesea dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13972