Author: remy.maucherat(a)jboss.com
Date: 2014-05-15 05:50:43 -0400 (Thu, 15 May 2014)
New Revision: 2412
Modified:
branches/7.4.x/src/main/java/org/apache/coyote/http11/InternalNioInputBuffer.java
Log:
BZ1097763: Identify apparently missing code in non blocking mode to make sure the data can
fit in the buffer, so possible fix.
Modified:
branches/7.4.x/src/main/java/org/apache/coyote/http11/InternalNioInputBuffer.java
===================================================================
---
branches/7.4.x/src/main/java/org/apache/coyote/http11/InternalNioInputBuffer.java 2014-05-02
14:10:48 UTC (rev 2411)
+++
branches/7.4.x/src/main/java/org/apache/coyote/http11/InternalNioInputBuffer.java 2014-05-15
09:50:43 UTC (rev 2412)
@@ -118,6 +118,14 @@
if (nBytes > 0) {
bbuf.flip();
+ if (nBytes > (buf.length - end)) {
+ // An alternative is to bbuf.limit(buf.length - end) before the
read,
+ // which may be less efficient
+ buf = new byte[buf.length];
+ end = 0;
+ pos = end;
+ lastValid = pos;
+ }
bbuf.get(buf, pos, nBytes);
lastValid = pos + nBytes;
semaphore.release();
@@ -456,7 +464,7 @@
if (nRead > 0) {
bbuf.flip();
if (nRead > (buf.length - end)) {
- // An alternative is to bbuf.setLimit(buf.length - end) before the
read,
+ // An alternative is to bbuf.limit(buf.length - end) before the
read,
// which may be less efficient
buf = new byte[buf.length];
end = 0;
@@ -486,6 +494,8 @@
throw MESSAGES.requestHeaderTooLarge();
}
} else {
+ // Alternative to buffer reallocation
+ // bbuf.limit(buf.length - end);
pos = end;
lastValid = pos;
}
Show replies by date