httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r1032266 - /httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c
Date Sun, 07 Nov 2010 12:35:32 GMT
Author: trawick
Date: Sun Nov  7 12:35:32 2010
New Revision: 1032266

URL: http://svn.apache.org/viewvc?rev=1032266&view=rev
Log:
avoid duplicate end-of-stdin header

avoid passing {iov_base = &buffer, iov_len=0} to writev() when
there is no stdin data

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=1032266&r1=1032265&r2=1032266&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy_fcgi.c Sun Nov  7 12:35:32 2010
@@ -611,6 +611,7 @@ static apr_status_t dispatch(proxy_conn_
             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_
                            (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_
             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);
+                }
             }
         }
 



Mime
View raw message