tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r883201 - in /tomcat/trunk/java/org/apache: coyote/ajp/ coyote/http11/ coyote/http11/filters/ tomcat/util/buf/
Date Mon, 23 Nov 2009 00:36:11 GMT
Author: markt
Date: Mon Nov 23 00:36:10 2009
New Revision: 883201

URL: http://svn.apache.org/viewvc?rev=883201&view=rev
Log:
Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=48239
HexUtils exposes public array
Based on a patch provided by sebb

Modified:
    tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
    tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
    tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
    tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
    tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java
    tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpAprProcessor.java Mon Nov 23 00:36:10 2009
@@ -920,7 +920,7 @@
             int port = 0;
             int mult = 1;
             for (int i = valueL - 1; i > colonPos; i--) {
-                int charValue = HexUtils.DEC[valueB[i + valueS]];
+                int charValue = HexUtils.getDec(valueB[i + valueS]);
                 if (charValue == -1) {
                     // Invalid character
                     error = true;

Modified: tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Mon Nov 23 00:36:10 2009
@@ -925,7 +925,7 @@
             int port = 0;
             int mult = 1;
             for (int i = valueL - 1; i > colonPos; i--) {
-                int charValue = HexUtils.DEC[valueB[i + valueS]];
+                int charValue = HexUtils.getDec(valueB[i + valueS]);
                 if (charValue == -1) {
                     // Invalid character
                     error = true;

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11AprProcessor.java Mon Nov 23 00:36:10
2009
@@ -1480,7 +1480,7 @@
             int port = 0;
             int mult = 1;
             for (int i = valueL - 1; i > colonPos; i--) {
-                int charValue = HexUtils.DEC[valueB[i + valueS]];
+                int charValue = HexUtils.getDec(valueB[i + valueS]);
                 if (charValue == -1) {
                     // Invalid character
                     error = true;

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11NioProcessor.java Mon Nov 23 00:36:10
2009
@@ -1036,7 +1036,7 @@
             int port = 0;
             int mult = 1;
             for (int i = valueL - 1; i > colonPos; i--) {
-                int charValue = HexUtils.DEC[valueB[i + valueS]];
+                int charValue = HexUtils.getDec(valueB[i + valueS]);
                 if (charValue == -1) {
                     // Invalid character
                     error = true;

Modified: tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/Http11Processor.java Mon Nov 23 00:36:10 2009
@@ -995,7 +995,7 @@
             int port = 0;
             int mult = 1;
             for (int i = valueL - 1; i > colonPos; i--) {
-                int charValue = HexUtils.DEC[valueB[i + valueS]];
+                int charValue = HexUtils.getDec(valueB[i + valueS]);
                 if (charValue == -1) {
                     // Invalid character
                     error = true;

Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedInputFilter.java Mon Nov 23
00:36:10 2009
@@ -281,10 +281,10 @@
                 trailer = true;
             } else if (!trailer) { 
                 //don't read data after the trailer
-                if (HexUtils.DEC[buf[pos]] != -1) {
+                if (HexUtils.getDec(buf[pos]) != -1) {
                     readDigit = true;
                     result *= 16;
-                    result += HexUtils.DEC[buf[pos]];
+                    result += HexUtils.getDec(buf[pos]);
                 } else {
                     //we shouldn't allow invalid, non hex characters
                     //in the chunked header

Modified: tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java (original)
+++ tomcat/trunk/java/org/apache/coyote/http11/filters/ChunkedOutputFilter.java Mon Nov 23
00:36:10 2009
@@ -118,7 +118,7 @@
         while (current > 0) {
             int digit = current % 16;
             current = current / 16;
-            chunkLength[pos--] = HexUtils.HEX[digit];
+            chunkLength[pos--] = HexUtils.getHex(digit);
         }
         chunkHeader.setBytes(chunkLength, pos + 1, 9 - pos);
         buffer.doWrite(chunkHeader, res);

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/HexUtils.java Mon Nov 23 00:36:10 2009
@@ -34,7 +34,7 @@
     /**
      *  Table for HEX to DEC byte translation.
      */
-    public static final int[] DEC = {
+    private static final int[] DEC = {
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
         -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -57,7 +57,7 @@
     /**
      * Table for DEC to HEX byte translation.
      */
-    public static final byte[] HEX = 
+    private static final byte[] HEX = 
     { (byte) '0', (byte) '1', (byte) '2', (byte) '3', (byte) '4', (byte) '5', 
       (byte) '6', (byte) '7', (byte) '8', (byte) '9', (byte) 'a', (byte) 'b', 
       (byte) 'c', (byte) 'd', (byte) 'e', (byte) 'f' };
@@ -73,4 +73,11 @@
         // Nothing to do
     }
 
+    public static int getDec(int index){
+        return DEC[index];
+    }
+
+    public static byte getHex(int index){
+        return HEX[index];
+    }
 }
\ No newline at end of file

Modified: tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java
URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java?rev=883201&r1=883200&r2=883201&view=diff
==============================================================================
--- tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java (original)
+++ tomcat/trunk/java/org/apache/tomcat/util/buf/MessageBytes.java Mon Nov 23 00:36:10 2009
@@ -526,7 +526,7 @@
         while (current > 0) {
             int digit = current % 10;
             current = current / 10;
-            buf[end++] = HexUtils.HEX[digit];
+            buf[end++] = HexUtils.getHex(digit);
         }
         byteC.setOffset(0);
         byteC.setEnd(end);
@@ -568,7 +568,7 @@
         while (current > 0) {
             int digit = (int) (current % 10);
             current = current / 10;
-            buf[end++] = HexUtils.HEX[digit];
+            buf[end++] = HexUtils.getHex(digit);
         }
         byteC.setOffset(0);
         byteC.setEnd(end);



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


Mime
View raw message