Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions iis/mymodule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,17 @@
// not possible
}

// Remove the Transfer-Encoding header if "chunked" is set in the request.
// ModSecurity always sends Content-Length, so leaving chunked would produce a
// request with both headers, which is malformed.
USHORT teLen = 0;
PCSTR te = pHttpRequest->GetHeader(HttpHeaderTransferEncoding, &teLen);
if (te != NULL && teLen != 0 &&

Check failure on line 1155 in iis/mymodule.cpp

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the "nullptr" literal.

See more on https://sonarcloud.io/project/issues?id=owasp-modsecurity_ModSecurity&issues=AaAqfr7vcCaJYOg3R594&open=AaAqfr7vcCaJYOg3R594&pullRequest=3618
0 == stricmp(ZeroTerminate(te, teLen, r->pool), "chunked"))
{
pHttpRequest->DeleteHeader(HttpHeaderTransferEncoding);
}

hr = pHttpRequest->SetHeader(
HttpHeaderContentLength,
szLength,
Expand Down
Loading