httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r1525280 - in /httpd/httpd/trunk: CHANGES docs/log-message-tags/next-number modules/proxy/mod_proxy_fcgi.c
Date Sat, 21 Sep 2013 18:48:21 GMT
Author: trawick
Date: Sat Sep 21 18:48:20 2013
New Revision: 1525280

URL: http://svn.apache.org/r1525280
Log:
Borrow a fix from mod_authnz_fcgi:

mod_proxy_fcgi: Handle reading protocol data that is split between
packets.

Modified:
    httpd/httpd/trunk/CHANGES
    httpd/httpd/trunk/docs/log-message-tags/next-number
    httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c

Modified: httpd/httpd/trunk/CHANGES
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/CHANGES?rev=1525280&r1=1525279&r2=1525280&view=diff
==============================================================================
--- httpd/httpd/trunk/CHANGES [utf-8] (original)
+++ httpd/httpd/trunk/CHANGES [utf-8] Sat Sep 21 18:48:20 2013
@@ -1,6 +1,9 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache 2.5.0
 
+  *) mod_proxy_fcgi: Handle reading protocol data that is split between
+     packets.  [Jeff Trawick]
+
   *) mod_proxy_fcgi: Remove 64K limit on encoded length of all envvars.
      An individual envvar with an encoded length of more than 16K will be
      omitted.  [Jeff Trawick]

Modified: httpd/httpd/trunk/docs/log-message-tags/next-number
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/log-message-tags/next-number?rev=1525280&r1=1525279&r2=1525280&view=diff
==============================================================================
--- httpd/httpd/trunk/docs/log-message-tags/next-number (original)
+++ httpd/httpd/trunk/docs/log-message-tags/next-number Sat Sep 21 18:48:20 2013
@@ -1 +1 @@
-2537
+2538

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c?rev=1525280&r1=1525279&r2=1525280&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Sat Sep 21 18:48:20 2013
@@ -160,6 +160,26 @@ static apr_status_t get_data(proxy_conn_
     return rv;
 }
 
+static apr_status_t get_data_full(proxy_conn_rec *conn,
+                                  char *buffer,
+                                  apr_size_t buflen)
+{
+    apr_size_t readlen;
+    apr_size_t cumulative_len = 0;
+    apr_status_t rv;
+
+    do {
+        readlen = buflen - cumulative_len;
+        rv = get_data(conn, buffer + cumulative_len, &readlen);
+        if (rv != APR_SUCCESS) {
+            return rv;
+        }
+        cumulative_len += readlen;
+    } while (cumulative_len < buflen);
+
+    return APR_SUCCESS;
+}
+
 static apr_status_t send_begin_request(proxy_conn_rec *conn,
                                        apr_uint16_t request_id)
 {
@@ -534,24 +554,15 @@ static apr_status_t dispatch(proxy_conn_
             memset(farray, 0, sizeof(farray));
 
             /* First, we grab the header... */
-            readbuflen = AP_FCGI_HEADER_LEN;
-
-            rv = get_data(conn, (char *) farray, &readbuflen);
+            rv = get_data_full(conn, (char *) farray, AP_FCGI_HEADER_LEN);
             if (rv != APR_SUCCESS) {
-                break;
-            }
-
-            dump_header_to_log(r, farray, readbuflen);
-
-            if (readbuflen != AP_FCGI_HEADER_LEN) {
                 ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01067)
-                              "Failed to read entire header "
-                              "got %" APR_SIZE_T_FMT " wanted %d",
-                              readbuflen, AP_FCGI_HEADER_LEN);
-                rv = APR_EINVAL;
+                              "Failed to read FastCGI header");
                 break;
             }
 
+            dump_header_to_log(r, farray, AP_FCGI_HEADER_LEN);
+
             ap_fcgi_header_fields_from_array(&version, &type, &rid,
                                              &clen, &plen, farray);
 
@@ -713,10 +724,10 @@ recv_again:
             }
 
             if (plen) {
-                readbuflen = plen;
-
-                rv = get_data(conn, readbuf, &readbuflen);
+                rv = get_data_full(conn, readbuf, plen);
                 if (rv != APR_SUCCESS) {
+                    ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+                                  APLOGNO(02537) "Error occurred reading padding");
                     break;
                 }
             }



Mime
View raw message