Expires field when cache-control = private?
| From: | Rasmus Lerdorf | Date: | Sun, 11 Feb 2001 10:11:40 +0000 |
| Subject: | Expires field when cache-control = private? | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-46349@lists.php.net to get a copy of this message | ||
Sascha, I'm having a bit of trouble grasping why the Expires directive is
set to a date in the past when cache-control is set to private. ie.
HTTP/1.1 200 OK
Date: Sun, 11 Feb 2001 10:06:08 GMT
Server: Apache/1.3.13-dev (Unix) PHP/4.0.5-dev
X-Powered-By: PHP/4.0.5-dev
Set-Cookie: PHPSESSID=c4ea423ca12d1ece0791c7a71b9ac96e; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: private, max-age=10800, pre-check=10800
Last-Modified: Sat, 10 Feb 2001 15:12:35 GMT
Connection: close
Content-Type: text/html
Wouldn't this mean that it would never get cached, even in a user's
private cache?
By the way, is your birthday Nov.19.1981? ;)
Is this an oversight, or are you trying to work around some common bug in
proxy-cache systems out there? Otherwise I suggest this patch:
Index: session.c
===================================================================
RCS file: /repository/php4/ext/session/session.c,v
retrieving revision 1.192
diff -u -r1.192 session.c
--- session.c 2001/01/07 10:42:15 1.192
+++ session.c 2001/02/11 10:08:22
@@ -683,8 +683,13 @@
CACHE_LIMITER_FUNC(private)
{
char buf[MAX_STR + 1];
+ time_t now;
- ADD_COOKIE("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
+ time(&now);
+ now += PS(cache_expire) * 60;
+ strcpy(buf, "Expires: ");
+ strcat_gmt(buf, &now);
+ ADD_COOKIE(buf);
sprintf(buf, "Cache-Control: private, max-age=%ld, pre-check=%ld",
PS(cache_expire) * 60, PS(cache_expire) * 60);
ADD_COOKIE(buf);