Restore host in unmapped URL logs - #13435
Open
bneradt wants to merge 1 commit into
Open
Conversation
Intercepted requests that skip remapping preserve an unmapped URL before the Host header is promoted. The valid but incomplete snapshot prevents logging from using its fallback and produces URLs such as http:///_stats. This promotes the request target into the unmapped URL when the snapshot is created, regardless of whether remapping will run. It also adds stats_over_http coverage for hostless cquuc output. Fixes: apache#11378
Comment on lines
+51
to
+60
| self.ts.Disk.logging_yaml.AddLines( | ||
| ''' | ||
| logging: | ||
| formats: | ||
| - name: unmapped_url | ||
| format: "%<cquuc>" | ||
| logs: | ||
| - filename: stats_over_http_url | ||
| format: unmapped_url | ||
| '''.split("\n")) |
Comment on lines
1026
to
+1028
| s->unmapped_url.create(s->hdr_info.client_request.url_get()->m_heap); | ||
| s->unmapped_url.copy(s->hdr_info.client_request.url_get()); | ||
| s->hdr_info.client_request.set_url_target_from_host_field(&s->unmapped_url); |
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.
Intercepted requests that skip remapping preserve an unmapped URL
before the Host header is promoted. The valid but incomplete snapshot
prevents logging from using its fallback and produces URLs such as
http:///_stats.
This promotes the request target into the unmapped URL when the
snapshot is created, regardless of whether remapping will run. It also
adds stats_over_http coverage for hostless cquuc output.
Fixes: #11378
Background
Before #10304,
unmapped_urlwas created inHttpSM::do_remap_request(), where the request Host value was alsopromoted into the saved URL. Server intercepts such as
stats_over_httpskip remapping, so theirunmapped_urlremainedinvalid. The
cquuclogger handled that state by falling back to thecurrent client URL, which included the host.
#10304 moved creation of
unmapped_urltoHttpTransact::StartRemapRequest()so requests that skip remappingwould still have a valid snapshot. This fixed a crash while marking
parent hosts down and was cherry-picked to 9.2.x for 9.2.3. However,
Host promotion stayed in
HttpSM::do_remap_request().That left intercepted requests with a valid but incomplete snapshot.
Because it was valid, logging no longer used the fallback; because
remapping was skipped, the host was never promoted, producing values
such as
http:///_stats. This change performs Host promotion when thesnapshot is created so both remapped and intercepted requests preserve
a complete pre-remap URL.