cvs: php4 /ext/session session.c
| From: | Stanislav Malyshev | Date: | Sun, 27 Apr 2003 16:04:53 +0000 |
| Subject: | cvs: php4 /ext/session session.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-20524@lists.php.net to get a copy of this message | ||
stas Sun Apr 27 12:04:53 2003 EDT
Modified files:
/php4/ext/session session.c
Log:
MFB 4_3:
Fix very nasty bug - session cookie kills one of the cookies
set before it on certain non-Apache SAPIs.
# for example, this code:
# <?
# setcookie("abc", 1);
# setcookie("def", 2);
# session_start();
# ?>
# would output only 'def' cookie on CGI and ISAPI
Index: php4/ext/session/session.c
diff -u php4/ext/session/session.c:1.359 php4/ext/session/session.c:1.360
--- php4/ext/session/session.c:1.359 Sat Apr 5 06:22:15 2003
+++ php4/ext/session/session.c Sun Apr 27 12:04:53 2003
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: session.c,v 1.359 2003/04/05 11:22:15 sas Exp $ */
+/* $Id: session.c,v 1.360 2003/04/27 16:04:53 stas Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -252,7 +252,7 @@
#define CACHE_LIMITER_FUNC(name) static void CACHE_LIMITER(name)(TSRMLS_D)
#define CACHE_LIMITER_ENTRY(name) { #name, CACHE_LIMITER(name) },
-#define ADD_COOKIE(a) sapi_add_header(a, strlen(a), 1);
+#define ADD_HEADER(a) sapi_add_header(a, strlen(a), 1);
#define MAX_STR 512
@@ -841,7 +841,7 @@
#define LAST_MODIFIED "Last-Modified: "
memcpy(buf, LAST_MODIFIED, sizeof(LAST_MODIFIED) - 1);
strcpy_gmt(buf + sizeof(LAST_MODIFIED) - 1, &sb.st_mtime);
- ADD_COOKIE(buf);
+ ADD_HEADER(buf);
}
}
@@ -856,10 +856,10 @@
#define EXPIRES "Expires: "
memcpy(buf, EXPIRES, sizeof(EXPIRES) - 1);
strcpy_gmt(buf + sizeof(EXPIRES) - 1, &now);
- ADD_COOKIE(buf);
+ ADD_HEADER(buf);
sprintf(buf, "Cache-Control: public, max-age=%ld", PS(cache_expire) * 60); /* SAFE */
- ADD_COOKIE(buf);
+ ADD_HEADER(buf);
last_modified(TSRMLS_C);
}
@@ -869,24 +869,24 @@
char buf[MAX_STR + 1];
sprintf(buf, "Cache-Control: private, max-age=%ld, pre-check=%ld", PS(cache_expire) *
60, PS(cache_expire) * 60); /* SAFE */
- ADD_COOKIE(buf);
+ ADD_HEADER(buf);
last_modified(TSRMLS_C);
}
CACHE_LIMITER_FUNC(private)
{
- ADD_COOKIE("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
+ ADD_HEADER("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
CACHE_LIMITER(private_no_expire)(TSRMLS_C);
}
CACHE_LIMITER_FUNC(nocache)
{
- ADD_COOKIE("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
+ ADD_HEADER("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-store, no-cache, must-revalidate, post-check=0,
pre-check=0");
+ ADD_HEADER("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");
+ ADD_HEADER("Pragma: no-cache");
}
static php_session_cache_limiter_t php_session_cache_limiters[] = {
@@ -982,7 +982,7 @@
smart_str_0(&ncookie);
- sapi_add_header(ncookie.c, ncookie.len, 0);
+ sapi_add_header_ex(ncookie.c, ncookie.len, 0, 0);
}
static ps_module *_php_find_ps_module(char *name TSRMLS_DC)