Return-Path: Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: (qmail 19819 invoked from network); 15 Apr 2010 18:35:04 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 15 Apr 2010 18:35:04 -0000 Received: (qmail 2372 invoked by uid 500); 15 Apr 2010 18:35:03 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 2346 invoked by uid 500); 15 Apr 2010 18:35:03 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 2335 invoked by uid 99); 15 Apr 2010 18:35:03 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Apr 2010 18:35:03 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of aw@ice-sa.com designates 212.85.38.228 as permitted sender) Received: from [212.85.38.228] (HELO tor.combios.es) (212.85.38.228) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 15 Apr 2010 18:34:54 +0000 Received: from localhost (localhost [127.0.0.1]) by tor.combios.es (Postfix) with ESMTP id 7B44F226190 for ; Thu, 15 Apr 2010 20:34:15 +0200 (CEST) Received: from tor.combios.es ([127.0.0.1]) by localhost (tor.combios.es [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id nWNpjBkzDlBY for ; Thu, 15 Apr 2010 20:34:15 +0200 (CEST) Received: from [192.168.245.129] (p549E1F78.dip0.t-ipconnect.de [84.158.31.120]) by tor.combios.es (Postfix) with ESMTPA id 261DF226180 for ; Thu, 15 Apr 2010 20:34:15 +0200 (CEST) Message-ID: <4BC75C37.6030007@ice-sa.com> Date: Thu, 15 Apr 2010 20:34:31 +0200 From: =?ISO-8859-1?Q?Andr=E9_Warnier?= Reply-To: mod_perl list User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: mod_perl list Subject: Re: accessing environment variables set by other modules References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Chris Datfung wrote: > I want to use mod-perl to edit server responses under certain conditions. My > plan was to use various modules, like mod-setenvif and mod-security to set > an environment variable and then have mod-perl edit the response body only > run when the environment variable is set. I tried the following test which > was supposed to append 'TEST' to my index.html page: > > in the virtual host config I have: > > SetEnvIf Request_URI "\.html$" TE=TEST > PerlRequire "/opt/modperl/TE/ST.pm" > PerlOutputFilterHandler TE::ST > ... Hi. Without entering into the details, and without contradiction with your original line of enquiry and other responses, you may want to have a look at the alternatives consisting of : A) - conditionally adding a HTTP header to the request at an early stage (using a mod_perl module instead of mod_setenvif e.g.) - later checking for the presence of that header and deciding to filter or not Adding and retrieving headers is easy with mod_perl. B) Or use an early-running mod_perl module to conditionally set a "pnote", and later checking on that pnote. The first alternative has the advantage (contrary to Apache internal variables or pnotes) that even if you proxy the request to another server, the value you set in the additional HTTP request header is visible to that other server. The second is probably more efficient, since you are running mod_perl anyway, as long as this is within the same server.