Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HttpKernel] Inline ValidateRequestListener logic into HttpKernel #19217

Merged
merged 1 commit into from
Jun 29, 2016

Conversation

nicolas-grekas
Copy link
Member

@nicolas-grekas nicolas-grekas commented Jun 29, 2016

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #18688 #19216
License MIT
Doc PR -

I propose to inline the listener introduced in #18688 into HttpKernel.

@nicolas-grekas nicolas-grekas changed the title [HttpKernel] Remove ValidateRequestListener [HttpKernel] Inline ValidateRequestListener logic into HttpKernel Jun 29, 2016
@@ -18,7 +18,7 @@
"require": {
"php": ">=5.3.9",
"symfony/event-dispatcher": "~2.6,>=2.6.7",
"symfony/http-foundation": "~2.7,>=2.7.15",
"symfony/http-foundation": "~2.7,>=2.7.15|~2.8,>=2.8.8",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will need to be "~2.8,>=2.8.8|~3.0,>=3.0.8|~3.1,>=3.1.2", when merging into 3.0

@nicolas-grekas
Copy link
Member Author

Ready

@nicolas-grekas
Copy link
Member Author

ping @magnusnordlander for info

@@ -113,6 +115,14 @@ public function terminateWithException(\Exception $exception)
*/
private function handleRaw(Request $request, $type = self::MASTER_REQUEST)
{
if (self::MASTER_REQUEST === $type) {
try {
// This will throw an exception if the headers are inconsistent.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this comment is superfluous because the code is short and the exception message is very clear?

@nicolas-grekas nicolas-grekas force-pushed the drop-valid-req branch 4 times, most recently from 962e1f8 to 0691a22 Compare June 29, 2016 10:14
@@ -18,7 +18,7 @@
"require": {
"php": ">=5.3.9",
"symfony/event-dispatcher": "~2.6,>=2.6.7",
"symfony/http-foundation": "~2.7,>=2.7.15",
"symfony/http-foundation": "~2.7.15|~2.8,>=2.8.8",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"~2.8.8|~3.0.8|~3.1,>=3.1.2" on 3.0

@@ -18,7 +18,7 @@
"require": {
"php": ">=5.3.9",
"symfony/event-dispatcher": "~2.6,>=2.6.7",
"symfony/http-foundation": "~2.7,>=2.7.15",
"symfony/http-foundation": "~2.7.15|~2.8.8",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"~2.8.8|~3.0.8|~3.1.2|~3.2" on 3.0 (really this time :) )

@magnusnordlander
Copy link
Contributor

No objections from me :)

@nicolas-grekas nicolas-grekas merged commit 9d3ae85 into symfony:2.7 Jun 29, 2016
nicolas-grekas added a commit that referenced this pull request Jun 29, 2016
…pKernel (nicolas-grekas)

This PR was merged into the 2.7 branch.

Discussion
----------

[HttpKernel] Inline ValidateRequestListener logic into HttpKernel

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #18688 #19216
| License       | MIT
| Doc PR        | -

I propose to inline the listener introduced in #18688 into HttpKernel.

Commits
-------

9d3ae85 [HttpKernel] Inline ValidateRequestListener logic into HttpKernel
@nicolas-grekas nicolas-grekas deleted the drop-valid-req branch June 29, 2016 11:30
@fabpot
Copy link
Member

fabpot commented Jun 29, 2016

Why? I'm 👎 for this, that's ugly as hell!

@magnusnordlander
Copy link
Contributor

I agree that it's uglier. It does have an upside though, and that is that any project using HttpKernel will automatically get the client IP exceptions early, even if they don't use the listener in FrameworkBundle.

When I implemented #18688 I considered an approach like this for that very reason. For me, the ugliness tipped the scale towards a listener though, but both approaches have merit.

@nicolas-grekas
Copy link
Member Author

See #19233

fabpot added a commit that referenced this pull request Jun 30, 2016
…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-For
1f00b55 [HttpKernel] Move conflicting origin IPs handling to catch block
This was referenced Jun 30, 2016
This was referenced Jun 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants