Skip to content

[HttpKernel] Fix HttpCache validation HTTP method #19651

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

Merged
merged 1 commit into from
Aug 17, 2016

Conversation

tgalopin
Copy link
Contributor

@tgalopin tgalopin commented Aug 17, 2016

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

@tgalopin tgalopin changed the title bug #19582 [HttpKernel] Fix HttpCache validation HTTP method [HttpKernel] Fix HttpCache validation HTTP method Aug 17, 2016
@dunglas
Copy link
Member

dunglas commented Aug 17, 2016

👍

@@ -374,7 +374,11 @@ protected function validate(Request $request, Response $entry, $catch = false)
$subRequest = clone $request;

// send no head requests because we want content
$subRequest->setMethod('GET');
if ($request->isMethodSafe() && $request->getMethod() !== 'HEAD') {
$subRequest->setMethod($request->getMethod());
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed. By default, the subrequest is going to have the same method as the main one.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Indeed, I updated this.

@@ -374,7 +374,9 @@ protected function validate(Request $request, Response $entry, $catch = false)
$subRequest = clone $request;

// send no head requests because we want content
$subRequest->setMethod('GET');
if (!$request->isMethodSafe() || $request->getMethod() === 'HEAD') {
Copy link
Member

Choose a reason for hiding this comment

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

I'm pretty sure that isMethodSafe() here will always return true. If not, we would not lookup anything in the cache in the first place. So, this part of the condition can be removed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@fabpot
Copy link
Member

fabpot commented Aug 17, 2016

Thank you @tgalopin.

@fabpot fabpot merged commit 1a8a8af into symfony:2.7 Aug 17, 2016
fabpot added a commit that referenced this pull request Aug 17, 2016
This PR was merged into the 2.7 branch.

Discussion
----------

[HttpKernel] Fix HttpCache validation HTTP method

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

Commits
-------

1a8a8af [HttpKernel] Fix HttpCache validation HTTP method
@tgalopin tgalopin deleted the http-cache-method branch August 17, 2016 18:33
This was referenced Sep 2, 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.

4 participants