From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21310 invoked by alias); 2 Feb 2004 01:22:14 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 21302 invoked by uid 48); 2 Feb 2004 01:22:13 -0000 Date: Mon, 02 Feb 2004 01:22:00 -0000 From: "k dot allan-gcc at au dot darkbluesea dot com" To: gcc-bugs@gcc.gnu.org Message-ID: <20040202012211.13972.k.allan-gcc@au.darkbluesea.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug libgcj/13972] New: gcj's URL() does not handle ContextURL + "/redir?http://domain2.com/index.html" correctly. X-Bugzilla-Reason: CC X-SW-Source: 2004-02/txt/msg00103.txt.bz2 List-Id: 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