You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by Hiro Takahashi <hi...@routefree.com> on 2001/05/24 08:32:35 UTC

[PATCH] Bug fix for #1678

This is the fix for ServletInputStream.read() bug.
    #1678: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1678
The change is in Ajp13ConnectorRequest.java. This one is obviously
the one which has not been tested with a binary data.
I made this patch for 3.2.1.

Index: Ajp13ConnectorRequest.java
===================================================================
RCS file: jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Ajp13ConnectorRequest.java,v
retrieving revision 1.1
diff -u -r1.1 Ajp13ConnectorRequest.java
--- Ajp13ConnectorRequest.java	2001/05/23 22:41:09	1.1
+++ Ajp13ConnectorRequest.java	2001/05/24 06:20:53
@@ -251,8 +251,12 @@
     {
         if(pos >= blen) {
             refeelReadBuffer();
+	    if (pos>= blen) {
+		// seems no data
+		return -1;
+	    }
         }
-        return bodyBuff[pos++];
+        return bodyBuff[pos++] & 0xff;
     }
     
     public int doRead(byte[] b, int off, int len) throws IOException 
@@ -261,7 +265,6 @@
         for(int i = off ; i < (len + off) ; i++) {
             int a = doRead();
             if(-1 == a) {
-                System.out.println("Y");
                 return i-off;
             }
             b[i] = (byte)a;


Re: [PATCH] Bug fix for #1678

Posted by DAK <da...@dotech.com>.
Now, this is what I was talking about with the upload data corruption! 
Finally, corroboration!

   David

Hiro Takahashi wrote:

> This is the fix for ServletInputStream.read() bug.
>     #1678: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1678
> The change is in Ajp13ConnectorRequest.java. This one is obviously
> the one which has not been tested with a binary data.
> I made this patch for 3.2.1.
> 
> Index: Ajp13ConnectorRequest.java
> ===================================================================
> RCS file: jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Ajp13ConnectorRequest.java,v
> retrieving revision 1.1
> diff -u -r1.1 Ajp13ConnectorRequest.java
> --- Ajp13ConnectorRequest.java	2001/05/23 22:41:09	1.1
> +++ Ajp13ConnectorRequest.java	2001/05/24 06:20:53
> @@ -251,8 +251,12 @@
>      {
>          if(pos >= blen) {
>              refeelReadBuffer();
> +	    if (pos>= blen) {
> +		// seems no data
> +		return -1;
> +	    }
>          }
> -        return bodyBuff[pos++];
> +        return bodyBuff[pos++] & 0xff;
>      }
>      
>      public int doRead(byte[] b, int off, int len) throws IOException 
> @@ -261,7 +265,6 @@
>          for(int i = off ; i < (len + off) ; i++) {
>              int a = doRead();
>              if(-1 == a) {
> -                System.out.println("Y");
>                  return i-off;
>              }
>              b[i] = (byte)a;
> 


RE: [PATCH] Bug fix for #1678

Posted by Marc Saegesser <ma...@apropos.com>.
This was fixed in Tomcat 3.2.2 quite some time ago.  Check out the tip of
the tomcat_32 branch and look at the connector code again.

> -----Original Message-----
> From: Hiro Takahashi [mailto:hiro@routefree.com]
> Sent: Thursday, May 24, 2001 1:33 AM
> To: tomcat-dev@jakarta.apache.org
> Subject: [PATCH] Bug fix for #1678
>
>
> This is the fix for ServletInputStream.read() bug.
>     #1678: http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1678
> The change is in Ajp13ConnectorRequest.java. This one is obviously
> the one which has not been tested with a binary data.
> I made this patch for 3.2.1.
>
> Index: Ajp13ConnectorRequest.java
> ===================================================================
> RCS file:
> jakarta-tomcat/src/share/org/apache/tomcat/service/connector/Ajp13
ConnectorRequest.java,v
> retrieving revision 1.1
> diff -u -r1.1 Ajp13ConnectorRequest.java
> --- Ajp13ConnectorRequest.java	2001/05/23 22:41:09	1.1
> +++ Ajp13ConnectorRequest.java	2001/05/24 06:20:53
> @@ -251,8 +251,12 @@
>      {
>          if(pos >= blen) {
>              refeelReadBuffer();
> +	    if (pos>= blen) {
> +		// seems no data
> +		return -1;
> +	    }
>          }
> -        return bodyBuff[pos++];
> +        return bodyBuff[pos++] & 0xff;
>      }
>
>      public int doRead(byte[] b, int off, int len) throws IOException
> @@ -261,7 +265,6 @@
>          for(int i = off ; i < (len + off) ; i++) {
>              int a = doRead();
>              if(-1 == a) {
> -                System.out.println("Y");
>                  return i-off;
>              }
>              b[i] = (byte)a;