2009-03-17
2009-03-17 07:46:45 by Martin Jonsson <marty@roxen.com>
-
0c272f2a12fa7878cdb8f018ee272cd40943af01
(24 lines)
(+16/-8)
[
Show
| Annotate
]
Branch: 5.2
Fix cookie overcaching in the protocol cache that occured on requests served from a protocol
cache entry that was generated from a "refresh" request. The problem was that the CookieJar was
disconnected unconditionally when sending from the protocol cache, even if the request later resulted in
a refresh. The result was that no cookie callbacks would be registered during the refresh request.
Rev: server/protocols/http.pike:1.589
2:
// Modified by Francesco Chemolli to add throttling capabilities.
// Copyright © 1996 - 2004, Roxen IS.
- constant cvs_version = "$Id: http.pike,v 1.588 2009/02/16 16:43:50 jonasw Exp $";
+ constant cvs_version = "$Id: http.pike,v 1.589 2009/03/17 07:46:45 marty Exp $";
// #define REQUEST_DEBUG
#define MAGIC_ERROR
2881: Inside #if defined(RAM_CACHE)
((st = file_stat( file->rf )) && st->mtime == file->mtime ))
#endif
{
- if (objectp(cookies)) {
- // Disconnect the cookie jar.
- real_cookies = cookies = ~cookies;
- }
-
+
int refresh;
if (file->refresh && (file->refresh <= predef::time(1))) {
// We might need to refresh the entry.
3036: Inside #if defined(RAM_CACHE)
if (!refresh) {
// No need to refresh the cached entry, so we just send it,
- // and are done.
+ // disconnect the cookie jar, and are done.
+ if (objectp(cookies)) {
+ // Disconnect the cookie jar just before sending the reply.
+ real_cookies = cookies = ~cookies;
+ }
TIMER_END(cache_lookup);
low_send_result(full_headers, d, sizeof(d));
return;
3047: Inside #if defined(RAM_CACHE)
RequestID id = clone_me();
id->hrtime = hrtime;
if (cookies) {
+ if (objectp(cookies)) {
+ // Disconnect the cookie jar from the RequestID used
+ // to send the cached response. (We want to keep the
+ // cookie jar for the refresh request in order for
+ // cookie callbacks to be registered correctly.)
+ id->cookies = id->real_cookies = ~cookies;
+ } else {
id->cookies = id->real_cookies = real_cookies + ([]);
}
-
+ }
id->my_fd = my_fd;
id->file = file;
id->kept_alive = kept_alive;