trafficserver-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kit Chan <chanshu...@gmail.com>
Subject Re: ESI Plugin
Date Thu, 17 May 2012 21:28:33 GMT
I am not 100% sure but i think the plugin is not smart enough yet to understand the "../" 

This may work in esi/esi.html

<esi:include src="http://www.servotic.com/date.php"/>

If not, can u make sure that conf_remap is not doing anything funny for your request? and
pls post the traffic.out & squid.blog/squid.log again after the suggested change. 

Thanks 
Kit

Sent from my iPhone

On May 17, 2012, at 10:39 PM, Jorge Román Novalbos <jroman@linux-it.es> wrote:

> First of all, I'm sorry I'm a newbie in esi tags and it's being so confusing for me….
> 
> 
> 
> On 17/05/2012, at 21:41, Kit Chan wrote:
> 
>> It seems that the plugin is not getting any response body from the first request.

>> 
>>> http://ori.servotic.com/esi/esi.php?p
>> 
>> 
>> So it thinks that there is no esi markup to interpret.
> 
> 
> This is the content of esi.html:
> 
> <HTML>
> <BODY>
> The time is: <esi:include src="../date.php"/>
> at this very moment.
> </BODY>
> </HTML>
> 
> and  this is the date.php
> 
> <?php
>        echo date('l jS \of F Y h:i:s A');
> ?>
> 
> In the vhost configuration I add the X-Esi header like this:
> 
>        <Directory /DATA/public/site/html/esi>
>                Header set Cache-control no-cache
>                Header set X-Esi 1
>        </Directory>
> 
> 
> 
>> 
>> Do you have output of squid.blog or squid.log? It should show two requests of status
200 if it is all good and successful
> 
> 1337286567.313 347 10.6.0.6 TCP_MISS/200 296 GET http://www.servotic.com/esi/esi.html
- DIRECT/ori.servotic.com text/html Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:12.0)
Gecko/20100101 Firefox/12.0  -
> 
> 
>> 
>> Also what is the corresponding line in remap.config? And what is the actual url in
the esi include? What is the url of the actual request from user? Your esi include url in
the first request cannot be arbitrary and must be handled by one of the lines in remap.config
> 
> In remap.config:
> 
> map http://www.servotic.com/ http://ori.servotic.com/ @plugin=conf_remap.so @pparam=/opt/trafficserver/etc/trafficserver/clientes/servotic.conf

