public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/13972] New: gcj's URL() does not handle ContextURL + "/redir?http://domain2.com/index.html" correctly.
@ 2004-02-02  1:22 k dot allan-gcc at au dot darkbluesea dot com
  2004-02-02  1:25 ` [Bug libgcj/13972] " k dot allan-gcc at au dot darkbluesea dot com
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: k dot allan-gcc at au dot darkbluesea dot com @ 2004-02-02  1:22 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2005-01-11 20:43 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-02-02  1:22 [Bug libgcj/13972] New: gcj's URL() does not handle ContextURL + "/redir?http://domain2.com/index.html" correctly k dot allan-gcc at au dot darkbluesea dot com
2004-02-02  1:25 ` [Bug libgcj/13972] " k dot allan-gcc at au dot darkbluesea dot com
2004-02-02  4:27 ` pinskia at gcc dot gnu dot org
2004-06-27 16:20 ` mckinlay at redhat dot com
2005-01-11 20:40 ` cvs-commit at gcc dot gnu dot org
2005-01-11 20:43 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).