If-Modified-Since-And-Content-Length-Something

From: Doug Dixon <doug.dixon@dont-contact.us>
Date: Mon, 1 May 2006 16:38:41 +1200

Hi all

Here's a function from store.cc (squid3)

For such a simple thing, it's quite frustrating.

I assume it's supposed to tell you whether a store entry has been
modified since the "If-Modified-Since" time specified in the request.

1. It's looking at content_length for some reason
2. It's looking at imslen (whatever that is) for some reason

What has object length got to do with it?

Thanks
Doug

---
bool
StoreEntry::modifiedSince(HttpRequest * request) const
{
     int object_length;
     time_t mod_time = lastmod;
     if (mod_time < 0)
         mod_time = timestamp;
     debug(88, 3) ("modifiedSince: '%s'\n", storeUrl(this));
     debug(88, 3) ("modifiedSince: mod_time = %ld\n", (long int)  
mod_time);
     if (mod_time < 0)
         return true;
     /* Find size of the object */
     object_length = getReply()->content_length;
     if (object_length < 0)
         object_length = contentLen(this);
     if (mod_time > request->ims) {
         debug(88, 3) ("--> YES: entry newer than client\n");
         return true;
     } else if (mod_time < request->ims) {
         debug(88, 3) ("-->  NO: entry older than client\n");
         return false;
     } else if (request->imslen < 0) {
         debug(88, 3) ("-->  NO: same LMT, no client length\n");
         return false;
     } else if (request->imslen == object_length) {
         debug(88, 3) ("-->  NO: same LMT, same length\n");
         return false;
     } else {
         debug(88, 3) ("--> YES: same LMT, different length\n");
         return true;
     }
}
Received on Sun Apr 30 2006 - 22:45:25 MDT

This archive was generated by hypermail pre-2.1.9 : Mon May 01 2006 - 12:00:04 MDT