visitEachOption dynamic set options

Asked by Justin Bieber

that code set the metdata option BLOCKED to true. this code executes after useAdapted in start.
but i want set that values after check the body content in abContent

how can i do this?

    void Xaction::visitEachOption(libecap::NamedValueVisitor &visitor) const
    {
        libecap::Name name("BLOCKED");
        if (blocked)
            visitor.visit(name,
                          libecap::Area::FromTempString("true"));
    }

Question information

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

Your adapter is at the mercy of the host application here. The host application decides when to call visitEachOption().

For example, Squid calls visitEachOption() when it calls its own Adaptation::Ecap::XactionRep::updateHistory(). Squid calls that method when the adapter makes the primary transaction decision: useVirgin(), useAdapted(), or blockVirgin(). With Squid, your choices include:

1. Delay calling useAdapted() after you see (more of) virgin body content. Unfortunately, delaying adaptation decision stalls HTTP transaction progress (and may not be practical for other transaction-specific reasons).

2. Modify the host application to call visitEachOption() one more time (e.g., at transaction termination time).

3. Enhance eCAP API itself to allow the adapter to signal the host application when new transaction options are (or may be) available.

Revision history for this message
Justin Bieber (vazol2000) said :
#2

thx. in my abMake was that code and Delayd calling useAdapted() had no effect cause noteAbContentAvailable doesnt executes . I've fixed it now.
        if (!buffer.empty())
        {
            logDebugInfo("Buffer is not empty, notifying about availability of adapted body");
            hostx->noteAbContentAvailable();
        }