You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by jo...@apache.org on 2019/10/04 09:24:07 UTC

svn commit: r1867970 - /httpd/httpd/trunk/modules/generators/cgi_common.h

Author: jorton
Date: Fri Oct  4 09:24:07 2019
New Revision: 1867970

URL: http://svn.apache.org/viewvc?rev=1867970&view=rev
Log:
* modules/generators/cgi_common.h (discard_script_output): Simplify
  slightly and ensure constant rather than unlimited memory
  consumption when discarding CGI script output (for e.g. a redirect
  response).

Modified:
    httpd/httpd/trunk/modules/generators/cgi_common.h

Modified: httpd/httpd/trunk/modules/generators/cgi_common.h
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/generators/cgi_common.h?rev=1867970&r1=1867969&r2=1867970&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/generators/cgi_common.h (original)
+++ httpd/httpd/trunk/modules/generators/cgi_common.h Fri Oct  4 09:24:07 2019
@@ -32,19 +32,15 @@ static void discard_script_output(apr_bu
     apr_bucket *e;
     const char *buf;
     apr_size_t len;
-    apr_status_t rv;
 
     for (e = APR_BRIGADE_FIRST(bb);
-         e != APR_BRIGADE_SENTINEL(bb);
-         e = APR_BUCKET_NEXT(e))
+         e != APR_BRIGADE_SENTINEL(bb) && !APR_BUCKET_IS_EOS(e);
+         e = APR_BRIGADE_FIRST(bb))
     {
-        if (APR_BUCKET_IS_EOS(e)) {
-            break;
-        }
-        rv = apr_bucket_read(e, &buf, &len, APR_BLOCK_READ);
-        if (rv != APR_SUCCESS) {
+        if (apr_bucket_read(e, &buf, &len, APR_BLOCK_READ)) {
             break;
         }
+        apr_bucket_delete(e);
     }
 }