> 
> In my plugin.config
> 
> esi.so
> 
> 
> The url that i asking for is http://www.servotic.com/esi/esi.html but pointer to my staging
enviroment, I mean this request is not working in the production enviroment.
> 
>> 
>> Thanks
>> Kit
>> 
>> Sent from my iPhone
>> 
>> On May 17, 2012, at 6:12 PM, Jorge Román Novalbos <jroman@linux-it.es> wrote:
>> 
>>> You're right that was one of my problem but it still doesn't work. This is the
traffic.out output in debug mode while a esi request is processing:
>>> 
>>> 
>>> [May 17 18:10:36.051] Server {47745214236416} DIAG: (plugin_esi) [isInterceptRequest]
Skipping external request
>>> [May 17 18:10:36.051] Server {47745214236416} DIAG: (plugin_esi) [globalHookHandler]
handling read request header event...
>>> [May 17 18:10:36.051] Server {47745214236416} DIAG: (plugin_esi) [globalHookHandler]
Not setting up intercept
>>> [May 17 18:10:36.051] Server {47745214236416} DIAG: (plugin_esi) [isInterceptRequest]
Skipping external request
>>> [May 17 18:10:36.051] Server {47745214236416} DIAG: (plugin_esi) [globalHookHandler]
handling cache lookup complete event...
>>> [May 17 18:10:36.051] Server {47745214236416} DIAG: (plugin_esi) [isCacheObjTransformable]
cache object's status is 0; not transformable
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi) [isInterceptRequest]
Skipping external request
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi) [globalHookHandler]
handling read response header event...
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi) [isCacheObjTransformable]
cache object's status is 0; not transformable
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi) [getClientState]
Got request URL [http://ori.servotic.com/esi/esi.php?p]
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi_vars_0x2b6c90dcd480)
[populate] Not retaining header [Accept]
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi_vars_0x2b6c90dcd480)
[populate] Not retaining header [Accept]
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi_vars_0x2b6c90dcd480)
[populate] Not retaining header [Accept]
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi_vars_0x2b6c90dcd480)
[populate] Not retaining header [Accept]
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi_vars_0x2b6c90dcd480)
[populate] Not retaining header [Accept-Encoding]
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi) [getClientState]
Client accepts gzip encoding; will compress output
>>> [May 17 18:10:36.385] Server {47745214236416} DIAG: (plugin_esi_vars_0x2b6c90dcd480)
[populate] Not retaining header [Accept-Encoding]
>>> [May 17 18:10:36.386] Server {47745214236416} DIAG: (plugin_esi_vars_0x2b6c90dcd480)
[populate] Not retaining header [Connection]
>>> [May 17 18:10:36.386] Server {47745214236416} DIAG: (plugin_esi) [getServerState]
Not retaining 'X-Esi' header
>>> [May 17 18:10:36.386] Server {47745214236416} DIAG: (plugin_esi) [getServerState]
Not retaining 'vary: accept-encoding' header
>>> [May 17 18:10:36.386] Server {47745214236416} DIAG: (plugin_esi) [getServerState]
Not retaining 'content-encoding: gzip' header
>>> [May 17 18:10:36.386] Server {47745214236416} DIAG: (plugin_esi) [getServerState]
Not retaining 'Content-length' header
>>> [May 17 18:10:36.386] Server {47745214236416} DIAG: (plugin_esi) [addTransform]
Added transformation (0x0x2b6c90dcd480)
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[init] Set input data type to [GZIPPED_ESI]
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformHandler] initialized continuation data
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_fetcher_0x2b6c90dcd480)
[_isFetchEvent] Event id 1 not within fetch event id range [10000, 10000)
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformHandler] handling TS_EVENT_IMMEDIATE...
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformData] upstream VC has 126 bytes available to read
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformData] Added chunk of 126 bytes starting with [] to parse list
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformData] Consumed 126 bytes from upstream VC
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformData] Completed reading input...
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_processor_0x2b6c90dcd480)
[completeParse] Implicit call to start()
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_parser_0x2b6c90dcd480)
[_setup] Returning true for empty data
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_parser_0x2b6c90dcd480)
[_completeParse] No data to parse!
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_processor_0x2b6c90dcd480)
[_handleParseComplete] Parsed ESI document with 0 nodes
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformData] data ready; going to process doc
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_processor_0x2b6c90dcd480)
[process] ESI processed document of size 0 starting with [(null)]
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformData] ESI processor output document of size 0 starting with [(null)]
>>> [May 17 18:10:36.386] Server {47745215289088} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformData] Compressed document from size 0 to 20 bytes
>>> [May 17 18:10:36.387] Server {47745216341760} DIAG: (plugin_esi) [modifyResponseHeader]
Removing header with name [Cache-Control]
>>> [May 17 18:10:36.387] Server {47745216341760} DIAG: (plugin_esi) [modifyResponseHeader]
Removing header with name [X-Esi]
>>> [May 17 18:10:36.387] Server {47745216341760} DIAG: (plugin_esi) [modifyResponseHeader]
Removing header with name [Age]
>>> [May 17 18:10:36.387] Server {47745216341760} DIAG: (plugin_esi) [modifyResponseHeader]
Inspected client-bound headers
>>> [May 17 18:10:36.387] Server {47745213183744} DIAG: (plugin_esi_fetcher_0x2b6c90dcd480)
[_isFetchEvent] Event id 103 not within fetch event id range [10000, 10000)
>>> [May 17 18:10:36.387] Server {47745213183744} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformHandler] shutting down transformation
>>> [May 17 18:10:36.398] Server {47745194728736} DIAG: (plugin_esi_0x2b6c90dcd480)
[checkXformStatus] Vconn closed
>>> [May 17 18:10:36.398] Server {47745194728736} DIAG: (plugin_esi_fetcher_0x2b6c90dcd480)
[_isFetchEvent] Event id 1 not within fetch event id range [10000, 10000)
>>> [May 17 18:10:36.398] Server {47745194728736} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformHandler] Transformation closed. Post-processing...
>>> [May 17 18:10:36.398] Server {47745194728736} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformHandler] Processing is complete, not processing current event 1
>>> [May 17 18:10:36.398] Server {47745194728736} DIAG: (plugin_esi_0x2b6c90dcd480)
[transformHandler] transformation closed; cleaning up data...
>>> [May 17 18:10:36.398] Server {47745194728736} DIAG: (plugin_esi_0x2b6c90dcd480)
[~ContData] Destroying continuation data
>>> 
>>> 
>>> On 17/05/2012, at 17:23, Kit Chan wrote:
>>> 
>>>> Without looking too deep into all info, i think the problem is that u need
to have a response header of
>>>> 
>>>> X-Esi: 1
>>>> 
>>>> with esi.html
>>>> 
>>>> Sent from my iPhone
>>>> 
>>>> On May 16, 2012, at 6:01 PM, Jorge Román Novalbos <jroman@linux-it.es>
wrote:
>>>> 
>>>>> I have the plugin compiled.
>>>>> 
>>>>> Finally I downloaded the sources from https://github.com/shukitchan/trafficserver-plugins/
with the problems fixes.
>>>>> 
>>>>> Now I'm trying to test the plugin.
>>>>> 
>>>>> For this test i have created two file:
>>>>> 
>>>>> - esi.html
>>>>> 
>>>>> <HTML>
>>>>> <BODY>
>>>>> The time is: <esi:include src="http://www.example.com/esi.php"/>
>>>>> at this very moment.
>>>>> </BODY>
>>>>> </HTML>
>>>>> 
>>>>> - esi.php
>>>>> 
>>>>> <?php
>>>>> echo date('l jS \of F Y h:i:s A');
>>>>> ?>
>>>>> 
>>>>> 
>>>>> When i ask for esi.html the date is not displayed, so esi plugin it doesn't
work. 
>>>>> 
>>>>> My question, ¿Do i have to activate the ESI in order to process that
url? Sorry, but i can't find much documentation about how to implement ATS with ESI tags.
>>>>> 
>>>>> P.S: I have activated the plugin in plugin.config
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> On 16/05/2012, at 12:22, Jorge Román Novalbos wrote:
>>>>> 
>>>>>> I am focusing with compile the pluging using the make command and
i have achieved some advances. 
>>>>>> 
>>>>>> I have installed some packages (libboost1.42-dev and gcc-4.4-locales)
and the error now is:
>>>>>> 
>>>>>> root@ts1:~/ATS-plugins/trafficserver-plugins/esi# make
>>>>>> tsxs -v -I lib -I fetcher/ -C plugin.cc serverIntercept.cc lib/*.cc
fetcher/*.cc -o esi.so
>>>>>> compiling plugin.cc -> plugin.lo
>>>>>> g++ -I/opt/trafficserver-3.0.4/include -Ilib -Ifetcher/ -g -pipe
-Wall -Werror -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing -Wno-invalid-offsetof
-fpic -c plugin.cc -o plugin.lo
>>>>>> En el fichero incluído de /usr/include/c++/4.4/ext/hash_map:60,
>>>>>>            de lib/StringHash.h:29,
>>>>>>            de lib/EsiProcessor.h:31,
>>>>>>            de plugin.cc:34:
>>>>>> /usr/include/c++/4.4/backward/backward_warning.h:28:2: error: #warning
This file includes at least one deprecated or antiquated header which may be removed without
further notice at a future date. Please use a non-deprecated interface with equivalent functionality
instead. For a listing of replacement headers and interfaces, consult the file backward_warning.h.
To disable this warning use -Wno-deprecated.
>>>>>> plugin.cc: In function ‘void cacheNodeList(ContData*)’:
>>>>>> plugin.cc:453: error: conversión inválida de ‘const sockaddr*’
a ‘unsigned int’
>>>>>> plugin.cc:453: error: conversión inválida de ‘tsapi_cont*’
a ‘int’
>>>>>> plugin.cc:453: error: no se puede convertir ‘TSFetchWakeUpOptions’
a ‘tsapi_cont*’ para el argumento ‘5’ para ‘void TSFetchUrl(const char*, int, unsigned
int, int, tsapi_cont*, TSFetchWakeUpOptions, TSFetchEvent)’
>>>>>> Compile failed: g++ -I/opt/trafficserver-3.0.4/include -Ilib -Ifetcher/
-g -pipe -Wall -Werror -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing -Wno-invalid-offsetof
-fpic -c plugin.cc -o plugin.lo
>>>>>> make: *** [all] Error 1
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> I'm debuging the make command with strace but I'm not able to fix
the problem. Some advices?
>>>>>> 
>>>>>> 
>>>>>> On 16/05/2012, at 10:51, Jorge Román Novalbos wrote:
>>>>>> 
>>>>>>> Hi all, 
>>>>>>> 
>>>>>>> I'm compiling the ESI plugin in my trafficserver-3.0.4. I downloaded
the plugins from repository and i have followed the next steps:
>>>>>>> 
>>>>>>> 1. cd trafficserver-plugins/esi
>>>>>>> 2. /opt/trafficserver/bin/tsxs -o esi.so -c serverIntercept.cc
>>>>>>> 3 /opt/trafficserver/bin/tsxs -o esi.so -i
>>>>>>> 4 edit /opt/trafficserver/etc/trafficserver/plugin.config an
add esi.so
>>>>>>> 5. Restart trafficserver daemon.
>>>>>>> 
>>>>>>> 
>>>>>>> The traffic_server process never start because can't load the
esi plugin. The traffic.out show these lines:
>>>>>>> 
>>>>>>> [May 16 10:31:49.263] Server {47992987118880} ERROR: unable to
find TSPluginInit function '/opt/trafficserver-3.0.4/libexec/trafficserver/esi.so': /opt/trafficserver-3.0.4/libexec/trafficserver/esi.so:
undefined symbol: TSPluginInit
>>>>>>> [May 16 10:31:50.361] Manager {140531591419680} ERROR: [LocalManager::pollMgmtProcessServer]
Server Process terminated due to Sig 6: Aborted
>>>>>>> [May 16 10:31:50.361] Manager {140531591419680} ERROR:  (last
system error 2: No such file or directory)
>>>>>>> [May 16 10:31:50.361] Manager {140531591419680} ERROR: [Alarms::signalAlarm]
Server Process was reset
>>>>>>> [May 16 10:31:50.361] Manager {140531591419680} ERROR:  (last
system error 2: No such file or director y)
>>>>>>> 
>>>>>>> Obviously something is wrong in esi pluging but I don't know
if i am doing some step wrong.
>>>>>>> 
>>>>>>> I have tried to use the Makefile file in esi source but never
compile. This is the error:
>>>>>>> 
>>>>>>> root@ts1:~/ATS-plugins/trafficserver-plugins/esi# make
>>>>>>> tsxs -v -I lib -I fetcher/ -C plugin.cc serverIntercept.cc lib/*.cc
fetcher/*.cc -o esi.so
>>>>>>> compiling plugin.cc -> plugin.lo
>>>>>>> g++ -I/opt/trafficserver-3.0.4/include -Ilib -Ifetcher/ -g -pipe
-Wall -Werror -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing -Wno-invalid-offsetof
-fpic -c plugin.cc -o plugin.lo
>>>>>>> In file included from /usr/include/c++/4.4/ext/hash_map:60,
>>>>>>>           from lib/StringHash.h:29,
>>>>>>>           from lib/EsiProcessor.h:31,
>>>>>>>           from plugin.cc:34:
>>>>>>> /usr/include/c++/4.4/backward/backward_warning.h:28:2: error:
#warning This file includes at least one deprecated or antiquated header which may be removed
without further notice at a future date. Please use a non-deprecated interface with equivalent
functionality instead. For a listing of replacement headers and interfaces, consult the file
backward_warning.h. To disable this warning use -Wno-deprecated.
>>>>>>> In file included from lib/EsiProcessor.h:35,
>>>>>>>           from plugin.cc:34:
>>>>>>> lib/Variables.h:29:33: error: boost/noncopyable.hpp: No existe
el fichero o el directorio
>>>>>>> In file included from lib/EsiProcessor.h:35,
>>>>>>>           from plugin.cc:34:
>>>>>>> lib/Variables.h:38: error: ‘boost’ has not been declared
>>>>>>> lib/Variables.h:38: error: expected ‘{’ before ‘noncopyable’
>>>>>>> lib/Variables.h:38: error: invalid type in declaration before
‘{’ token
>>>>>>> cc1plus: warnings being treated as errors
>>>>>>> lib/Variables.h:38: error: extended initializer lists only available
with -std=c++0x or -std=gnu++0x
>>>>>>> lib/Variables.h:40: error: expected primary-expression before
‘public’
>>>>>>> lib/Variables.h:40: error: expected ‘}’ before ‘public’
>>>>>>> lib/Variables.h:40: error: expected ‘,’ or ‘;’ before
‘public’
>>>>>>> lib/Variables.h: In function ‘void EsiLib::populate(const char*,
int)’:
>>>>>>> lib/Variables.h:60: error: ‘_query_string_parsed’ was not
declared in this scope
>>>>>>> lib/Variables.h:61: error: ‘_parseQueryString’ was not declared
in this scope
>>>>>>> lib/Variables.h:63: error: ‘_query_string’ was not declared
in this scope
>>>>>>> lib/Variables.h: At global scope:
>>>>>>> lib/Variables.h:70: error: non-member function ‘const std::string&
EsiLib::getValue(const std::string&)’ cannot have cv-qualifier
>>>>>>> lib/Variables.h:73: error: non-member function ‘const std::string&
EsiLib::getValue(const char*, int)’ cannot have cv-qualifier
>>>>>>> lib/Variables.h: In function ‘const std::string& EsiLib::getValue(const
char*, int)’:
>>>>>>> lib/Variables.h:75: error: ‘EMPTY_STRING’ was not declared
in this scope
>>>>>>> lib/Variables.h: At global scope:
>>>>>>> lib/Variables.h:88: error: declaration of ‘~EsiLib::Variables’
as non-member
>>>>>>> lib/Variables.h:90: error: expected unqualified-id before ‘private’
>>>>>>> lib/Variables.h:99: error: storage size of ‘EsiLib::SIMPLE_HEADERS’
isn't known
>>>>>>> lib/Variables.h:102: error: storage size of ‘EsiLib::SPECIAL_HEADERS’
isn't known
>>>>>>> lib/Variables.h:105: error: storage size of ‘EsiLib::NORM_SIMPLE_HEADERS’
isn't known
>>>>>>> lib/Variables.h:106: error: storage size of ‘EsiLib::NORM_SPECIAL_HEADERS’
isn't known
>>>>>>> lib/Variables.h:114: error: non-member function ‘std::string&
EsiLib::_toUpperCase(std::string&)’ cannot have cv-qualifier
>>>>>>> lib/Variables.h:115: error: non-member function ‘int EsiLib::_searchHeaders(const
std::string*, const char*, int)’ cannot have cv-qualifier
>>>>>>> lib/Variables.h:117: error: non-member function ‘bool EsiLib::_parseDictVariable(const
std::string&, const char*&, int&, const char*&, int&)’ cannot have cv-qualifier
>>>>>>> lib/Variables.h:150: error: non-member function ‘const std::string&
EsiLib::_getSubCookieValue(const std::string&, size_t)’ cannot have cv-qualifier
>>>>>>> lib/Variables.h:154: error: expected declaration before ‘}’
token
>>>>>>> lib/Variables.h:99: error: ‘EsiLib::SIMPLE_HEADERS’ defined
but not used
>>>>>>> lib/Variables.h:102: error: ‘EsiLib::SPECIAL_HEADERS’ defined
but not used
>>>>>>> lib/Variables.h:105: error: ‘EsiLib::NORM_SIMPLE_HEADERS’
defined but not used
>>>>>>> lib/Variables.h:106: error: ‘EsiLib::NORM_SPECIAL_HEADERS’
defined but not used
>>>>>>> Compile failed: g++ -I/opt/trafficserver-3.0.4/include -Ilib
-Ifetcher/ -g -pipe -Wall -Werror -O3 -feliminate-unused-debug-symbols -fno-strict-aliasing
-Wno-invalid-offsetof -fpic -c plugin.cc -o plugin.lo
>>>>>>> make: *** [all] Error 1
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> could anybody  help me?
>>>>>>> 
>>>>>>> 
>>>>>>> 
>>>>>>> Thanks to all developer for this amaizing software.
>>>>>> 
>>>>> 
>>> 
> 

Mime
View raw message