5183f0
--- a/modules/generators/cgi_common.h	2020/09/04 13:16:53	1881458
5183f0
+++ b/modules/generators/cgi_common.h	2020/09/04 13:56:25	1881459
5183f0
@@ -259,6 +259,13 @@
5183f0
         if ((ret = ap_scan_script_header_err_brigade_ex(r, bb, sbuf,
5183f0
                                                         APLOG_MODULE_INDEX)))
5183f0
         {
5183f0
+            /* In the case of a timeout reading script output, clear
5183f0
+             * the brigade to avoid a second attempt to read the
5183f0
+             * output. */
5183f0
+            if (ret == HTTP_GATEWAY_TIME_OUT) {
5183f0
+                apr_brigade_cleanup(bb);
5183f0
+            }
5183f0
+
5183f0
             ret = log_script(r, conf, ret, logdata, sbuf, bb, script_err);
5183f0
 
5183f0
             /*