diff options
author | Jeff Trawick <trawick@apache.org> | 2010-11-07 12:35:32 +0000 |
---|---|---|
committer | Jeff Trawick <trawick@apache.org> | 2010-11-07 12:35:32 +0000 |
commit | 2c8ec34cd0d76d9d185259927a61ff7e1aeedf17 (patch) | |
tree | 9706cb85b31cb1a58afdb3a4f26d92dfe29edf2d /modules/proxy | |
parent | bed44770b579a023ae53fc23ae7927ba22b3d01a (diff) | |
download | httpd-2c8ec34cd0d76d9d185259927a61ff7e1aeedf17.tar.gz |
avoid duplicate end-of-stdin header
avoid passing {iov_base = &buffer, iov_len=0} to writev() when
there is no stdin data
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1032266 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'modules/proxy')
-rw-r--r-- | modules/proxy/mod_proxy_fcgi.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/modules/proxy/mod_proxy_fcgi.c b/modules/proxy/mod_proxy_fcgi.c index 2d06a3a370..a89bc85a4e 100644 --- a/modules/proxy/mod_proxy_fcgi.c +++ b/modules/proxy/mod_proxy_fcgi.c @@ -611,6 +611,7 @@ static apr_status_t dispatch(proxy_conn_rec *conn, request_rec *r, char writebuf[AP_IOBUFSIZE]; apr_size_t writebuflen; int last_stdin = 0; + int nvec = 0; rv = ap_get_brigade(r->input_filters, ib, AP_MODE_READBYTES, APR_BLOCK_READ, @@ -637,12 +638,16 @@ static apr_status_t dispatch(proxy_conn_rec *conn, request_rec *r, (apr_uint16_t) writebuflen, 0); fcgi_header_to_array(&header, farray); - vec[0].iov_base = farray; - vec[0].iov_len = sizeof(farray); - vec[1].iov_base = writebuf; - vec[1].iov_len = writebuflen; + vec[nvec].iov_base = farray; + vec[nvec].iov_len = sizeof(farray); + ++nvec; + if (writebuflen) { + vec[nvec].iov_base = writebuf; + vec[nvec].iov_len = writebuflen; + ++nvec; + } - rv = send_data(conn, vec, 2, &len, 0); + rv = send_data(conn, vec, nvec, &len, 0); if (rv != APR_SUCCESS) { break; } @@ -650,13 +655,15 @@ static apr_status_t dispatch(proxy_conn_rec *conn, request_rec *r, if (last_stdin) { pfd.reqevents = APR_POLLIN; /* Done with input data */ - fill_in_header(&header, FCGI_STDIN, request_id, 0, 0); - fcgi_header_to_array(&header, farray); + if (writebuflen) { /* empty FCGI_STDIN not already sent? */ + fill_in_header(&header, FCGI_STDIN, request_id, 0, 0); + fcgi_header_to_array(&header, farray); - vec[0].iov_base = farray; - vec[0].iov_len = sizeof(farray); + vec[0].iov_base = farray; + vec[0].iov_len = sizeof(farray); - rv = send_data(conn, vec, 1, &len, 1); + rv = send_data(conn, vec, 1, &len, 1); + } } } |