diff -rupN mod_fcgid-2.3.6.orig/modules/fcgid/fcgid_proc_unix.c mod_fcgid-2.3.6/modules/fcgid/fcgid_proc_unix.c --- mod_fcgid-2.3.6.orig/modules/fcgid/fcgid_proc_unix.c 2011-08-31 11:29:17.000000000 +0100 +++ mod_fcgid-2.3.6/modules/fcgid/fcgid_proc_unix.c 2011-08-31 15:08:09.000000000 +0100 @@ -771,10 +771,9 @@ apr_status_t proc_write_ipc(fcgid_ipc *i struct iovec vec[FCGID_VEC_COUNT]; int nvec = 0; apr_bucket *e; + apr_bucket_brigade* tmpbb = apr_brigade_create(output_brigade->p,output_brigade->bucket_alloc); - for (e = APR_BRIGADE_FIRST(output_brigade); - e != APR_BRIGADE_SENTINEL(output_brigade); - e = APR_BUCKET_NEXT(e)) { + while ((e = APR_BRIGADE_FIRST(output_brigade)) != APR_BRIGADE_SENTINEL(output_brigade)) { /* Read bucket */ apr_size_t len; const char* base; @@ -784,6 +783,8 @@ apr_status_t proc_write_ipc(fcgid_ipc *i "mod_fcgid: can't read request from bucket"); return rv; } + APR_BUCKET_REMOVE(e); + APR_BRIGADE_INSERT_TAIL(tmpbb, e); vec[nvec].iov_len = len; vec[nvec].iov_base = (char*) base; @@ -794,6 +795,7 @@ apr_status_t proc_write_ipc(fcgid_ipc *i FCGID_VEC_COUNT)) != APR_SUCCESS) return rv; nvec = 0; + apr_brigade_cleanup(tmpbb); } else nvec++; @@ -804,6 +806,7 @@ apr_status_t proc_write_ipc(fcgid_ipc *i if ((rv = writev_it_all(ipc_handle, vec, nvec)) != APR_SUCCESS) return rv; } + apr_brigade_destroy(tmpbb); return APR_SUCCESS; }