cvs: php4 /ext/session php_session.h session.c

From: Date: Fri, 01 Sep 2000 15:56:27 +0000
Subject: cvs: php4 /ext/session php_session.h session.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-1491@lists.php.net to get a copy of this message
sas Fri Sep 1 08:56:27 2000 EDT Modified files: /php4/ext/session php_session.h session.c Log: Extend HTTP headers for private-caching and add a new PHP function session_cache_limiter. Submitted by: Jon Parise <jon@csh.rit.edu> Index: php4/ext/session/php_session.h diff -u php4/ext/session/php_session.h:1.33 php4/ext/session/php_session.h:1.34 --- php4/ext/session/php_session.h:1.33 Mon Jul 10 03:09:14 2000 +++ php4/ext/session/php_session.h Fri Sep 1 08:56:26 2000 @@ -112,6 +112,7 @@ PHP_FUNCTION(session_destroy); PHP_FUNCTION(session_unset); PHP_FUNCTION(session_set_save_handler); +PHP_FUNCTION(session_cache_limiter); PHP_FUNCTION(session_set_cookie_params); PHP_FUNCTION(session_get_cookie_params); Index: php4/ext/session/session.c diff -u php4/ext/session/session.c:1.158 php4/ext/session/session.c:1.159 --- php4/ext/session/session.c:1.158 Fri Sep 1 08:24:58 2000 +++ php4/ext/session/session.c Fri Sep 1 08:56:26 2000 @@ -62,7 +62,8 @@ PHP_FE(session_destroy, NULL) PHP_FE(session_unset, NULL) PHP_FE(session_set_save_handler, NULL) - PHP_FE(session_set_cookie_params, NULL) + PHP_FE(session_cache_limiter, NULL) + PHP_FE(session_set_cookie_params, NULL) PHP_FE(session_get_cookie_params, NULL) {0} }; @@ -677,7 +678,7 @@ { ADD_COOKIE("Expires: Thu, 19 Nov 1981 08:52:00 GMT"); /* For HTTP/1.1 conforming clients and the rest (MSIE 5) */ - ADD_COOKIE("Cache-Control: no-cache, post-check=0, pre-check=0"); + ADD_COOKIE("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0"); /* For HTTP/1.0 conforming clients */ ADD_COOKIE("Pragma: no-cache"); } @@ -689,7 +690,7 @@ {0} }; -static void _php_session_cache_limiter(PSLS_D) +static int _php_session_cache_limiter(PSLS_D) { php_session_cache_limiter *lim; SLS_FETCH(); @@ -704,15 +705,17 @@ } else { php_error(E_WARNING, "Cannot send session cache limiter - headers already sent"); } - return; + return (-2); } for (lim = php_session_cache_limiters; lim->name; lim++) { if (!strcasecmp(lim->name, PS(cache_limiter))) { lim->func(PSLS_C); - break; + return (0); } } + + return (-1); } #define COOKIE_FMT "Set-Cookie: %s=%s" @@ -1173,6 +1176,30 @@ convert_to_string_ex(p_name); if (PS(id)) efree(PS(id)); PS(id) = estrndup((*p_name)->value.str.val, (*p_name)->value.str.len); + } + + RETVAL_STRING(old, 0); +} +/* }}} */ + +/* {{{ proto string session_cache_limiter([string new_cache_limiter]) + Return the current cache limiter. If new_cache_limited is given, the current cache_limiter is replaced with new_cache_limiter */ +PHP_FUNCTION(session_cache_limiter) +{ + pval **p_cache_limiter; + int ac = ZEND_NUM_ARGS(); + char *old; + PSLS_FETCH(); + + old = estrdup(PS(cache_limiter)); + + if (ac < 0 || ac > 1 || zend_get_parameters_ex(ac, &p_cache_limiter) == FAILURE) + WRONG_PARAM_COUNT; + + if (ac == 1) { + convert_to_string_ex(p_cache_limiter); + efree(PS(cache_limiter)); + PS(cache_limiter) = estrndup((*p_cache_limiter)->value.str.val, (*p_cache_limiter)->value.str.len); } RETVAL_STRING(old, 0);

« previous php.cvs (#1491) next »