Skip to content

fix: complete HTTP responses ending with trailers - #75

Merged
hjianbo merged 3 commits into
emqx:mainfrom
hjianbo:fix/response-trailers
Oct 22, 2026
Merged

hjianbo merged 3 commits into
emqx:mainfrom
hjianbo:fix/response-trailers

Conversation

@hjianbo

@hjianbo hjianbo commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Complete HTTP responses that end with trailers. Gun emits gun_trailers instead of a final gun_data message; treating it as end-of-stream lets the existing response path return the initial headers and accumulated body and release the request slot. Trailer fields are not merged into the response headers, and the request API stays unchanged.

Regression tests use a real HTTP server to cover empty and nonempty bodies, connection reuse, pipelined requests, late trailers after timeout, and cancellation without a subsequent callback. The three lifecycle cases use a server-side gate to control when trailers are sent. All five new regression cases fail with 0.7.8 and pass with the fix.

Set the application version to 0.7.9 and align the changelog. The previous metadata still declared 0.7.7, causing the version check to fail against the 0.7.8 tag on OTP 25–28.

CI follow-up: pin Ubuntu 24.04 so OTP 25 remains installable after the ubuntu-latest migration. Move test listeners above the default ephemeral port range, and report listener bind failures immediately instead of waiting for a startup timeout.

Validation: native rebar3 passes all 105 non-external tests on OTP 28.4.1-7, including the application metadata checks. Formatting, xref, and Dialyzer pass. The 14 Google/proxy-dependent tests were not all successful in this environment; CI covers the full suite on OTP 25–28. Additional EMQX integration checks cover fragmented and truncated trailers, connection closure, HTTP/2, OAuth2 refresh, and resource-manager recovery.

Treat response trailers as the end of a stream so synchronous and asynchronous requests complete and pooled connections remain reusable.
Exercise pipelined, expired, and cancelled requests against a controlled HTTP server.
Align the application version and changelog with the next patch release.
Keep OTP 25 available after the ubuntu-latest image migration. Move test listeners outside
the default ephemeral port range and report bind failures without a startup timeout.
Comment thread .github/workflows/erlang.yml Resolved
Comment thread test/ehttpc_pool_tests.erl Resolved
@hjianbo
hjianbo marked this pull request as ready for review October 22, 2026 06:12
@hjianbo
hjianbo merged commit f21f132 into emqx:main Oct 22, 2026
4 checks passed
@hjianbo
hjianbo deleted the fix/response-trailers branch October 22, 2026 11:00
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.

2 participants