Fix compile of ngx_brotli for newer nginx version (with new MSVC) - #179
Open
sebres wants to merge 3 commits into
Open
Fix compile of ngx_brotli for newer nginx version (with new MSVC)#179sebres wants to merge 3 commits into
sebres wants to merge 3 commits into
Conversation
mreiden
added a commit
to mreiden/ngx_brotli
that referenced
this pull request
Aug 27, 2026
Port of the sibling nginx-zstd-module's google#179 to the brotli static module, which carried the identical pattern: it allocated the body ngx_buf_t and its ngx_file_t and filled every field before calling ngx_http_send_header() and returning on req->header_only. For a HEAD there is no body, so those two pool allocations and the field setup are pure waste. Return right after send_header() when req->method == NGX_HTTP_HEAD, before the allocations. Strict method equality, not req->header_only (which also covers 304/204 — those keep the existing header_only return past the body setup). Placed after Content-Encoding and the Vary line are set, so a HEAD advertises exactly what its GET would. Test: 00-brotli TEST 19 — a HEAD to a served .br sidecar carries the same Content-Encoding, Vary: Accept-Encoding, and Accept-Ranges: bytes as the GET, with no body.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes compilation of ngx_brotli for newer nginx version (with new MSVC):
NGX_MSVC_VER was removed in nginx/nginx/commit/99312be10c0edd554a40df03591ed2d905f8bd10
ngx_config.hfor precompiled header instead of-Y-:modern MSVC compilers (Visual Studio 2022 and newer) no longer recognize or support the legacy -Y- syntax
(amend to eb2f8a0).
(amend to 63ca02a)