Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[HttpKernel] don't call getTrustedHeaderName() if possible#22873
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
[HttpKernel] don't call getTrustedHeaderName() if possible#22873
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| $currentXForwardedFor =$request->headers->get($trustedHeaderName,''); | ||
| $server['HTTP_'.$trustedHeaderName] = ($currentXForwardedFor ?$currentXForwardedFor.',' :'').$request->getClientIp(); | ||
| }elseif (Request::HEADER_X_FORWARDED_FOR & Request::getTrustedHeaderSet()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Actually, the non-deprecated API should be tried first, to use it when it is available IMO
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
In fact, I think that we can just fix this in 3.3.
cd52a80 to29c9d8cCompare29c9d8c to0ae049bCompare0ae049b toccf2275Compare| // will be included into trusted header for client ip | ||
| try { | ||
| if ($trustedHeaderName = Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP,false)) { | ||
| $hasTrustedHeaderSet =method_exists(Request::class,'getTrustedHeaderSet'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I would avoid this check by bumping the min version of HttpFoundation in HttpKernel
7e0c424 tob17d932Compare
nicolas-grekas left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
👍
b17d932 to6350dabComparenicolas-grekas commentedMay 25, 2017
Thank you@xabbuh. |
… (xabbuh)This PR was merged into the 3.3 branch.Discussion----------[HttpKernel] don't call getTrustedHeaderName() if possible| Q | A| ------------- | ---| Branch? | 3.3| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |https://travis-ci.org/symfony/symfony/jobs/235008102 (failing tests of#22863)| License | MIT| Doc PR |Commits-------6350dab don't call getTrustedHeaderName() if possible
Uh oh!
There was an error while loading.Please reload this page.