[PHP-DEV] [PATCH] session.cache_limiter = none
Hi, For a particular PHP installation I wanted to turn off all 'Cache-Control' headers, because 'cache_limiter=nocache' requires a user to explicitly resubmit form data every time and 'cache_limiter=private' would cache forms too often. However the current cache_limiter implementation does not have an option to do so. So I wrote a trivial patch against PHP 4.2.3 that adds value 'none' to session.cache_limiter. When set PHP replies do not include 'Cach-Control' or 'Pragma: nocache' headers, just a 'Last-Modified' one. Please consider merging it, from browsing the mailing list I get the impression that other people may find the 'none' option useful too. Thanks, Bastiaan Bakker LifeLine Networks bv Index: ext/session/session.c === RCS file: /opt/cvs/sourceroot/php/php-4.2.3/ext/session/session.c,v retrieving revision 1.1.1.1 diff -u -r1.1.1.1 session.c --- ext/session/session.c 7 Oct 2002 13:59:02 - 1.1.1.1 +++ ext/session/session.c 7 Oct 2002 15:49:23 - -700,11 +700,17 ADD_COOKIE(Pragma: no-cache); } +CACHE_LIMITER_FUNC(none) +{ + last_modified(TSRMLS_C); +} + static php_session_cache_limiter_t php_session_cache_limiters[] = { CACHE_LIMITER(public) CACHE_LIMITER(private) CACHE_LIMITER(private_no_expire) CACHE_LIMITER(nocache) + CACHE_LIMITER(none) {0} }; -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] session.cache_limiter = none
Hi Markus, Thanks for the quick response. Looks like my patch can go directly into /dev/null. 'session.cache_limiter = ' already works by accident in PHP-4.2.3, because unrecognized values default to 'no value'. The new dcoumentation still may be a bit confusing, because 'or leave this empty' may be interpreted as 'don't set session.cache_limiter'. In the latter case PHP defaults to 'nocache' rather than 'no cache limiting'. Also the last comma in {nocache,private,public,} is easy to miss. Anyway thanks for nulling my patch, it's always better to be able to use pristine sources. Regards, Bastiaan Bakker LifeLine Networks bv On Tue, 2002-10-08 at 11:18, Markus Fischer wrote: On Tue, Oct 08, 2002 at 10:45:19AM +0200, Bastiaan Bakker wrote : For a particular PHP installation I wanted to turn off all 'Cache-Control' headers, because 'cache_limiter=nocache' requires a user to explicitly resubmit form data every time and 'cache_limiter=private' would cache forms too often. However the current cache_limiter implementation does not have an option to do so. So I wrote a trivial patch against PHP 4.2.3 that adds value 'none' to session.cache_limiter. When set PHP replies do not include 'Cach-Control' or 'Pragma: nocache' headers, just a 'Last-Modified' one. Please consider merging it, from browsing the mailing list I get the impression that other people may find the 'none' option useful too. Current CVS already supports this. From php.ini-* : ; Set to {nocache,private,public,} to determine HTTP caching aspects. ; or leave this empty to avoid sending anti-caching headers. session.cache_limiter = nocache So, effectively, 'session.cache_limiter =' does what you want (if I understood you correctly). regards, - Markus -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc rei_ Derick, while ($xml) $ass-get_new_ideas(); [James] Markus: IE on_user_fart() -- People doesn't seem to like the new XHTML2 specs :) -- -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DEV] [PATCH] session.cache_limiter = none
On Tue, 2002-10-08 at 12:19, Markus Fischer wrote: On Tue, Oct 08, 2002 at 12:05:55PM +0200, Bastiaan Bakker wrote : The new dcoumentation still may be a bit confusing, because 'or leave this empty' may be interpreted as 'don't set session.cache_limiter'. In the latter case PHP defaults to 'nocache' rather than 'no cache limiting'. Also the last comma in {nocache,private,public,} is easy to miss. Yes, it may not be that clear. I suggest you open a bug at bugs.php.net about this issue so a) it doesn't get lost and b) as soon as someone comes up with a more descriptive text he can fix it. - Markus OK, I will. BTW. I found out why leaving the option empty also works in 4.2.3: the cache_limiter function tries to find the limiter corresponding with ''. As it cannot find it, it does nothing, but simply returns with error code -1. The calling function simply ignores the return code and continues processing. Unfortunately this also causes misspellings like 'session.cache_limiter=pivate' to go unnoticed. Cheers, Bastiaan Bakker LifeLine Networks bv -- GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc rei_ Derick, while ($xml) $ass-get_new_ideas(); [James] Markus: IE on_user_fart() -- People doesn't seem to like the new XHTML2 specs :) -- -- PHP Development Mailing List http://www.php.net/ To unsubscribe, visit: http://www.php.net/unsub.php