Skip to content

Restore HTTP::Message 7.04 compatibility #1117

Closed

Description

@fglock

Summary

Restore complete HTTP::Message/HTTP::Request compatibility. HTTP::Request is provided by the pure-Perl HTTP-Message distribution; version 7.04 currently fails under PerlOnJava even though the same upstream suite passes under system Perl.

The archived CPAN random-tester run is 20260825-135237-11904, target HTTP::Request.

Results

System Perl, using the exact HTTP-Message 7.04 source:

All tests successful.
Files=23, Tests=871
Result: PASS

PerlOnJava 5.44.1:

Files=23, Tests=745
Result: FAIL
Failed 5/23 test programs. 9/745 executed subtests failed.

Two test programs abort early, so the executed-subtest count understates the impact. The failing files are:

  • t/common-req.t
  • t/message-charset.t
  • t/message-decode-bzipbomb.t
  • t/message-decode-zipbomb.t
  • t/message.t

The report previously recorded 502/678 passing assertions in May; the current 736/745 executed assertions are substantial progress, but the distribution has not regained the complete PASS recorded by the March smoke-test investigation for HTTP-Message 7.01.

Confirmed root defect: utf8::downgrade destroys references

HTTP::Message deliberately calls utf8::downgrade on content values, including references. Standard Perl preserves the value and reference type:

my $value = sub { 42 };
print ref($value), '|', utf8::downgrade($value, 1), '|', ref($value), '|', $value->(), "\n";

Expected/system Perl:

CODE|1|CODE|42

Both PerlOnJava backends currently produce:

CODE|1|

The implementation converts the scalar to a string and writes that string back with byte-string type, losing the reference. This directly explains:

  • t/common-req.t: dynamic upload content is expected to remain a CODE reference, then aborts while invoking the corrupted value.
  • t/message.t: reference content/content_ref behavior aborts with Setting content_ref to a non-ref.

Additional failure clusters

  1. Charset and tied-variable semantics

    • content_charset leaves $_ alone reports two unexpected stores.
    • UTF-8 fallback decoding returns undef where system Perl returns the expected byte/character values.
  2. Compressed-body size limits and multilayer decoding

    • bzip2 decoding does not raise the expected size-limit error.
    • triple-gzip decoding returns undef instead of the 16 MiB decoded body.
    • likely areas include the Java Compress::Raw::Zlib and Compress::Raw::Bzip2 implementations, especially LimitOutput, buffer sizing, and status values such as Z_BUF_ERROR/BZ_OUTBUFF_FULL.

These should be reduced independently after the reference-preservation defect is fixed, since the early aborts currently hide later assertions.

Impact

HTTP::Message is foundational for LWP and the HTTP stacks used by Catalyst, Dancer2, Plack-related tooling, CPAN clients, and many other distributions. The cached bulk dependency data contains at least 86 unique direct runtime dependants of HTTP::Request, including 23 recent dependants; this is a lower bound rather than an exhaustive targeted result.

The distribution is pure Perl. The work should consist of reusable runtime/backend fixes, not a CPAN source patch.

Acceptance criteria

  • Add a standard-Perl-validated regression test proving utf8::downgrade($reference, 1) preserves CODE, ARRAY, HASH, SCALAR, and object references.
  • Make that regression pass on both JVM and interpreter backends.
  • Add focused regressions for any confirmed tied-$_, Encode, zlib, and bzip2 runtime defects.
  • Run the unchanged HTTP-Message 7.04 suite successfully: 23 files and 871 tests, apart from optional Brotli tests when the recommended modules are unavailable.
  • Verify the LWP and Catalyst acceptance paths remain green.
  • Update the stale HTTP::Message PASS statements in the smoke-test/support documentation and refresh the CPAN compatibility classification.

Activity

  1. fglock commented on Sep 18, 2026

    @fglock
    OwnerAuthor

    Fresh verification from CPAN random-tester run 20260916-111623-23683:

    • HTTP::Message 7.04 passes unchanged under system Perl: 23 files, 884 tests.
    • PerlOnJava JVM backend fails 3 of 871 tests:
      • t/message-charset.t: content_charset leaves $_ alone records two unexpected stores on tied $_.
      • t/message-decode-bzipbomb.t: both configured 512 KiB maximum-body-size checks fail to raise an error.
    • The interpreter backend reproduces the same three failures.

    Impact: charset detection can mutate caller-visible tied state, and compressed response decoding can exceed the configured body limit. The latter weakens decompression-bomb protection. HTTP::Message is foundational to LWP and other Perl HTTP stacks; the existing issue records at least 86 direct runtime dependants of HTTP::Request, including 23 recent dependants.

    The separate compression-provider work in #1261 and #1278 may be relevant to the bzip2 cluster, but this run confirms that HTTP::Message compatibility remains incomplete.

  2. fglock commented on Sep 18, 2026

    @fglock
    OwnerAuthor

    Reopening: the follow-up verification shows the issue is not fully resolved. HTTP::Message 7.04 still fails the tied-$_ charset test and both bzip2 maximum-body-size checks on JVM and interpreter backends, while system Perl passes the full suite.

  3. reopened this on Sep 18, 2026
  4. fglock commented on Oct 5, 2026

    @fglock
    OwnerAuthor

    Retest update for PR #1641: HTTP::Message 7.04 passes on JVM and interpreter (23 files / 871 tests each) and system Perl (23 / 884 with optional tests enabled). LWP 6.83 passes on all three (23 / 330 each); the reference-preservation regression passes on all three too.

    The issue remains open because the Catalyst HTTP exception path fails on PerlOnJava: MockHTTP dereferences an undefined response from HTTP::Response->from_psgi, while the two affected Catalyst files pass on system Perl (29 tests). The stale HTTP::Message CPAN classification and support documentation also remain. Follow-ups: #1652 for Catalyst response conversion and #1651 for report/docs refresh.

  5. fglock commented on Oct 23, 2026

    @fglock
    OwnerAuthor

    Resolved by merged PR #1872 together with the prior HTTP::Message follow-ups. HTTP-Message 7.04 passes 23 files / 871 tests on both PerlOnJava backends and 884 tests on system Perl; LWP 6.83 passes 23 / 330 on both backends. The five-type utf8::downgrade reference regression and bzip2 output-limit regression pass on system Perl and both backends. The full Catalyst::Runtime suite now passes 200 files / 3,820 tests, resolving #1652. The report and support-note refresh was completed under #1651. Closing as completed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:cpan-portCPAN compatibility ports and providersbugSomething isn't working

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions