From 21a26d313384c38c6ad3c6c7d9f2af6ababa3538 Mon Sep 17 00:00:00 2001 From: Alex Rousskov Date: Thu, 8 May 2008 14:19:48 -0600 Subject: [PATCH] Added eCAP-specific squid.conf options: ecap_enable and ecap_service. It is not clear whether we should have ecap_service and icap_service or merge the two as adaptation_service and just look at the protocol field of the service URI. One reason to keep the options separate is that some ICAP services might use http schemes in their URIs, but I do not know how common that is. Another reason is it makes it easier to add protocol-specific options. TODO: Discuss whether similar eCAP and ICAP options should be documented separately. The alternative is to document one of them and point to that documentation from the other. Removed ICAPConfig from deprecated icap_ options that do not use it anymore. --- src/cache_cf.cc | 54 ++++++++++++++++++++++++++++++---------------- src/cf.data.depend | 1 + src/cf.data.pre | 43 ++++++++++++++++++++++++++++++++++-- 3 files changed, 78 insertions(+), 20 deletions(-) diff --git a/src/cache_cf.cc b/src/cache_cf.cc index b6e9c53092..c6b82144da 100644 --- a/src/cache_cf.cc +++ b/src/cache_cf.cc @@ -64,16 +64,15 @@ #include "adaptation/Config.h" static void parse_adaptation_service_set_type(); - static void parse_adaptation_access_type(); -static void dump_adaptation_access_type(StoreEntry *, const char *); -static void free_adaptation_access_type(); #endif #if ICAP_CLIENT #include "ICAP/ICAPConfig.h" +static void free_adaptation_access_type(const char *); + static void parse_icap_service_type(ICAPConfig *); static void dump_icap_service_type(StoreEntry *, const char *, const ICAPConfig &); static void free_icap_service_type(ICAPConfig *); @@ -86,6 +85,13 @@ static void free_icap_access_type(ICAPConfig *); #endif +#if USE_ECAP +#include "eCAP/Config.h" +static void parse_ecap_service_type(Ecap::Config *); +static void dump_ecap_service_type(StoreEntry *, const char *, const Ecap::Config &); +static void free_ecap_service_type(Ecap::Config *); +#endif + CBDATA_TYPE(peer); static const char *const T_SECOND_STR = "second"; @@ -3446,18 +3452,6 @@ parse_adaptation_access_type() Adaptation::Config::ParseAccess(LegacyParser); } -static void -free_adaptation_access_type() -{ - Adaptation::Config::FreeAccess(); -} - -static void -dump_adaptation_access_type(StoreEntry * entry, const char *name) -{ - Adaptation::Config::DumpAccess(entry, name); -} - #endif /* USE_ADAPTATION */ @@ -3506,19 +3500,43 @@ parse_icap_access_type(ICAPConfig *) { debugs(93, 0, "WARNING: 'icap_access' is depricated. " << "Use 'adaptation_access' instead"); - parse_adaptation_access_type(); + Adaptation::Config::ParseAccess(LegacyParser); } + static void free_icap_access_type(ICAPConfig *) { - free_adaptation_access_type(); + Adaptation::Config::FreeAccess(); } static void dump_icap_access_type(StoreEntry * entry, const char *name, const ICAPConfig &) { - dump_adaptation_access_type(entry, name); + Adaptation::Config::DumpAccess(entry, name); } #endif + + +#if USE_ECAP + +static void +parse_ecap_service_type(Ecap::Config * cfg) +{ + cfg->parseService(); +} + +static void +free_ecap_service_type(Ecap::Config * cfg) +{ + cfg->freeService(); +} + +static void +dump_ecap_service_type(StoreEntry * entry, const char *name, const Ecap::Config &cfg) +{ + cfg.dumpService(entry, name); +} + +#endif /* USE_ECAP */ diff --git a/src/cf.data.depend b/src/cf.data.depend index 5c48bc19dc..c259e612b1 100644 --- a/src/cf.data.depend +++ b/src/cf.data.depend @@ -30,6 +30,7 @@ adaptation_service_set_type icap_service icap_access_type icap_class acl icap_class_type icap_service icap_service_type +ecap_service_type int kb_int64_t kb_size_t diff --git a/src/cf.data.pre b/src/cf.data.pre index 09621c3c10..bf80ad2efb 100644 --- a/src/cf.data.pre +++ b/src/cf.data.pre @@ -5004,7 +5004,7 @@ DOC_END NAME: icap_class TYPE: icap_class_type IFDEF: ICAP_CLIENT -LOC: TheICAPConfig +LOC: none DEFAULT: none DOC_START This depricated option was documented to define an ICAP service @@ -5021,7 +5021,7 @@ DOC_END NAME: icap_access TYPE: icap_access_type IFDEF: ICAP_CLIENT -LOC: TheICAPConfig +LOC: none DEFAULT: none DOC_START This option is depricated. Please use adaptation_access, which @@ -5034,6 +5034,45 @@ COMMENT_START ----------------------------------------------------------------------------- COMMENT_END +NAME: ecap_enable +TYPE: onoff +IFDEF: USE_ECAP +COMMENT: on|off +LOC: Ecap::TheConfig.onoff +DEFAULT: off +DOC_START + Controls whether eCAP support is enabled. +DOC_END + +NAME: ecap_service +TYPE: ecap_service_type +IFDEF: USE_ECAP +LOC: Ecap::TheConfig +DEFAULT: none +DOC_START + Defines a single eCAP service + + ecap_service servicename vectoring_point bypass service_url + + vectoring_point = reqmod_precache|reqmod_postcache|respmod_precache|respmod_postcache + This specifies at which point of transaction processing the + eCAP service should be activated. *_postcache vectoring points + are not yet supported. + bypass = 1|0 + If set to 1, the eCAP service is treated as optional. If the + service cannot be reached or malfunctions, Squid will try to + ignore any errors and process the message as if the service + was not enabled. No all eCAP errors can be bypassed. + If set to 0, the eCAP service is treated as essential and all + eCAP errors will result in an error page returned to the + HTTP client. + service_url = ecap://vendor/service_name?custom&cgi=style¶meters=optional + +Example: +ecap_service service_1 reqmod_precache 0 ecap://filters-R-us/leakDetector?on_error=block +ecap_service service_2 respmod_precache 1 icap://filters-R-us/virusFilter?config=/etc/vf.cfg +DOC_END + NAME: loadable_modules TYPE: wordlist IFDEF: USE_LOADABLE_MODULES -- 2.47.2