Skip to content

Conversation

@Long9725
Copy link

@Long9725 Long9725 commented Nov 1, 2025

Make compression pluggable and configurable (gzip level/buffer), retain API compatibility

Overview

  • Introduces configurable gzip compression (level, buffer size) and a pluggable output filter factory for HTTP/1.1. Preserves the original API to maintain backward compatibility.

Changes

  • CompressionConfig: add gzipLevel and gzipBufferSize with validation; add configurable noCompressionEncodings; extend useCompression to accept an encoding; restore the original useCompression(Request, Response) overload
    delegating to gzip.
  • AbstractHttp11Protocol: expose getters/setters for gzip settings; add OutputFilterFactory support (by instance and by class name with error handling); delegate compression checks using the factory’s encoding; expose get/
    setNoCompressionEncodings.
  • http11.filters: add OutputFilterFactory interface and default GzipOutputFilterFactory; update GzipOutputFilter to honor level and buffer size.
  • Http11Processor/HTTP2 StreamProcessor: construct gzip filter using protocol-provided level/buffer settings.
  • Tests: update existing tests and add coverage for gzip level/buffer, output filter factory, and no-compression encodings.
  • Docs/I18N: document gzipLevel, gzipBufferSize and noCompressionEncodings in webapps/docs/config/http.xml; add related LocalStrings messages.

Influence

  • Compatibility: no breaking changes; existing behavior remains default (gzip enabled per prior rules, default level -1, buffer 512).
  • Extensibility: allows custom compression filters and fine-tuned gzip settings; avoids double-compression via configurable encodings.
  • Risk: low; validated by added/updated unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant