extern ICAPConfig TheICAPConfig;
-ICAPOptions::ICAPOptions(): error("unconfigured"), method(ICAP::methodNone),
+ICAPOptions::ICAPOptions(): error("unconfigured"),
max_connections(-1), allow204(false),
preview(-1), theTTL(-1), transfer_ext(NULL)
{
void ICAPOptions::cfgMethod(ICAP::Method m)
{
Must(m != ICAP::methodNone);
-
- if (method == ICAP::methodNone)
- method = m;
- else
- error = "the service claims to support several request methods";
+ methods += m;
}
// TODO: HttpHeader should provide a general method for this type of conversion
/*
- * $Id: ICAPOptions.h,v 1.6 2005/12/23 17:36:19 wessels Exp $
+ * $Id: ICAPOptions.h,v 1.7 2006/02/16 20:44:07 wessels Exp $
*
*
* SQUID Web Proxy Cache http://www.squid-cache.org/
const char *error; // human-readable information; set iff !valid()
// ICAP server MUST supply this info
- ICAP::Method method;
+ Vector<ICAP::Method> methods;
String istag;
// ICAP server MAY supply this info. If not, Squid supplies defaults.
return;
/*
- * Maybe it would be better if squid.conf just listed the URI and
- * then discovered the method via OPTIONS
+ * Issue a warning if the ICAP server returned methods in the
+ * options response that don't match the method from squid.conf.
*/
- if (theOptions->method != method && theOptions->method != ICAP::methodNone)
- 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));
+ if (!theOptions->methods.empty()) {
+ bool method_found = false;
+ String method_list;
+ Vector <ICAP::Method>::iterator iter = theOptions->methods.begin();
+ debugs(0,0,HERE);
+
+ while (iter != theOptions->methods.end()) {
+ debugs(0,0,HERE);
+
+ if (*iter == method) {
+ method_found = true;
+ break;
+ }
+
+ method_list.append(ICAP::methodStr(*iter));
+ method_list.append(" ", 1);
+ iter++;
+ debugs(0,0,HERE);
+ }
+
+ debugs(0,0,HERE);
+
+ if (!method_found) {
+ debugs(93,1, "WARNING: Squid is configured to use ICAP method " <<
+ ICAP::methodStr(method) <<
+ " for service " << uri.buf() <<
+ " but OPTIONS response declares the methods are " << method_list.buf());
+ }
+ }
/*