classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Oddity in http Headers


From: Tom Tromey
Subject: [cp-patches] Oddity in http Headers
Date: 15 May 2005 19:10:50 -0600

I'm not checking this in, rather I'm posting it for comment.  Chris, I
CCd you explicitly since your name is on this code...

Today I tried to get a chess applet I found working with
gcjappletviewer.  With the appended, it works.  If you're interested,
here is a sample game:

    http://www.chessgames.com/perl/chessgame?gid=1069669

What is going on here is that the server returns a header line that
only has \n for a terminator -- not the required \r\n.  While this is
wrong, it is better IMO to be lenient in what we accept.  (This same
applet works fine with the JDK.)

The appended patch is kind of a hack around this.  I was wondering
what assumptions were intended for LineInputStream and its users.  For
instance, would it be better for the users to assume that
LineInputStream strips the \r as well?

Let me know, I'll implement it.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>
        * gnu/java/net/protocol/http/Headers.java (parse): Include final
        character of line.

Index: gnu/java/net/protocol/http/Headers.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/gnu/java/net/protocol/http/Headers.java,v
retrieving revision 1.2
diff -u -r1.2 Headers.java
--- gnu/java/net/protocol/http/Headers.java 18 Apr 2005 18:40:23 -0000 1.2
+++ gnu/java/net/protocol/http/Headers.java 16 May 2005 00:58:18 -0000
@@ -340,7 +340,10 @@
                 di++;
               }
             while (di < len && line.charAt(di) == ' ');
-            value.append(line.substring(di, len - 1));
+           int last = len - 1;
+           if (line.charAt(last) != '\r')
+             ++last;
+            value.append(line.substring(di, last));
           }
       }
   }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]