-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Fix for CHttpCacheFilter's Cache-Control headers being overwritten by started sessions #1628
Conversation
Are there any objections? If not, I'd like to add a line to |
as you wrote... this still needs to be tested... "it should work" does not mean it works. |
True. I'm a bit worried, though: Except for @samdark assigning himself, this PR hasn't seen any attention in a week. I realize that the issue resolved by this is not the most pressing one, but it clearly impairs the operation of I just realized that I've got a box left which is locked at PHP v5.3, so I could actually test this myself. I'll report back soon. |
@DaSourcerer it will be very helpful. |
Solution works as expected on 5.2.17. Feel free to request additional tests on 5.2.17. |
@@ -181,6 +181,11 @@ protected function send304Header() | |||
*/ | |||
protected function sendCacheControlHeader() | |||
{ | |||
if(Yii::app()->session->isStarted) |
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.
Don't forget about indentation. ✋
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.
Looks like this diff has been whitespace-damaged while it looked ok in my editor... Thanks for pointing this out.
I can now confirm that this works on PHP v5.3.18 as well. |
Nice. Add a changelog line, update and we will merge it. |
Done with 686480e |
@@ -35,6 +35,7 @@ Version 1.1.13 work in progress | |||
- Bug #1652: Fixed incorrect syntax of CDbSchema::renameTable() for SQLite, added CSqliteSchema::renameTable() method (Sarke) | |||
- Bug: Table schema is refreshed on Gii model generation when schemaCachingDuration is used (SonkoDmitry) | |||
- Bug: CDbCommand::setFetchMode wasn't accepting additional arguments needed for PDO::FETCH_CLASS (samdark) | |||
- Bug: Active HTTP sessions overwrote the Cache-Control header set by CHttpCacheFilter (DaSourcerer) |
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.
Need issue number here. In this case it's 1628. That's one last thing. Can't do it myself since using iPhone currently :)
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.
Ah, I thought since #1628 is "just" the PR, I could leave it out. Adding right away ...
Fix for CHttpCacheFilter's Cache-Control headers being overwritten by started sessions
Thanks! |
As reported here, there is a problem with the
Cache-Control
header being overwritten by PHP's session logic. This can result into situations where http caching loses its effects.This PR sets a header via
session_cache_limiter()
which will be immediately overwritten. In addition, thePragma
header will be cleared as well. This seems to work well in PHP v5.4.x and according to this comment, it should work with previous versions of PHP too. I'd still appreciate some review by others.