Re: Question about Server Side Includes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue 28 Jul 2009, Freddy Jensen wrote:
> I have created a csh script which I invoke from my web page
> like this:
>
> <!--#exec cmd="/somepath/check_for_debug.csh" -->
>
> The script looks like this:
>
> #!/bin/csh -f
> echo '<\!--#set var="MY_DEBUG" value=1 -->'
> exit 0
>
> Right after executing the  csh script I have this html code
> that tries to check the value of the MY_DEBUG variable and
> execute printenv if the value is set to 1:
>
> <!--#if expr="${MY_DEBUG} = 1" -->
> <!--#printenv -->
> <!--#endif -->

try it this way:

1) make the shell script accessible by an URL
   and configure mod_cgi for this URL
2) set the INCLUDES filter for this URL
3) use #include virtual instead of #exec

If you don't want the script to be exposed on the web you can use 
mod_rewrite's IS_SUBREQ variable. If it is false return a 404.

Now a bit of explanation, #exec simply executes the script and passes 
the output to the client. #include virtual issues a subrequest. That 
means the included document is accessed by an URL and can be configured 
independent of the main URL. It can be configured to be handled by 
mod_cgi and it can have assigned output filters. Now, when the INCLUDES 
filter of the subrequest sees the #set command it sets the variable. 
Then the main request's INCLUDES filter can access it. That's the 
theory.

Another option may be to configure the INCLUDES filter twice. But then 
you have to prevent the #if from being evaluated by the first run of 
the filter.

Torsten

-- 
Need professional mod_perl support?
Just hire me: torsten.foertsch@xxxxxxx

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx



[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux