Author: mturk
Date: Mon Oct 27 07:56:03 2008
New Revision: 708205
URL: http://svn.apache.org/viewvc?rev=708205&view=rev
Log:
Remember the last AJP operation on the endpoint. I case we try to issue a new
request while the previous request was not ended recycle the connection.
Modified:
tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h
Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c?rev=708205&r1=708204&r2=708205&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Mon Oct 27
07:56:03 2008
@@ -746,6 +746,7 @@
if (IS_VALID_SOCKET(ae->sd) && !ae->reuse) {
jk_shutdown_socket(ae->sd, l);
ae->sd = JK_INVALID_SOCKET;
+ ae->last_op = JK_AJP13_END_RESPONSE;
}
jk_reset_pool(&(ae->pool));
JK_TRACE_EXIT(l);
@@ -1365,6 +1366,17 @@
/* Up to now, we can recover */
op->recoverable = JK_TRUE;
+ /* Check if the previous request really ended
+ */
+ if (ae->last_op != JK_AJP13_END_RESPONSE) {
+ jk_log(l, JK_LOG_INFO,
+ "(%s) did not receive END_RESPONSE, "
+ "closing socket %d",
+ ae->worker->name, ae->sd);
+ jk_shutdown_socket(ae->sd, l);
+ ae->sd = JK_INVALID_SOCKET;
+ ae->last_op = JK_AJP13_END_RESPONSE;
+ }
/*
* First try to check open connections...
*/
@@ -1654,6 +1666,13 @@
{
int rc;
jk_res_data_t res;
+ if (ae->last_op == JK_AJP13_SEND_HEADERS) {
+ /* Do not send anything to the client.
+ * Backend already send us the headers.
+ */
+ JK_TRACE_EXIT(l);
+ return JK_AJP13_ERROR;
+ }
if (!ajp_unmarshal_response(msg, &res, ae, l)) {
jk_log(l, JK_LOG_ERROR,
"ajp_unmarshal_response failed");
@@ -1958,7 +1977,7 @@
}
rc = ajp_process_callback(op->reply, op->post, p, s, l);
-
+ p->last_op = rc;
/* no more data to be sent, fine we have finish here */
if (JK_AJP13_END_RESPONSE == rc) {
JK_TRACE_EXIT(l);
@@ -2508,6 +2527,7 @@
p->ep_cache[i]->proto = proto;
p->ep_cache[i]->endpoint.service = ajp_service;
p->ep_cache[i]->endpoint.done = ajp_done;
+ p->ep_cache[i]->last_op = JK_AJP13_END_RESPONSE;
}
JK_TRACE_EXIT(l);
Modified: tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h
URL:
http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h?rev=708205&r1=708204&r2=708205&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.h Mon Oct 27
07:56:03 2008
@@ -372,6 +372,8 @@
handled by this endpoint */
time_t last_access;
int last_errno;
+ /* Last operation performed via this endpoint */
+ int last_op;
};
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]