-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
b0bc337
to
dff250f
Compare
👍 |
@@ -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()); |
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.
Is this needed. By default, the subrequest is going to have the same method as the main one.
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.
Indeed, I updated this.
dff250f
to
6262cfb
Compare
@@ -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') { |
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'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.
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.
Fixed
6262cfb
to
3917900
Compare
3917900
to
1a8a8af
Compare
Thank you @tgalopin. |
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
Uh oh!
There was an error while loading. Please reload this page.