You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by re...@apache.org on 2006/10/13 13:39:36 UTC

svn commit: r463652 - in /tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp: AjpMessage.java AjpProcessor.java

Author: remm
Date: Fri Oct 13 04:39:30 2006
New Revision: 463652

URL: http://svn.apache.org/viewvc?view=rev&rev=463652
Log:
- Packet must be ended before sending.
- Fix off by one check bug in AjpMessage.
- Fix recycling bug (setting streams to null when doing keepalive is not a good idea).

Modified:
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpMessage.java
    tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpMessage.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpMessage.java?view=diff&rev=463652&r1=463651&r2=463652
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpMessage.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpMessage.java Fri Oct 13 04:39:30 2006
@@ -275,7 +275,7 @@
      * @param numBytes The number of bytes to copy.  
      */
     public void appendBytes(byte[] b, int off, int numBytes) {
-        if (pos + numBytes + 3 >= buf.length) {
+        if (pos + numBytes + 3 > buf.length) {
             log.error(sm.getString("ajpmessage.overflow", "" + numBytes, "" + pos),
                     new ArrayIndexOutOfBoundsException());
             if (log.isDebugEnabled()) {
@@ -381,6 +381,11 @@
         return 4;
     }
 
+    
+    public int getPacketSize() {
+        return buf.length;
+    }
+    
     
     public int processHeader() {
         pos = 0;

Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java?view=diff&rev=463652&r1=463651&r2=463652
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java Fri Oct 13 04:39:30 2006
@@ -428,7 +428,9 @@
 
         rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
         recycle();
-
+        input = null;
+        output = null;
+        
         return true;
 
     }
@@ -1062,9 +1064,6 @@
         response.recycle();
         certificates.recycle();
 
-        input = null;
-        output = null;
-        
     }
 
 
@@ -1157,7 +1156,9 @@
                 responseHeaderMessage.reset();
                 responseHeaderMessage.appendByte(Constants.JK_AJP13_SEND_BODY_CHUNK);
                 responseHeaderMessage.appendBytes(chunk.getBytes(), chunk.getOffset() + off, thisTime);
+                responseHeaderMessage.end();
                 output.write(responseHeaderMessage.getBuffer(), 0, responseHeaderMessage.getLen());
+
                 off += thisTime;
             }
 



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


Re: svn commit: r463652 - in /tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp: AjpMessage.java AjpProcessor.java

Posted by Remy Maucherat <re...@apache.org>.
Peter Rossbach wrote:
> Hi Remy,
> 
> can we backport this to tomcat 5.5?

Yes, but it's not actually used since the APR connector doesn't use 
appendBytes (it's not very useful either in Tomcat 6 since the connector 
is not used, but I'm it in JBoss).

Rémy

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


Re: svn commit: r463652 - in /tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp: AjpMessage.java AjpProcessor.java

Posted by Peter Rossbach <pr...@objektpark.de>.
Hi Remy,

can we backport this to tomcat 5.5?

regards
Peter



Am 13.10.2006 um 13:39 schrieb remm@apache.org:

> Author: remm
> Date: Fri Oct 13 04:39:30 2006
> New Revision: 463652
>
> URL: http://svn.apache.org/viewvc?view=rev&rev=463652
> Log:
> - Packet must be ended before sending.
> - Fix off by one check bug in AjpMessage.
> - Fix recycling bug (setting streams to null when doing keepalive  
> is not a good idea).
>
> Modified:
>     tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpMessage.java
>     tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpProcessor.java
>
> Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/ 
> AjpMessage.java
> URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/ 
> apache/coyote/ajp/AjpMessage.java? 
> view=diff&rev=463652&r1=463651&r2=463652
> ====================================================================== 
> ========
> --- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpMessage.java  
> (original)
> +++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/AjpMessage.java  
> Fri Oct 13 04:39:30 2006
> @@ -275,7 +275,7 @@
>       * @param numBytes The number of bytes to copy.
>       */
>      public void appendBytes(byte[] b, int off, int numBytes) {
> -        if (pos + numBytes + 3 >= buf.length) {
> +        if (pos + numBytes + 3 > buf.length) {
>              log.error(sm.getString("ajpmessage.overflow", "" +  
> numBytes, "" + pos),
>                      new ArrayIndexOutOfBoundsException());
>              if (log.isDebugEnabled()) {
> @@ -381,6 +381,11 @@
>          return 4;
>      }
>
> +
> +    public int getPacketSize() {
> +        return buf.length;
> +    }
> +
>
>      public int processHeader() {
>          pos = 0;
>
> Modified: tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/ 
> AjpProcessor.java
> URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/ 
> apache/coyote/ajp/AjpProcessor.java? 
> view=diff&rev=463652&r1=463651&r2=463652
> ====================================================================== 
> ========
> --- tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/ 
> AjpProcessor.java (original)
> +++ tomcat/tc6.0.x/trunk/java/org/apache/coyote/ajp/ 
> AjpProcessor.java Fri Oct 13 04:39:30 2006
> @@ -428,7 +428,9 @@
>
>          rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
>          recycle();
> -
> +        input = null;
> +        output = null;
> +
>          return true;
>
>      }
> @@ -1062,9 +1064,6 @@
>          response.recycle();
>          certificates.recycle();
>
> -        input = null;
> -        output = null;
> -
>      }
>
>
> @@ -1157,7 +1156,9 @@
>                  responseHeaderMessage.reset();
>                  responseHeaderMessage.appendByte 
> (Constants.JK_AJP13_SEND_BODY_CHUNK);
>                  responseHeaderMessage.appendBytes(chunk.getBytes 
> (), chunk.getOffset() + off, thisTime);
> +                responseHeaderMessage.end();
>                  output.write(responseHeaderMessage.getBuffer(), 0,  
> responseHeaderMessage.getLen());
> +
>                  off += thisTime;
>              }
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: dev-help@tomcat.apache.org
>
>