Branch: Tag:

2008-04-28

2008-04-28 15:13:37 by Martin Stjernholm <mast@lysator.liu.se>

Put "stale" in $cache-status for all requests that get responses from stale
cache entries.

Rev: server/protocols/http.pike:1.553

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2004, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.552 2008/03/14 13:25:26 mast Exp $"; + constant cvs_version = "$Id: http.pike,v 1.553 2008/04/28 15:13:37 mast Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
2607: Inside #if defined(RAM_CACHE)
   MY_TRACE_LEAVE ("Entry invalid due to zero key");    conf->datacache->expire_entry(raw_url, this_object());    can_cache = 0; -  } else if (file->refresh > predef::time(1)) { +  } else { +  cache_status["stale"] = 1; +  if (file->refresh > predef::time(1)) {    // Stale and no refresh in progress.    // We want a refresh as soon as possible,    // so move the refresh time to now.
2620: Inside #if defined(RAM_CACHE)
   }    }    } +  }    if( can_cache )    {   #ifndef RAM_CACHE_ASUME_STATIC_CONTENT
2741: Inside #if defined(RAM_CACHE)
   if (!refresh) {    // No need to refresh the cached entry, so we just send it,    // and are done. +  // +  // FIXME: Use Cache-Control: no-cache when sending +  // invalid entries.    TIMER_END(cache_lookup);    low_send_result(full_headers, d, sizeof(d));    return;
2777: Inside #if defined(RAM_CACHE)
   refresh - 1), 0);    cache_status["protcache"] = 0;    cache_status["refresh"] = 1; +  cache_status["stale"] = 0;    MY_TRACE_LEAVE("");    }   #ifndef RAM_CACHE_ASUME_STATIC_CONTENT