tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rj...@apache.org
Subject svn commit: r579349 - in /tomcat/connectors/trunk/jk: native/apache-1.3/ native/apache-2.0/ native/common/ native/iis/ native/netscape/ xdocs/miscellaneous/
Date Tue, 25 Sep 2007 18:48:36 GMT
Author: rjung
Date: Tue Sep 25 11:48:34 2007
New Revision: 579349

URL: http://svn.apache.org/viewvc?rev=579349&view=rev
Log:
Ignore ajp13 flush packets before we received the response headers.
To make the callback handler aware of the missing headers,
we move the existing response_started flag from the web server
private data to the service struct. All supported web servers had
it in their private data and used it already in the same way.

Modified:
    tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
    tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c
    tomcat/connectors/trunk/jk/native/common/jk_service.h
    tomcat/connectors/trunk/jk/native/common/jk_util.c
    tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
    tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c
    tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml

Modified: tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c?rev=579349&r1=579348&r2=579349&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-1.3/mod_jk.c Tue Sep 25 11:48:34 2007
@@ -204,9 +204,6 @@
      */
     jk_pool_t p;
 
-    /* True iff response headers have been returned to client */
-    int response_started;
-
     /* True iff request body data has been read from Apache */
     int read_body_started;
 
@@ -314,7 +311,7 @@
         }
 
         ap_send_http_header(r);
-        p->response_started = JK_TRUE;
+        s->response_started = JK_TRUE;
 
         return JK_TRUE;
     }
