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;
    }
}

Reply via email to