1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

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.


git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1591472 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jeff Trawick
2014-04-30 20:21:03 +00:00
parent 54f9353df0
commit cc065dba44

View File

@@ -485,19 +485,13 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
} }
if (pfd.rtnevents & APR_POLLIN) { if (pfd.rtnevents & APR_POLLIN) {
/* readbuf has one byte on the end that is always 0, so it's char readbuf[AP_IOBUFSIZE];
* 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];
apr_size_t readbuflen; apr_size_t readbuflen;
apr_uint16_t clen, rid; apr_uint16_t clen, rid;
apr_bucket *b; apr_bucket *b;
unsigned char plen; unsigned char plen;
unsigned char type, version; unsigned char type, version;
memset(readbuf, 0, sizeof(readbuf));
memset(farray, 0, sizeof(farray));
/* First, we grab the header... */ /* First, we grab the header... */
rv = get_data_full(conn, (char *) farray, AP_FCGI_HEADER_LEN); rv = get_data_full(conn, (char *) farray, AP_FCGI_HEADER_LEN);
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
@@ -530,8 +524,8 @@ static apr_status_t dispatch(proxy_conn_rec *conn, proxy_dir_conf *conf,
} }
recv_again: recv_again:
if (clen > sizeof(readbuf) - 1) { if (clen > sizeof(readbuf)) {
readbuflen = sizeof(readbuf) - 1; readbuflen = sizeof(readbuf);
} else { } else {
readbuflen = clen; readbuflen = clen;
} }
@@ -544,7 +538,6 @@ recv_again:
if (rv != APR_SUCCESS) { if (rv != APR_SUCCESS) {
break; break;
} }
readbuf[readbuflen] = 0;
} }
switch (type) { switch (type) {