Branch: Tag:

2010-12-08

2010-12-08 14:56:03 by Martin Jonsson <marty@roxen.com>

Fixed an SPCI overcaching issue where stale entries wouldn't expire properly.

This occured if the refresh request didn't make it to the cache for some
reason, leaving the stale entry until it timed out.

Rev: server/protocols/http.pike:1.636

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2009, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.635 2010/12/08 14:19:48 mast Exp $"; + constant cvs_version = "$Id: http.pike,v 1.636 2010/12/08 14:56:03 marty Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
2707:       int varies = misc->vary && (sizeof(misc->vary) - misc->vary["host"]);   #ifdef RAM_CACHE +  int stored_in_cache;    if( (misc->cacheable > 0) && !misc->no_proto_cache)    {    if ((<"HEAD","GET">)[method]) {
2759: Inside #if defined(RAM_CACHE)
  #endif    ]),    misc->cacheable, this_object()); +  stored_in_cache = 1;    file = ([   #ifndef HTTP_COMPRESSION    "data":data,
2784: Inside #if defined(RAM_CACHE)
   }    }    } +  +  if (!stored_in_cache && misc->is_spci_refresh) { +  // If this was a protocol cache refresh request that didn't make +  // it to the protocol cache, remove the stale entry to prevent +  // overcaching. Reasons for the refresh request not to make it +  // to the cache include files that were removed recently, +  // transitions from cacheable to non-cacheable etc. +  conf->datacache->expire_entry (misc->prot_cache_key, 0); +  }   #endif      #ifdef HTTP_COMPRESSION
3560: Inside #if defined(RAM_CACHE)
   host = 0;    my_fd = 0;    misc->connection = "close"; +  misc->is_spci_refresh = 1;       MY_TRACE_ENTER (    sprintf("Starting refresh of stale entry "