remm 2005/06/15 08:27:33
Modified: jk/java/org/apache/coyote/ajp AjpAprProcessor.java
Log:
- Fix some basic issues with the AJP on APR implementation.
- In particular, endRequest is no longer called twice (oops ...).
Revision Changes Path
1.2 +15 -25
jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java
Index: AjpAprProcessor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-connectors/jk/java/org/apache/coyote/ajp/AjpAprProcessor.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AjpAprProcessor.java 9 Jun 2005 16:14:51 -0000 1.1
+++ AjpAprProcessor.java 15 Jun 2005 15:27:33 -0000 1.2
@@ -88,7 +88,7 @@
readBodyMessage.appendByte(Constants.JK_AJP13_GET_BODY_CHUNK);
readBodyMessage.appendInt(Constants.MAX_READ_SIZE);
-
+
}
@@ -130,7 +130,7 @@
/**
* Char version of the message header.
*/
- protected char[] headerChar = new char[8*1024]; // FIXME: Size should be
configurable
+ //protected char[] headerChar = new char[8*1024];
/**
@@ -375,14 +375,12 @@
// (long keepalive), so that the processor should be
recycled
// and the method should return true
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
- openSocket = true;
- // Add the socket to the poller
- endpoint.getPoller().add(socket, pool);
break;
}
- // FIXME: Check message type, process right away and break
if
+ // Check message type, process right away and break if
// not regular request processing
int type = headerMessage.getByte();
+ // FIXME: Any other types which should be checked ?
if (type == Constants.JK_AJP13_CPING_REQUEST) {
headerMessage.reset();
headerMessage.appendByte(Constants.JK_AJP13_CPONG_REPLY);
@@ -431,21 +429,6 @@
}
}
- // Finish the handling of the request
- try {
- thrA.setCurrentStage(endpoint, "endRequest");
- rp.setStage(org.apache.coyote.Constants.STAGE_ENDINPUT);
- endRequest();
- // FXIME: Do one last flush
- } catch (IOException e) {
- error = true;
- } catch (Throwable t) {
- log.error("Error finishing request", t);
- // 500 - Internal Server Error
- response.setStatus(500);
- error = true;
- }
-
// If there was an error, make sure the request is counted as
// and error, and update the statistics counter
if (error) {
@@ -459,9 +442,16 @@
}
+ // Add the socket to the poller
+ if (!error) {
+ endpoint.getPoller().add(socket, pool);
+ } else {
+ openSocket = false;
+ }
+
rp.setStage(org.apache.coyote.Constants.STAGE_ENDED);
recycle();
-
+
return openSocket;
}
@@ -1122,7 +1112,7 @@
int headerLength = message.getHeaderLength();
// Read the message header
- // FIXME: do crazy tricks to avoid doing two reads !!!!
+ // FIXME: better buffering to avoid doing two reads !!!!
if (first) {
int nRead = Socket.recvt
(socket, buf, 0, headerLength, readTimeout);
@@ -1131,7 +1121,7 @@
if (nRead == headerLength) {
message.processHeader();
} else {
- if (Status.APR_STATUS_IS_ETIMEDOUT(-nRead)) {
+ if ((-nRead) == Status.ETIMEDOUT || (-nRead) ==
Status.TIMEUP) {
return false;
} else {
throw new IOException(sm.getString("iib.failedread"));
@@ -1169,7 +1159,6 @@
*/
protected void writeMessage(AjpMessage message)
throws IOException {
- // FIXME: Write to a temporary direct buffer
message.end();
if (Socket.send(socket, message.getBuffer(), 0, message.getLen()) <
0)
throw new IOException(sm.getString("iib.failedwrite"));
@@ -1182,6 +1171,7 @@
public void recycle() {
// Recycle Request object
+ first = true;
request.recycle();
response.recycle();
headerMessage.reset();
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]