Repository navigation
Set VIA server/proxy result for 206 and pass-through responses (no-cache path) - #13852
Open
shivampwm2020 wants to merge 1 commit into
Open
shivampwm2020 wants to merge 1 commit into
shivampwm2020 wants to merge 1 commit into
Conversation
handle_no_cache_operation_on_forward_server_response() only populated VIA_SERVER_RESULT and VIA_PROXY_RESULT in the 200 OK and 304 Not Modified branches. Responses that fall into the PARTIAL_CONTENT (206) or default branches were forwarded to the client without recording that the origin had served them, so the Via debug window looked the same as for a locally synthesized error (e.g. a DNS-failure 500). The cached path (handle_cache_operation_on_forward_server_response) already sets both fields for its default branch; make the no-cache path consistent. Fixes: apache#13118
shivampwm2020
force-pushed
the
fix/via-no-cache-result
branch
from
October 17, 2026 15:37
5e109c9 to
5cdc19d
Compare
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.
Problem
HttpTransact::handle_no_cache_operation_on_forward_server_response()only recordsVIA_SERVER_RESULT/VIA_PROXY_RESULTfor200 OKand304 Not Modified. Responsesthat reach the
HTTPStatus::PARTIAL_CONTENT(206) ordefaultbranches are passedthrough to the client without setting either slot, so at
proxy.config.http.insert_response_via_str = 2theViadebug window is identical for agenuine origin response and for a locally synthesized error:
Operators cannot distinguish "the origin answered 206" from "ATS synthesized a 500"
without bumping verbosity to 3.
Root cause
In the
switchon the server response status,HTTPStatus::OKandHTTPStatus::NOT_MODIFIEDcallSET_VIA_STRING(...), whileHTTPStatus::PARTIAL_CONTENTanddefaultdo not:The cached counterpart,
handle_cache_operation_on_forward_server_response(), doesset both fields in its
defaultbranch, so the no-cache path is simply inconsistent withthe cache path for the same class of response.
Fix
Set
VIA_SERVER_RESULT = VIA_SERVER_SERVEDandVIA_PROXY_RESULT = VIA_PROXY_SERVEDin the
PARTIAL_CONTENTanddefaultbranches, matching the existing 200/304 branches inthe same function and the cached path. After the change the debug window is
[cMsSf ]fora 206 or an origin 404, and is unchanged for a DNS-failure synthesized 500 (no server
connection was made, so the server slot correctly stays empty).
This is a 4-line change using markers that already appear verbatim in the same function;
via_string[]layout,VIA_*indices and theSET_VIA_STRINGmacro are untouched.Testing
src/proxy/http/HttpTransact.ccfor themasterbranch:
PARTIAL_CONTENTanddefaultset neither slot before the change.OKbranch(same function) and the cached path's
defaultbranch, so no new symbols or headersare introduced.
insert_via_header_in_response(): theinsert_response_via_string > 1window coversVIA_CACHE .. VIA_CACHE_FILL_ACTION,which includes
VIA_SERVER_RESULT.Fixes #13118
Note: the linked issue was filed against
9.2.x; the same branch is also affected onmaster. I opened this againstmasterperCONTRIBUTING.mdand am happy to prepare a9.2.xbackport if the fix is accepted.