On Sun, Jun 1, 2014 at 7:33 PM, <[email protected]> wrote: > Author: niq > Date: Sun Jun 1 17:33:16 2014 > New Revision: 1599012 > > URL: http://svn.apache.org/r1599012 > Log: > mod_proxy_html: skip documents < 4 bytes > PR 56286 > Micha Lenk > > Modified: > httpd/httpd/trunk/CHANGES > httpd/httpd/trunk/modules/filters/mod_proxy_html.c [] > > Modified: httpd/httpd/trunk/modules/filters/mod_proxy_html.c > URL: > http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/filters/mod_proxy_html.c?rev=1599012&r1=1599011&r2=1599012&view=diff > ============================================================================== > --- httpd/httpd/trunk/modules/filters/mod_proxy_html.c (original) > +++ httpd/httpd/trunk/modules/filters/mod_proxy_html.c Sun Jun 1 17:33:16 > 2014 > @@ -889,6 +889,15 @@ static apr_status_t proxy_html_filter(ap > else if (apr_bucket_read(b, &buf, &bytes, APR_BLOCK_READ) > == APR_SUCCESS) { > if (ctxt->parser == NULL) { > + /* For documents smaller than four bytes, there is no reason > to do > + * HTML rewriting. The URL schema (i.e. 'http') needs four > bytes alone. > + * And the HTML parser needs at least four bytes to > initialise correctly. > + */ > + if ((bytes < 4) && APR_BUCKET_IS_EOS(APR_BUCKET_NEXT(b))) { > + ap_remove_output_filter(f) ; > + return ap_pass_brigade(f->next, bb) ; > + }
The next bucket doesn't necessarily exist nor is EOS, and we probably shouldn't fall through either in these cases. How about r1819969 (including for backport proposal, along with r1819970 possibly)?
