Author: markt
Date: Tue Aug 23 17:44:42 2011
New Revision: 1160822
URL: http://svn.apache.org/viewvc?rev=1160822&view=rev
Log:
Re-factoring
Add byte read count
Add ability to swallow input
Modified:
tomcat/tc7.0.x/trunk/ (props changed)
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
Propchange: tomcat/tc7.0.x/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Aug 23 17:44:42 2011
@@ -1 +1 @@
-/tomcat/trunk:1156171,1156276,1156304,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721
+/tomcat/trunk:1156171,1156276,1156304,1156530,1156602,1157015,1157018,1157151,1157198,1157204,1157810,1157832,1157834,1157847,1157908,1157939,1158155,1158160,1158176,1158195,1158198-1158199,1158227,1158331,1158334-1158335,1160347,1160592,1160611,1160619,1160626,1160639,1160652,1160720-1160721,1160772,1160774,1160776
Modified:
tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
URL:
http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java?rev=1160822&r1=1160821&r2=1160822&view=diff
==============================================================================
--- tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
(original)
+++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/ajp/AbstractAjpProcessor.java
Tue Aug 23 17:44:42 2011
@@ -220,9 +220,15 @@ public abstract class AbstractAjpProcess
/**
- * Bytes written to client for the current request
+ * Bytes written to client for the current request.
*/
- protected long byteCount = 0;
+ protected long bytesWritten = 0;
+
+
+ /**
+ * Request body bytes read for the current request.
+ */
+ protected long bodyBytesRead = 0;
// ------------------------------------------------------------ Constructor
@@ -529,7 +535,8 @@ public abstract class AbstractAjpProcess
request.recycle();
response.recycle();
certificates.recycle();
- byteCount = 0;
+ bytesWritten = 0;
+ bodyBytesRead = 0;
}
@@ -1003,12 +1010,12 @@ public abstract class AbstractAjpProcess
*/
protected class SocketInputBuffer implements InputBuffer {
-
/**
- * Read bytes into the specified chunk.
+ * Read bytes into the specified chunk. If no chunk is specified, the
+ * bytes are swallowed.
*/
@Override
- public int doRead(ByteChunk chunk, Request req )
+ public int doRead(ByteChunk chunk, Request req)
throws IOException {
if (endOfStream) {
@@ -1025,10 +1032,12 @@ public abstract class AbstractAjpProcess
}
}
ByteChunk bc = bodyBytes.getByteChunk();
- chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
+ bodyBytesRead += bc.getLength();
+ if (chunk != null) {
+ chunk.setBytes(bc.getBuffer(), bc.getStart(), bc.getLength());
+ }
empty = true;
- return chunk.getLength();
-
+ return bc.getLength();
}
}
@@ -1079,13 +1088,13 @@ public abstract class AbstractAjpProcess
off += thisTime;
}
- byteCount += chunk.getLength();
+ bytesWritten += chunk.getLength();
return chunk.getLength();
}
@Override
public long getBytesWritten() {
- return byteCount;
+ return bytesWritten;
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]