lacklacklack opened a new pull request, #6122:
URL: https://github.com/apache/couchdb/pull/6122

   ## Overview
   
   This PR adds optional gzip compression support for HTTP responses in 
CouchDB. When enabled, CouchDB will compress one-shot (non-chunked) HTTP 
responses using gzip if the client indicates support via the `Accept-Encoding: 
gzip` request header.
   
   The feature is disabled by default and can be enabled via a new 
`response_compression` configuration option in the `[chttpd]` section. 
Chunked/streaming responses (e.g. `_changes`, streaming views) are 
intentionally not affected by this setting and are deferred to a follow-up PR.
   
   ## Testing recommendations
   
   The change includes a new eunit test module 
(`chttpd_response_compression_test`) that covers three scenarios:
   
   1. **Default behaviour**: Compression is off by default — responses should 
not be gzip-encoded even when the client sends `Accept-Encoding: gzip`.
   2. **Compression enabled and accepted**: When `response_compression = true` 
and the client sends `Accept-Encoding: gzip`, the response body should be 
gzip-encoded and the `Content-Encoding: gzip` header should be present. The 
test also verifies the body is valid gzip by decompressing it with 
`zlib:gunzip/1`.
   3. **Compression enabled but not accepted**: When `response_compression = 
true` but the client does not send `Accept-Encoding: gzip`, the response should 
remain uncompressed.
   
   To manually test:
   - Enable the option by setting `response_compression = true` in `[chttpd]`
   - Make a request with `Accept-Encoding: gzip` (e.g. `curl -H 
"Accept-Encoding: gzip" http://localhost:5984/ --compressed`) and verify the 
response is compressed
   - Make a request without that header and verify the response is not 
compressed
   - Verify chunked endpoints like `_changes` are unaffected
   
   ## Related Issues or Pull Requests
   
   
   
   ## Checklist
   
   - [x] This is my own work, I did not use AI, LLM's or similar technology
   - [x] Code is written and works correctly
   - [x] Changes are covered by tests
   - [x] Any new configurable parameters are documented in 
`rel/overlay/etc/default.ini`
   - [x] Documentation changes were made in the `src/docs` folder
   - [ ] Documentation changes were backported (separated PR) to affected 
branches


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to