MantisBT: master 28acc0fe

Author Committer Branch Timestamp Parent
123 community master 2026-11-21 09:53 master 6c51098a
Affected Issues  0037393: plugin_file.php sends a gzip body with 304 Not Modified, which strict HTTP servers (Caddy) reject
Changeset

Send 304 from plugin_file.php without a gzip body

plugin_file_include() answers a matching If-Modified-Since with 304 Not
Modified and no output, but compress_handler_is_enabled() has already
turned on zlib.output_compression, and PHP's zlib output handler emits
a gzip stream even for an empty buffer. The response therefore carries
Content-Encoding: gzip and a 20-byte body, which RFC 9110 forbids for

  1. Apache and nginx silently drop the body, but strict servers such
    as Caddy abort the response ("response status code does not allow
    body"), so every plugin asset fails with ERR_HTTP2_PROTOCOL_ERROR once
    the browser starts revalidating its cache.

compress_disable() only cleared $g_compression_started, which has no
effect on the zlib.output_compression path. Make it switch that off as
well while the headers are still unsent, and call it before sending
the 304. Turning zlib.output_compression off at runtime keeps output
buffered so far and flushes it uncompressed, so the existing caller in
error_api.php is not affected.

Fixes 0037393, PR https://github.com/mantisbt/mantisbt/pull/2284

mod - core/compress_api.php Diff File
mod - core/plugin_api.php Diff File