You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by tr...@apache.org on 2014/04/30 22:21:03 UTC

svn commit: r1591472 - /httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c

Author: trawick
Date: Wed Apr 30 20:21:03 2014
New Revision: 1591472

URL: http://svn.apache.org/r1591472
Log:
Axe unnecessary memset() calls and allocating an extra
byte in an I/O buffer for '\0', which hasn't been needed
since a strstr("\r\n\r\n") was removed in r371428.

Modified:
    httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c

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=1591472&r1=1591471&r2=1591472&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Wed Apr 30 20:21:03 2014
@@ -485,19 +485,13 @@ static apr_status_t dispatch(proxy_conn_
         }
 
         if (pfd.rtnevents & APR_POLLIN) {
-            /* readbuf has one byte on the end that is always 0, so it's
-             * able to work with a strstr when we search for the end of
-             * the headers, even if we fill the entire length in the recv. */
-            char readbuf[AP_IOBUFSIZE + 1];
+            char readbuf[AP_IOBUFSIZE];
             apr_size_t readbuflen;
             apr_uint16_t clen, rid;
             apr_bucket *b;
             unsigned char plen;
             unsigned char type, version;
 
-            memset(readbuf, 0, sizeof(readbuf));
-            memset(farray, 0, sizeof(farray));
-
             /* First, we grab the header... */
             rv = get_data_full(conn, (char *) farray, AP_FCGI_HEADER_LEN);
             if (rv != APR_SUCCESS) {
@@ -530,8 +524,8 @@ static apr_status_t dispatch(proxy_conn_
             }
 
 recv_again:
-            if (clen > sizeof(readbuf) - 1) {
-                readbuflen = sizeof(readbuf) - 1;
+            if (clen > sizeof(readbuf)) {
+                readbuflen = sizeof(readbuf);
             } else {
                 readbuflen = clen;
             }
@@ -544,7 +538,6 @@ recv_again:
                 if (rv != APR_SUCCESS) {
                     break;
                 }
-                readbuf[readbuflen] = 0;
             }
 
             switch (type) {