Skip to content

fix: remove stale HTTP/2 body guard#13428

Merged
nic-6443 merged 1 commit into
apache:masterfrom
nic-6443:drop-stale-http2-body-guard
May 26, 2026
Merged

fix: remove stale HTTP/2 body guard#13428
nic-6443 merged 1 commit into
apache:masterfrom
nic-6443:drop-stale-http2-body-guard

Conversation

@nic-6443

@nic-6443 nic-6443 commented May 25, 2026

Copy link
Copy Markdown
Member

Description

core.request.get_body() still rejects HTTP/2 and HTTP/3 requests without a Content-Length header, but that guard was added for an older lua-nginx-module behavior that has since been reverted upstream.

Current lua-nginx-module no longer rejects ngx.req.read_body() for HTTP/2 or HTTP/3 requests without Content-Length, so APISIX should not reject those requests at its own request helper layer. This also matches the discussion in #11362, where the reported behavior was already stale for newer OpenResty releases.

This removes the stale guard and drops the test-only Content-Length: 0 headers that were added for it.

Which issue(s) this PR fixes:

Fixes #11362

Checklist

  • I have explained the need for this PR and the problem it solves
  • I have explained the changes or the new features added to this PR
  • I have added tests corresponding to this change
  • I have updated the documentation to reflect this change (not needed; this removes an internal stale guard and there is no documented config/API change)
  • I have verified that this change is backward compatible (If not, please discuss on the APISIX mailing list first)

Fixes #13237

Copilot AI review requested due to automatic review settings May 25, 2026 06:45
@dosubot dosubot Bot added size:S This PR changes 10-29 lines, ignoring generated files. bug Something isn't working labels May 25, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Removes an APISIX-side HTTP/2/HTTP/3 Content-Length precondition in core.request.get_body() that was originally added as a workaround for older lua-nginx-module behavior, aligning APISIX with current OpenResty behavior where ngx.req.read_body() works without Content-Length for HTTP/2/3.

Changes:

  • Removed the HTTP/2/HTTP/3 “missing Content-Length” guard from apisix/core/request.lua.
  • Updated the azure-functions plugin tests to stop injecting Content-Length: 0 for HTTP/2 requests and removed the now-stale negative test that expected a 400 error.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
t/plugin/azure-functions.t Drops test-only Content-Length: 0 headers for HTTP/2 and removes the test that asserted the old guard behavior.
apisix/core/request.lua Removes the stale HTTP/2/HTTP/3 missing Content-Length rejection from get_body().

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nic-6443
nic-6443 merged commit 8048e74 into apache:master May 26, 2026
19 checks passed
@nic-6443
nic-6443 deleted the drop-stale-http2-body-guard branch May 26, 2026 01:21
wistefan pushed a commit to wistefan/apisix that referenced this pull request Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

5 participants