How to pass options to ecap adapter?

Asked by Alex Hauras

Hello!
I tried to pass option from squid configuration file to ecap adapter this way:
ecap_service eRespmod respmod_precache uri=ecap://sample.com/ecap/services/patcher?exec=/etc/squid/patcher

But it didnt work:
Warning: loaded eCAP service has no matching ecap_service config option: ecap://sample.com/ecap/services/patcher
WARNING: configured ecap_service was not loaded: ecap://sample.com/ecap/services/patcher?exec=/etc/squid/patcher2

Can you describe hot to declare service config options? I just renamed adapter_modifying option "victim", but it didnt work.

my code looks like:

class Service: public libecap::adapter::Service {
        public:
                // Configuration storage
                std::string exec; // Executable file to pass stream
.................................

void Adapter::Service::setOne(const libecap::Name &name, const libecap::Area &valArea) {
        const std::string value = valArea.toString();
        if (name == "exec")
                if (value == "")
                    exec = "/etc/squid/patcher";
                else
                    exec = value;
        else
        if (name.assignedHostId())
                ; // skip host-standard options we do not know or care about
        else
                throw libecap::TextException(CfgErrorPrefix +
                        "unsupported configuration parameter: " + name.image());
}

void Adapter::Xaction::adaptContent(std::string &chunk) const {
        const std::string &exec = service->exec;

Question information

Language:
English Edit question
Status:
Solved
For:
eCAP Edit question
Assignee:
No assignee Edit question
Solved by:
Alex Rousskov
Solved:
Last query:
Last reply:
Revision history for this message
Alex Hauras (d77190) said :
#1

Squid version 3.4.4.2 (patched for ecap 1.0.0)

Revision history for this message
Best Alex Rousskov (rousskov) said :
#2

Instead of using old CGI-like syntax, try using the modern way of passing options:

  ecap_service id vectoring_point uri=... myOptionName1=myOptionValue1 myOptionName2=myOptionValue2 ...

Revision history for this message
Alex Hauras (d77190) said :
#3

Thank you, it works!

Revision history for this message
Alex Hauras (d77190) said :
#4

Thanks Alex Rousskov, that solved my question.