Skip to content

[4.18.x] CAMEL-23936: Fix logHttpActivity losing Content-Encoding on gzip responses#24507

Merged
davsclaus merged 1 commit into
camel-4.18.xfrom
fix/CAMEL-23936-4.18
Jul 8, 2026
Merged

[4.18.x] CAMEL-23936: Fix logHttpActivity losing Content-Encoding on gzip responses#24507
davsclaus merged 1 commit into
camel-4.18.xfrom
fix/CAMEL-23936-4.18

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Summary

Claude Code on behalf of davsclaus

Backport of #24506 to camel-4.18.x.

When logHttpActivity is enabled and the HTTP server returns a gzip-encoded response, the response body is not decompressed, causing downstream processing (e.g., Jackson JSON parsing) to fail with JsonParseException: Illegal character (CTRL-CHAR, code 31).

Fix: Pass the original content encoding to the ByteArrayEntity constructor when replacing the consumed response entity in LoggingHttpActivityListener.

Note: On 4.18.x the ce variable is a Header (not String as on main), so the fix extracts ce.getValue().

Test plan

  • New HttpLoggingActivityGzipTest — verifies gzip-encoded responses are correctly decompressed when logHttpActivity is enabled
  • All existing camel-http tests pass

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

…onses

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Claus Ibsen <claus.ibsen@gmail.com>

@oscerd oscerd left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Backport LGTM. The fix is faithfully carried to camel-4.18.x: since ce is a Header on this branch (vs a String on main), the adaptation new ByteArrayEntity(arr, ct, ce != null ? ce.getValue() : null) yields the same effective content-encoding. CI is green.

One minor, non-blocking note: this cherry-picks only the first commit of #24506, so it carries the self-contained version of the test rather than main's second-commit refactor that extends HttpCompressionTest. That is fine (self-contained tests are an accepted pattern here) — just flagging in case you want parity.

Reviewed with Claude Code on behalf of Andrea Cosentino. This review was generated by an AI agent and may contain inaccuracies; please verify all suggestions before applying.

@apupier apupier changed the title CAMEL-23936: Fix logHttpActivity losing Content-Encoding on gzip responses [4.18.x] CAMEL-23936: Fix logHttpActivity losing Content-Encoding on gzip responses Jul 8, 2026
@davsclaus davsclaus added this to the 4.18.4 milestone Jul 8, 2026
@davsclaus davsclaus added the bug Something isn't working label Jul 8, 2026
@davsclaus davsclaus self-assigned this Jul 8, 2026
@davsclaus davsclaus merged commit eaf51a8 into camel-4.18.x Jul 8, 2026
3 checks passed
@davsclaus davsclaus deleted the fix/CAMEL-23936-4.18 branch July 8, 2026 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants