You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by rj...@apache.org on 2011/11/11 23:07:13 UTC

svn commit: r1201069 - in /tomcat/trunk/java/org/apache/coyote: ajp/AjpMessage.java http11/AbstractOutputBuffer.java

Author: rjung
Date: Fri Nov 11 22:07:13 2011
New Revision: 1201069

URL: http://svn.apache.org/viewvc?rev=1201069&view=rev
Log:
Improve multi-byte character handling in Coyote
output for HTTP and AJP.

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java
    tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java?rev=1201069&r1=1201068&r2=1201069&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpMessage.java Fri Nov 11 22:07:13 2011
@@ -209,10 +209,8 @@ public class AjpMessage {
             // but is the only consistent approach within the current
             // servlet framework.  It must suffice until servlet output
             // streams properly encode their output.
-            if ((c <= 31) && (c != 9)) {
-                c = ' ';
-            } else if (c == 127) {
-                c = ' ';
+            if (((c <= 31) && (c != 9)) || c == 127 || c > 255) {
+              c = ' ';
             }
             appendByte(c);
         }
@@ -244,10 +242,8 @@ public class AjpMessage {
             // but is the only consistent approach within the current
             // servlet framework.  It must suffice until servlet output
             // streams properly encode their output.
-            if ((c <= 31) && (c != 9)) {
-                c = ' ';
-            } else if (c == 127) {
-                c = ' ';
+            if (((c <= 31) && (c != 9)) || c == 127 || c > 255) {
+              c = ' ';
             }
             appendByte(c);
         }

Modified: tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java?rev=1201069&r1=1201068&r2=1201069&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/AbstractOutputBuffer.java Fri Nov 11 22:07:13 2011
@@ -473,10 +473,8 @@ public abstract class AbstractOutputBuff
             // but is the only consistent approach within the current
             // servlet framework.  It must suffice until servlet output
             // streams properly encode their output.
-            if ((c <= 31) && (c != 9)) {
-                c = ' ';
-            } else if (c == 127) {
-                c = ' ';
+            if (((c <= 31) && (c != 9)) || c == 127 || c > 255) {
+              c = ' ';
             }
             buf[pos++] = (byte) c;
         }
@@ -520,10 +518,8 @@ public abstract class AbstractOutputBuff
             // but is the only consistent approach within the current
             // servlet framework.  It must suffice until servlet output
             // streams properly encode their output.
-            if ((c <= 31) && (c != 9)) {
-                c = ' ';
-            } else if (c == 127) {
-                c = ' ';
+            if (((c <= 31) && (c != 9)) || c == 127 || c > 255) {
+              c = ' ';
             }
             buf[pos++] = (byte) c;
         }



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org