Re: "SetEnv/SetEnvIf" and mod_perl

Paul Silevitch <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAEK7ryiWZ+D+O5L2=ik35HcqQCqwjva7gRRjM+VZ4n3AbNMk8w@mail.gmail.com>
subprocess_env method will let you get apache's env:

http://perl.apache.org/docs/2.0/api/Apache2/RequestRec.html#C_subprocess_env_

On Fri, Oct 2, 2015 at 6:24 PM, Michael A. Capone <
[email protected]> wrote:

> In my code, I do:
>
> <Location something>
>     SetEnvIf Request_URI \.gif$ gif-image
>     SetHandler modperl
>     PerlResponseHandler MyNiftyModule
>     PerlOptions +SetupEnv
> </Location>
>
> And then, yes, I have access to $ENV{'gif-image'}, with a value of "1".
>
> Alternatively, i can
>    SetEnvIf Request_URI \.gif$ gif-image=YES
>
> ... and $ENV{'gif-image'} will have a value of 'YES'.
>
> Note that you have to do
>     PerlOptions +SetupEnv
> in order for this to pass through (as far as i know; unsetting it made my
> custom $ENV's go away).
>
> In a perfect world, we would have "PerlSetEnvIf". :)
>
>
> On 10/02/2015 02:39 AM, André Warnier wrote:
>
>> Hi again.
>>
>> Assuming this kind of configuration :
>>
>> <Location something>
>>     SetEnvIf Request_URI \.gif$ gif-image
>>     SetHandler modperl
>>     PerlResponseHandler MyNiftyModule
>> ..
>> </Location>
>>
>> is there any way, in MyNiftyModule, to "get at" this "gif-image" variable
>> ?
>>
>> Such as, would I find it as $ENV{'gif-image'} ?
>> What kind of thing are these "Apache environment variables" anyway ?
>> I have been using them extensively within Apache itself, but I still
>> can't quite figure out on what plane they live.  Clearly, they are not
>> "environment variables" in the same sense as "cgi-bin environment
>> variables", and not the same thing either as what a "PerlsetVar" does, so
>> what are they ?
>>
>> (And I realise that this is more of an Apache httpd question, but I
>> figure that if someone should be aware of the httpd internals, there is a
>> good chance of finding such a person here).
>>
>>
>>
>>
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.