Author: rjung
Date: Thu Aug  2 07:47:00 2007
New Revision: 562131

URL: http://svn.apache.org/viewvc?view=rev&rev=562131
Log:
Move fail on status a little down the protocol
stack, so that we haven't yet returned the headers.

Modified:
    tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c

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?view=diff&rev=562131&r1=562130&r2=562131
==============================================================================
--- tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c (original)
+++ tomcat/connectors/trunk/jk/native/common/jk_ajp_common.c Thu Aug  2 
07:47:00 2007
@@ -1423,6 +1423,18 @@
     return (JK_TRUE);
 }
 
+
+static int is_http_status_fail(ajp_worker_t *w, int status)
+{
+    unsigned int i;
+    for (i = 0; i < w->http_status_fail_num; i++) {
+        if (w->http_status_fail[i] == status)
+            return 1;
+    }
+    return 0;
+}
+
+
 /*
  * What to do with incoming data (dispatcher)
  */
@@ -1445,13 +1457,17 @@
                 JK_TRACE_EXIT(l);
                 return JK_AJP13_ERROR;
             }
+            r->http_response_status = res.status;
+            if (is_http_status_fail(ae->worker, res.status)) {
+                JK_TRACE_EXIT(l);
+                return JK_STATUS_ERROR;
+            }
             r->start_response(r, res.status, res.msg,
                               (const char *const *)res.header_names,
                               (const char *const *)res.header_values,
                               res.num_headers);
             if (r->flush && r->flush_header)
                 r->flush(r);
-            r->http_response_status = res.status;
         }
         return JK_AJP13_SEND_HEADERS;
 
@@ -1564,17 +1580,6 @@
     return JK_AJP13_NO_RESPONSE;
 }
 
-static int is_http_status_fail(ajp_worker_t *w, int status)
-{
-    unsigned int i;
-    for (i = 0; i < w->http_status_fail_num; i++) {
-        if (w->http_status_fail[i] == status)
-            return 1;
-    }
-    return 0;
-}
-
-
 /*
  * get replies from Tomcat via Ajp13/Ajp14
  * We will know only at read time if the remote host closed
@@ -1733,11 +1738,11 @@
             return JK_TRUE;
         }
         else if (JK_AJP13_SEND_HEADERS == rc) {
-            if (is_http_status_fail(p->worker, s->http_response_status)) {
-                JK_TRACE_EXIT(l);
-                return JK_STATUS_ERROR;
-            }
             headeratclient = JK_TRUE;
+        }
+        else if (JK_STATUS_ERROR == rc) {
+            JK_TRACE_EXIT(l);
+            return JK_STATUS_ERROR;
         }
         else if (JK_AJP13_HAS_RESPONSE == rc) {
             /*



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to