]> granicus.if.org Git - apache/commitdiff
mod_{proxy,authnz}_fcgi: follow up to r1750392.
authorYann Ylavic <ylavic@apache.org>
Thu, 11 Aug 2016 10:32:35 +0000 (10:32 +0000)
committerYann Ylavic <ylavic@apache.org>
Thu, 11 Aug 2016 10:32:35 +0000 (10:32 +0000)
Don't try to read past AP_FCGI_END_REQUEST on the backend side, it would be
a response for the next request.

[Reverted by r1755931]

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1755930 13f79535-47bb-0310-9956-ffa450edef68

modules/aaa/mod_authnz_fcgi.c
modules/proxy/mod_proxy_fcgi.c

index a73bad61df80404bac04cfec8f37d323708634b0..e3da288d549921c81f30855f4807173ca8cffe44 100644 (file)
@@ -475,7 +475,7 @@ static apr_status_t handle_response(const fcgi_provider_conf *conf,
     apr_status_t rv = APR_SUCCESS;
     const char *fn = "handle_response";
     int header_state = HDR_STATE_READING_HEADERS;
-    int seen_end_of_headers = 0, done = 0;
+    int seen_end_of_headers = 0;
 
     if (rspbuflen) {
         orspbuflen = *rspbuflen;
@@ -484,10 +484,10 @@ static apr_status_t handle_response(const fcgi_provider_conf *conf,
 
     ob = apr_brigade_create(r->pool, r->connection->bucket_alloc);
 
-    while (!done && rv == APR_SUCCESS) { /* Keep reading FastCGI records until
-                                          * we get AP_FCGI_END_REQUEST (done)
-                                          * or an error occurs.
-                                          */
+    while (1) { /* Keep reading FastCGI records until
+                 * we get AP_FCGI_END_REQUEST,
+                 * or an error occurs.
+                 */
         apr_size_t readbuflen;
         apr_uint16_t clen;
         apr_uint16_t rid;
@@ -632,7 +632,7 @@ static apr_status_t handle_response(const fcgi_provider_conf *conf,
             break;
 
         case AP_FCGI_END_REQUEST:
-            done = 1;
+            /* we are done below */
             break;
 
         default:
@@ -641,8 +641,8 @@ static apr_status_t handle_response(const fcgi_provider_conf *conf,
                           "%d", fn, type);
             break;
         }
-        /* Leave on above switch's inner error. */
-        if (rv != APR_SUCCESS) {
+        /* Leave on above switch's inner end/error. */
+        if (rv != APR_SUCCESS || type == AP_FCGI_END_REQUEST) {
             break;
         }
 
index 2a760fcb0255c74398215d97e2424ae3f9661ec6..3fc0044570da5bb5a2929ea595f445c4773c27c1 100644 (file)
@@ -445,7 +445,7 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
                              int *bad_request, int *has_responded)
 {
     apr_bucket_brigade *ib, *ob;
-    int seen_end_of_headers = 0, done = 0, ignore_body = 0;
+    int seen_end_of_headers = 0, ignore_body = 0;
     apr_status_t rv = APR_SUCCESS;
     int script_error_status = HTTP_OK;
     conn_rec *c = r->connection;
@@ -472,7 +472,7 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
     ib = apr_brigade_create(r->pool, c->bucket_alloc);
     ob = apr_brigade_create(r->pool, c->bucket_alloc);
 
-    while (! done) {
+    while (1) {
         apr_interval_time_t timeout;
         apr_size_t len;
         int n;
@@ -772,7 +772,7 @@ recv_again:
                 break;
 
             case AP_FCGI_END_REQUEST:
-                done = 1;
+                /* we are done below */
                 break;
 
             default:
@@ -780,8 +780,8 @@ recv_again:
                               "Got bogus record %d", type);
                 break;
             }
-            /* Leave on above switch's inner error. */
-            if (rv != APR_SUCCESS) {
+            /* Leave on above switch's inner end/error. */
+            if (rv != APR_SUCCESS || type == AP_FCGI_END_REQUEST) {
                 break;
             }