fix(DnsPinMiddleware): Don't log misleading port value / log request port instead #50583
+5
−4
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.
Summary
#43650 added logging of the host that triggers the
LocalServerException
. It also added theport
to that log output.However the logged port is misleading and logging it does not make sense in this context because... it's not the actual port specified in the request.
The
port
here is merely the one that happens to be the current one in theforeach
iterator when the IP in question triggersisLocalAddress($ip)
to be true. (We check a list of ports that is essentially {requestPort + 80 + 443}. Ultimately that'll be80
every time which, again, has nothing to do with the current request.So either don't log any port or, since we do have the request port, go ahead and log it for the admin since it's more relevant.
P.S. Hmm. Actually upon reflection I think we can probably just move the entire
foreach ($ports as $port) {
below theisLocalAddress()
check too. The ports list is only used for properly populating theCURLOPT_RESOLVE
. The ports themselves are not used for the check itself so no reason to run the check within the port combo iterator.server/lib/private/Http/Client/DnsPinMiddleware.php
Lines 132 to 133 in a1be491
TODO
Checklist