classpath-patches
[Top][All Lists]
Advanced

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

[cp-patches] Patch: FYI: fix http Headers oddity


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: fix http Headers oddity
Date: 16 May 2005 14:57:08 -0600
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

I'm checking this in on the trunk, the 4.0 branch, and Classpath.

This fixes a bug that occurs when an http server erroneously uses \n
as a line terminator rather than \r\n.  This lets us use a certain web
applet I ran across.

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 20:59:21 -0000
@@ -323,7 +323,10 @@
         if (c1 == ' ' || c1 == '\t')
           {
             // Continuation
-            value.append(line.substring(0, len - 1));
+           int last = len - 1;
+           if (line.charAt(last) != '\r')
+             ++last;
+            value.append(line.substring(0, last));
           }
         else
           {
@@ -340,7 +343,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]