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 2004/03/05 14:08:00 UTC

cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf CharChunk.java

remm        2004/03/05 05:08:00

  Modified:    util/java/org/apache/tomcat/util/buf CharChunk.java
  Log:
  - Same fix.
  - Make calls to realReads compatible with marking (which is just for cleaness,
    as the parameters are not used in our use case).
  - Make makeSpace compatible with marking, which needs to be supported
    by char chunks.
  
  Revision  Changes    Path
  1.12      +8 -9      jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java
  
  Index: CharChunk.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/CharChunk.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- CharChunk.java	24 Feb 2004 08:50:06 -0000	1.11
  +++ CharChunk.java	5 Mar 2004 13:08:00 -0000	1.12
  @@ -261,6 +261,7 @@
   	    // makeSpace will grow the buffer to the limit,
   	    // so we have space
   	    System.arraycopy( src, off, buff, end, len );
  +            
   	    end+=len;
   	    return;
   	}
  @@ -368,7 +369,7 @@
           if ((end - start) == 0) {
               if (in == null)
                   return -1;
  -            int n = in.realReadChars(buff, 0, buff.length);
  +            int n = in.realReadChars(buff, end, buff.length - end);
               if (n < 0)
                   return -1;
           }
  @@ -383,7 +384,7 @@
           if ((end - start) == 0) {
               if (in == null)
                   return -1;
  -            int n = in.realReadChars( buff, 0, buff.length );
  +            int n = in.realReadChars( buff, end, buff.length - end);
               if (n < 0)
                   return -1;
           }
  @@ -401,7 +402,7 @@
           if ((end - start) == 0) {
               if (in == null)
                   return -1;
  -            int n = in.realReadChars( buff, 0, buff.length );
  +            int n = in.realReadChars( buff, end, buff.length - end);
               if (n < 0)
                   return -1;
           }
  @@ -441,8 +442,8 @@
   
   	// Can't grow above the limit
   	if( limit > 0 &&
  -	    desiredSize > limit -start  ) {
  -	    desiredSize=limit-start;
  +	    desiredSize > limit) {
  +	    desiredSize=limit;
   	}
   
   	if( buff==null ) {
  @@ -452,7 +453,7 @@
   
   	// limit < buf.length ( the buffer is already big )
   	// or we already have space XXX
  -	if( desiredSize <= buff.length ) {
  +	if( desiredSize <= buff.length) {
   	    return;
   	}
   	// grow in larger chunks
  @@ -468,11 +469,9 @@
   	    tmp=new char[newSize];
   	}
   	
  -	System.arraycopy(buff, start, tmp, 0, end-start);
  +	System.arraycopy(buff, start, tmp, start, end-start);
   	buff = tmp;
   	tmp = null;
  -	end=end-start;
  -	start=0;
       }
       
       // -------------------- Conversion and getters --------------------
  
  
  

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


Re: cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf CharChunk.java

Posted by Bill Barker <wb...@wilshire.com>.
Actually, I had intended to include the fix to JkInputStream with the 3.3.2
release.  It's just that you got to it faster than me :).

I agree with Remy that the changes to ByteChunk and CharChunk shouldn't do
anything, but I also agree with the idea of not risking it with the 3.3.2
release.  I'm inclined to tag 3.3.2 Final for these two before Remy's patch.

----- Original Message -----
From: "Kurt Miller" <tr...@apache.org>
To: "Tomcat Developers List" <to...@jakarta.apache.org>
Sent: Friday, March 05, 2004 8:36 AM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf
CharChunk.java


From: "Remy Maucherat" <re...@apache.org>
> remm@apache.org wrote:
> > remm        2004/03/05 05:08:00
> >
> >   Modified:    util/java/org/apache/tomcat/util/buf CharChunk.java
> >   Log:
> >   - Same fix.
> >   - Make calls to realReads compatible with marking (which is just
for cleaness,
> >     as the parameters are not used in our use case).
> >   - Make makeSpace compatible with marking, which needs to be
supported
> >     by char chunks.
>
> I hope I didn't break anything with these changes ...
> Maybe it would be a good idea to tag 3.3.x before these, to be safe.

If 3.3.x is tagged before this change it probably would be a good idea
to pick up the JkInputStream change I committed earlier. It fixes a
problem where small packets were getting dropped and causing the last
one or two bytes of post data to be lost for certain sized posts.

> Of  course, it should only impact char buffers which are allowed to
grow
> significantly, which aren't used a lot (AFAIK). In Tomcat 5, I
believe
> we play with setLimit dynamically only for char input.
>
> Please test it :)
>
> Rémy
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>


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



Re: cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf CharChunk.java

Posted by Kurt Miller <tr...@apache.org>.
From: "Remy Maucherat" <re...@apache.org>
> remm@apache.org wrote:
> > remm        2004/03/05 05:08:00
> >
> >   Modified:    util/java/org/apache/tomcat/util/buf CharChunk.java
> >   Log:
> >   - Same fix.
> >   - Make calls to realReads compatible with marking (which is just
for cleaness,
> >     as the parameters are not used in our use case).
> >   - Make makeSpace compatible with marking, which needs to be
supported
> >     by char chunks.
>
> I hope I didn't break anything with these changes ...
> Maybe it would be a good idea to tag 3.3.x before these, to be safe.

If 3.3.x is tagged before this change it probably would be a good idea
to pick up the JkInputStream change I committed earlier. It fixes a
problem where small packets were getting dropped and causing the last
one or two bytes of post data to be lost for certain sized posts.

> Of  course, it should only impact char buffers which are allowed to
grow
> significantly, which aren't used a lot (AFAIK). In Tomcat 5, I
believe
> we play with setLimit dynamically only for char input.
>
> Please test it :)
>
> Rémy
>
> --------------------------------------------------------------------
-
> To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org
>


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


Re: cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf CharChunk.java

Posted by Remy Maucherat <re...@apache.org>.
remm@apache.org wrote:
> remm        2004/03/05 05:08:00
> 
>   Modified:    util/java/org/apache/tomcat/util/buf CharChunk.java
>   Log:
>   - Same fix.
>   - Make calls to realReads compatible with marking (which is just for cleaness,
>     as the parameters are not used in our use case).
>   - Make makeSpace compatible with marking, which needs to be supported
>     by char chunks.

I hope I didn't break anything with these changes ...
Maybe it would be a good idea to tag 3.3.x before these, to be safe. Of 
course, it should only impact char buffers which are allowed to grow 
significantly, which aren't used a lot (AFAIK). In Tomcat 5, I believe 
we play with setLimit dynamically only for char input.

Please test it :)

Rémy

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