ICAPOptions::ICAPOptions(): error("unconfigured"), method(ICAP::methodNone),
max_connections(-1), allow204(false),
- preview(-1), ttl(-1), transfer_ext(NULL)
+ preview(-1), theTTL(-1), transfer_ext(NULL)
{
transfers.preview = transfers.ignore = transfers.complete = NULL;
transfers.other = TRANSFER_NONE;
time_t ICAPOptions::expire() const
{
Must(valid());
- return ttl >= 0 ? timestamp + ttl : -1;
+ return theTTL >= 0 ? theTimestamp + theTTL : -1;
}
void ICAPOptions::configure(const HttpReply *reply)
cfgIntHeader(h, "Max-Connections", max_connections);
- cfgIntHeader(h, "Options-TTL", ttl);
+ cfgIntHeader(h, "Options-TTL", theTTL);
- timestamp = httpHeaderGetTime(h, HDR_DATE);
+ theTimestamp = httpHeaderGetTime(h, HDR_DATE);
- if (timestamp < 0)
- timestamp = squid_curtime;
+ if (theTimestamp < 0)
+ theTimestamp = squid_curtime;
if (httpHeaderGetByNameListMember(h, "Allow", "204", ',').size())
allow204 = true;
/*
- * $Id: ICAPOptions.h,v 1.2 2005/11/21 23:46:27 wessels Exp $
+ * $Id: ICAPOptions.h,v 1.3 2005/12/13 18:38:05 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
bool valid() const;
bool fresh() const;
time_t expire() const;
+ time_t timestamp() const { return theTimestamp; };
+
+ int ttl() const { return theTTL; };
typedef enum { TRANSFER_NONE, TRANSFER_PREVIEW, TRANSFER_IGNORE, TRANSFER_COMPLETE } transfer_type;
transfer_type getTransferExt(const char *);
transfers;
protected:
- int ttl;
- time_t timestamp;
+ int theTTL;
+ time_t theTimestamp;
// The list of pairs "file extension <-> transfer type"
debugs(93,1, "WARNING: Squid is configured to use ICAP method " << ICAP::methodStr(method) <<
"for service " << uri.buf() <<
"but OPTIONS response declares the method is " << ICAP::methodStr(theOptions->method));
+
+
+ /*
+ * Check the ICAP server's date header for clock skew
+ */
+ int skew = abs((int)(theOptions->timestamp() - squid_curtime));
+
+ if (skew > theOptions->ttl())
+ debugs(93, 1, host.buf() << "'s clock is skewed by " << skew << " seconds!");
+
}
static