Skip to content

Preserve wire Content-Encoding / Content-Length (align with HTTP Request / HTTPHC4Impl) #106

Description

@3dgiordano

Origin: #99 (comment)

Summary

When using the BlazeMeter HTTP sampler (Jetty client), compressed responses differ from what users see in the browser DevTools or in the standard JMeter HTTP Request sampler (Apache HttpClient4): Content-Encoding is missing and Content-Length reflects the decompressed body size instead of the on-the-wire values.

Steps to reproduce

  1. Send a request to an endpoint that returns Content-Encoding: gzip (or br, zstd) with a compressed JSON body.
  2. Compare response headers in:
    • Browser Network tab
    • JMeter HTTP Request (HttpClient4) + View Results Tree
    • BlazeMeter HTTP sampler + View Results Tree

Expected behavior

Aligned with HTTP Request / HTTPHC4Impl (see JMeter Bug 59401):

  • Response body in HTTPSampleResult is decompressed (suitable for assertions, JSON extractors, etc.).
  • Response headers in the sample result still show wire compression metadata when the server compressed the payload, e.g.:
    • Content-Encoding: gzip (HTTP/2 may use lowercase header names)
    • Content-Length matching the compressed size on the wire

Actual behavior

Jetty’s HTTP client transparently decompresses the response (documented behavior). After decoding:

  • Content-Encoding is removed (or not shown as in the browser).
  • Content-Length is updated to the decompressed size (e.g. 238 bytes instead of 643).

Example reported by users:

Source content-encoding content-length
Browser gzip 238 (compressed)
BlazeMeter HTTP (Jetty) (missing) 643 (decompressed)

Root cause

  • Jetty HttpClient ContentDecoder decompresses the body and updates/removes compression-related headers (same class of behavior as Apache ResponseContentEncoding).
  • JMeter’s HTTPHC4Impl works around this by backing up Content-Length, Content-Encoding, and Content-MD5 before decompression and restoring them when building the HTTPSampleResult.
  • The BlazeMeter HTTP plugin did not implement an equivalent restore step.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions