Re: [squid-users] Adding Header file

From: Amos Jeffries <squid3@dont-contact.us>
Date: Sat, 03 May 2008 00:20:20 +1200

Paras Fadte wrote:
> Hi Amos,
>

Sorry, you seem to know his code way better than me now :-)
I maybe can give it a look tomorrow. But you may need to find the answer
elsewhere.
If you are having trouble tracing things around in squid the code docs
are at:
   http://squid.treenet.co.nz/Doc/Code/
its updated daily from trunk.

> With respect to ESI , I am also faced with the following problem. In
> the following example the value of "a" that should be printed is 30.
> But It prints the value of "a" as 10.
> ---------------------------------------------------------------------------------
> <esi:assign name="a" value="10"/>
> <esi:assign name="a" value="20"/>
> <esi:assign name="a" value="30"/>
>
>
> <esi:vars>
> name = $(a)
> </esi:vars>
> ----------------------------------------------------------------------------------
>
> It seems that ESI makes use of Trie data structure . Could this be
> because the value of the variable doesn't get updated in Trie ? How
> can one update a value associated with a variable using Trie ?
>
> Thanks.
>
> -Paras
>
>
>
> On Wed, Apr 23, 2008 at 5:37 PM, Amos Jeffries <squid3@treenet.co.nz> wrote:
>> Paras Fadte wrote:
>>
>>> Hi Amos,
>>>
>>> With respect to ESI and whatever little that I have understood after
>>> looking at the code it seems that the user defined variables are not
>>> evaluated when used in WHEN statement . In the file ESIAssign.cc file
>>> , I added "process(0)" which calls the process function . The
>>> process function is in the ESIAssign.cc . Really don't know whether
>>> this is the correct way , but doing so does substitute the variables
>>> in the "WHEN" statement with their real values . Also the problem
>>> seems to be that if one uses "assign" statement in a WHEN statement as
>>> shown below , irrespective of whether the WHEN test is true or false
>>> the assign statements are executed. Is it a parser issue?
>>>
>>> Can anybody help regarding this ?
>>>
>>>
>>> <esi:assign name="number" value="100"/>
>>>
>>>
>>> <esi:choose>
>>> <esi:when test="$(number)<=6">
>>> I am in "First" When statement.....
>>> <br> number = $(number)
>>> <esi:assign name="test" value="1234"/>
>>> <br> test = $(test)
>>> </esi:when>
>>>
>>> <esi:when test="$(number)==8">
>>> I am in "Second" When statement...
>>> <br> number = $(number)
>>> </esi:when>
>>>
>>> <esi:when test="$(number)==100">
>>> I am in "Third" When statement .....
>>> </esi:when>
>>>
>>> <esi:otherwise>
>>> <br> I am in ESI "otherwise" statement..
>>> </esi:otherwise>
>>> </esi:choose>
>>>
>>>
>>>
>> ***********************************************************************************************************
>>> ESIAssign::ESIAssign (esiTreeParentPtr aParent, int attrcount, char
>>> const **attr, ESIContext *aContext ) : parent (aParent), varState
>>> (NULL), name(), value (NULL), variable (NULL), unevaluatedVariable()
>>> {
>>> /* TODO: grab content IFF no value was specified */
>>> assert (aContext);
>>>
>>>
>>> varState = cbdataReference(aContext->varState);
>>>
>>> for (int i = 0; i < attrcount && attr[i]; i += 2) {
>>> if (!strcmp(attr[i],"name")) {
>>> /* the variables name is ... */
>>> debugs(86, 5, "ESIAssign::ESIAssign: Variable name '" <<
>>> attr[i+1] << "'");
>>> /* If there are duplicate name attributes, we simply use the
>>> * last one
>>> */
>>> name = attr[i+1];
>>>
>>> } else if (!strcmp(attr[i],"value")) {
>>> /* short form assignment: */
>>> debugs(86, 5, "ESIAssign::ESIAssign: Unevaluated variable
>>> '" << attr[i+1] << "'");
>>> /* Again, if there are duplicate attributes, we use the last */
>>> unevaluatedVariable = attr[i+1];
>>>
>>>
>>> process(0);
>>> } else {
>>> /* ignore mistyped attributes. TODO:? error on these for
>>> user feedback - config parameter needed
>>> */
>>> }
>>> }
>>>
>>> //varState = cbdataReference(aContext->varState);
>>> }
>>>
>> *******************************************************************************************************************
>>> Thank you.
>>>
>>> -Paras
>>>
>>>
>> <snip>
>>
>> It sounds to me like the parser running over the <esi:when> tags content
>> even if the test is false. I think you may need to look in the function
>> handling when and see if it can be made to run the test and skip to the
>> </esi:when> if false.
>>
>>
>>
>> Amos
>> --
>> Please use Squid 2.6.STABLE19 or 3.0.STABLE4
>>

-- 
Please use Squid 2.6.STABLE20 or 3.0.STABLE5
Received on Fri May 02 2008 - 12:19:39 MDT

This archive was generated by hypermail 2.2.0 : Tue May 13 2008 - 12:00:04 MDT