This is the mail archive of the java-patches@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: FYI: fix http Headers oddity


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  <tromey@redhat.com>
	* 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));
           }
       }
   }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]