From 1154b48e71a59f9eb11e6b434bac2805d87f5b03 Mon Sep 17 00:00:00 2001 From: Goend Date: Fri, 17 Apr 2026 14:22:04 +0800 Subject: [PATCH] fix(ext-plugin-post-resp): avoid H2/H3 Content-Length check when reading request body --- apisix/core/request.lua | 9 --------- t/plugin/azure-functions.t | 7 +++---- 2 files changed, 3 insertions(+), 13 deletions(-) diff --git a/apisix/core/request.lua b/apisix/core/request.lua index 3db323d482ff..8545660966f9 100644 --- a/apisix/core/request.lua +++ b/apisix/core/request.lua @@ -290,15 +290,6 @@ function _M.get_body(max_size, ctx) end end - -- check content-length header for http2/http3 - do - local var = ctx and ctx.var or ngx.var - local content_length = tonumber(var.http_content_length) - if (var.server_protocol == "HTTP/2.0" or var.server_protocol == "HTTP/3.0") - and not content_length then - return nil, "HTTP2/HTTP3 request without a Content-Length header" - end - end req_read_body() local req_body = req_get_body_data() diff --git a/t/plugin/azure-functions.t b/t/plugin/azure-functions.t index 72f9bbc6b2f7..dcea68bf5552 100644 --- a/t/plugin/azure-functions.t +++ b/t/plugin/azure-functions.t @@ -501,10 +501,9 @@ passed -=== TEST 15: http2 failed to check response body and headers +=== TEST 15: http2 success to without Content-Length --- http2 --- request GET /azure ---- error_code: 400 ---- error_log -HTTP2/HTTP3 request without a Content-Length header, +--- response_body +faas invoked