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] Move handling of conflicting origin IPs to catch block#19233
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
| <tagname="kernel.event_subscriber" /> | ||
| </service> | ||
| <serviceid="validate_request_listener"class="Symfony\Component\HttpKernel\EventListener\RequestListener"> |
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.
You should also change the id accordingly to the class name, is that a possible BC break?
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.
Not really, asrequest_listener can easily conflict with an existing service. But having a disconnect between the class name and the id is strange.
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 suggest, whatever the id is, to add it to the changelog.
c9fee33 to65db9ecCompare| try { | ||
| return$this->handleRaw($request,$type); | ||
| }catch (\Exception$e) { | ||
| if ($einstanceof ConflictingHeadersException) { |
nicolas-grekasJun 29, 2016 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
To me, this belongs to HttpKernel: it's a low level HttpFoundation exception (the only one), and HttpKernel job's is to map HttpFoundation to event's world, and deal with any kind of events, exceptions included. It's HttpKernel's responsibility to convert HttpFoundation exceptions to HttpKernel's world.
It's not optional at all, and existing HttpKernel users (e.g. Drupal) need to get a BadRequestHttpException that they already know how do deal with. Not this ConflictingHeadersException that comes from lower levels.
The listener below is a nice to have, that adds an early check in the request management process. Totally optional and a smooth feature for the FrameworkBundle.
Thus the split I made here.
That's only my humble opinion and maybe I miss the thing, so I'll move to the listener if you're sure it's the right place.
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.
That's indeed much better now. 👍
.github/travis.php Outdated
| } | ||
| file_put_contents('packages.json',json_encode(compact('packages'),$flags)); | ||
| file_put_contents(dirname(__DIR__).'/packages.json',json_encode(compact('packages'),$flags)); |
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.
these changes seems unrelated
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.
yep, I'm debugging travis right now, this PR triggers situations that are not handled correctly today, please don't merge until it's green. I'll post a notice here.
e1bc96d todb84101Comparefabpot commentedJun 30, 2016
Thank you@nicolas-grekas. |
…catch block (magnusnordlander, nicolas-grekas)This PR was merged into the 2.7 branch.Discussion----------[HttpKernel] Move handling of conflicting origin IPs to catch block| Q | A| ------------- | ---| Branch? | 2.7| Bug fix? | yes| New feature? | no| BC breaks? | no| Deprecations? | no| Tests pass? | yes| Fixed tickets |#19217| License | MIT| Doc PR | -Commits-------db84101 [HttpKernel] Add listener that checks when request has both Forwarded and X-Forwarded-For1f00b55 [HttpKernel] Move conflicting origin IPs handling to catch block
Uh oh!
There was an error while loading.Please reload this page.