iis: drop chunked Transfer-Encoding when Content-Length is set - #3618
iis: drop chunked Transfer-Encoding when Content-Length is set#3618A13501350 wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
WriteBodyCallback copies the request Transfer-Encoding header verbatim and then sets Content-Length, so the forwarded request could contain both Transfer-Encoding: chunked and Content-Length, which is malformed and rejected by some backends. Delete the Transfer-Encoding header when it is chunked right before setting Content-Length, so only one framing header remains. Adapted from microsoft/ModSecurity waf_iis.
631e49b to
18c40c7
Compare
|



Summary
In
iis/mymodule.cpp,WriteBodyCallbackcopies the inbound request headers verbatim (includingTransfer-Encoding) and then setsContent-Lengthon the request. The result can be a request that carries bothTransfer-Encoding: chunkedandContent-Length, which is malformed and is rejected by some backends / causes ambiguous framing.Change
Right before setting
Content-Length, if the request'sTransfer-Encodingheader ischunked, delete it viapHttpRequest->DeleteHeader(...). Only one framing header is left on the forwarded request.Provenance
Adapted from
microsoft/ModSecuritybranchwaf_iis. Verified still missing on currentv2/mastertip (0875b19, v2.9.14).