@@ -359,6 +356,7 @@
 
 static void JK_METHOD ws_flush(jk_ws_service_t *s)
 {
+    }
     if (s && s->ws_private) {
         apache_private_data_t *p = s->ws_private;
         BUFF *bf = p->r->connection->client;
@@ -387,7 +385,7 @@
             int w = (int)len;
             int r = 0;
 
-            if (!p->response_started) {
+            if (!s->response_started) {
                 if (main_log)
                     jk_log(main_log, JK_LOG_INFO,
                            "Write without start, starting with defaults");
@@ -2084,7 +2082,6 @@
             jk_pool_atom_t buf[SMALL_POOL_SIZE];
             jk_open_pool(&private_data.p, buf, sizeof(buf));
 
-            private_data.response_started = JK_FALSE;
             private_data.read_body_started = JK_FALSE;
             private_data.r = r;
 

Modified: tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c?rev=579349&r1=579348&r2=579349&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c (original)
+++ tomcat/connectors/trunk/jk/native/apache-2.0/mod_jk.c Tue Sep 25 11:48:34 2007
@@ -224,7 +224,6 @@
 {
     jk_pool_t p;
 
-    int response_started;
     int read_body_started;
     request_rec *r;
 };
@@ -317,7 +316,7 @@
 
     /* this NOP function was removed in apache 2.0 alpha14 */
     /* ap_send_http_header(r); */
-    p->response_started = JK_TRUE;
+    s->response_started = JK_TRUE;
 
     return JK_TRUE;
 }
@@ -408,7 +407,7 @@
             int ll = l;
             const char *bb = (const char *)b;
 
-            if (!p->response_started) {
+            if (!s->response_started) {
                 if (main_log)
                     jk_log(main_log, JK_LOG_INFO,
                            "Write without start, starting with defaults");
@@ -2156,7 +2155,6 @@
             jk_pool_atom_t buf[SMALL_POOL_SIZE];
             jk_open_pool(&private_data.p, buf, sizeof(buf));
 
-            private_data.response_started = JK_FALSE;
             private_data.read_body_started = JK_FALSE;
             private_data.r = r;
 

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=579349&r1=579348&r2=579349&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Tue Sep 25 11:48:34 2007
@@ -1518,8 +1518,15 @@
                 /* AJP13_SEND_BODY_CHUNK with length 0 is
                  * explicit flush packet message.
                  */
-                if (r->flush)
-                    r->flush(r);
+                if (r->response_started) {
+                    if (r->flush) {
+                        r->flush(r);
+                    }
+                }
+                else {
+                    jk_log(l, JK_LOG_DEBUG,
+                           "Ignoring flush message received before headers");
+                }
             }
             else {
                 if (!r->write(r, msg->buf + msg->pos, len)) {

Modified: tomcat/connectors/trunk/jk/native/common/jk_service.h
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_service.h?rev=579349&r1=579348&r2=579349&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_service.h (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_service.h Tue Sep 25 11:48:34 2007
@@ -223,6 +223,11 @@
     int flush_header;
 
     /*
+     * JK_TRUE if response headers have been sent back
+     */
+    int response_started;
+
+    /*
      * HTTP status sent from container.
      */
     int http_response_status;

Modified: tomcat/connectors/trunk/jk/native/common/jk_util.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/common/jk_util.c?rev=579349&r1=579348&r2=579349&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_util.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_util.c Tue Sep 25 11:48:34 2007
@@ -1824,6 +1824,7 @@
     s->num_attributes = 0;
     s->route = NULL;
     s->retries = JK_RETRIES;
+    s->response_started = JK_FALSE;
     s->add_log_items = NULL;
 }
 

Modified: tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c?rev=579349&r1=579348&r2=579349&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c (original)
+++ tomcat/connectors/trunk/jk/native/iis/jk_isapi_plugin.c Tue Sep 25 11:48:34 2007
@@ -212,7 +212,6 @@
 {
     jk_pool_t p;
 
-    int response_started;
     unsigned int bytes_read_so_far;
     LPEXTENSION_CONTROL_BLOCK lpEcb;
 };
@@ -587,12 +586,12 @@
     if (s && s->ws_private) {
         int rv = JK_TRUE;
         isapi_private_data_t *p = s->ws_private;
-        if (!p->response_started) {
+        if (!s->response_started) {
             char *status_str;
             DWORD status_str_len;
             char *headers_str = NULL;
             BOOL keep_alive = FALSE;
-            p->response_started = JK_TRUE;
+            s->response_started = JK_TRUE;
 
             /*
              * Create the status line
@@ -743,7 +742,7 @@
             unsigned int written = 0;
             char *buf = (char *)b;
 
-            if (!p->response_started) {
+            if (!s->response_started) {
                 start_response(s, 200, NULL, NULL, NULL, 0);
             }
 
@@ -1499,7 +1498,6 @@
         jk_init_ws_service(&s);
         jk_open_pool(&private_data.p, buf, sizeof(buf));
 
-        private_data.response_started = JK_FALSE;
         private_data.bytes_read_so_far = 0;
         private_data.lpEcb = lpEcb;
 

Modified: tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c?rev=579349&r1=579348&r2=579349&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c (original)
+++ tomcat/connectors/trunk/jk/native/netscape/jk_nsapi_plugin.c Tue Sep 25 11:48:34 2007
@@ -43,8 +43,6 @@
 {
     jk_pool_t p;
 
-    int response_started;
-
     pblock *pb;
     Session *sn;
     Request *rq;
@@ -125,10 +123,10 @@
 {
     if (s && s->ws_private) {
         nsapi_private_data_t *p = s->ws_private;
-        if (!p->response_started) {
+        if (!s->response_started) {
             unsigned i;
 
-            p->response_started = JK_TRUE;
+            s->response_started = JK_TRUE;
 
             /* Remove "old" content type */
             param_free(pblock_remove("content-type", p->rq->srvhdrs));
@@ -210,7 +208,7 @@
         nsapi_private_data_t *p = s->ws_private;
 
         if (l) {
-            if (!p->response_started) {
+            if (!s->response_started) {
                 start_response(s, 200, NULL, NULL, NULL, 0);
             }
 
@@ -366,7 +364,6 @@
 
         jk_open_pool(&private_data.p, buf, sizeof(buf));
 
-        private_data.response_started = JK_FALSE;
         private_data.pb = pb;
         private_data.sn = sn;
         private_data.rq = rq;

Modified: tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml?rev=579349&r1=579348&r2=579349&view=diff
==============================================================================
--- tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml (original)
+++ tomcat/connectors/trunk/jk/xdocs/miscellaneous/changelog.xml Tue Sep 25 11:48:34 2007
@@ -44,6 +44,9 @@
   <subsection name="Native">
     <changelog>
       <fix>
+        AJP13: Ignore flush packets before we received the response headers. (rjung)
+      </fix>
+      <fix>
         Fix crash during startup when using worker configuration inheritance
         (attribute "reference") and log level debug. (rjung)
       </fix>



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


Mime
View raw message