You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@perl.apache.org by st...@ps.ge.com on 2003/04/14 10:53:06 UTC

RE: Mixed-case environment variables in Win32 don't get handled c orrectly

Hi,

Make test works OK.

Here's a diff of the standard "cgi-bin/printenv.pl" output from a mod_perl
vs. straight perl :-

> DOWNGRADE_1_0="1"
< downgrade-1.0=""

> FORCE_RESPONSE_1_0="1"
< force-response-1.0=""

> NOKEEPALIVE="1"
< nokeepalive=""

< SSL_SERVER_I_DN_Email=""
> SSL_SERVER_I_DN_EMAIL="steve.sparling@ps.ge.com"

< SSL_SERVER_S_DN_Email=""
> SSL_SERVER_S_DN_EMAIL="steve.sparling@ps.ge.com"

> SSL_UNCLEAN_SHUTDOWN="1"
< ssl-unclean-shutdown=""

< SystemRoot="C:\WINDOWS"
> SYSTEMROOT="C:\WINDOWS"

Most of these variables come from "mod_ssl" except "SystemRoot" - which
comes from my
standard XP environment.

Notice also, the difference in "-" vs "_" and "." vs "_".

The src I built already had the ENV_IS_CASELESS conversion in
"modperl_cmd.c".

Hope this helps
Cheers
Steve




-----Original Message-----
From: Stas Bekman [mailto:stas@stason.org]
Sent: 07 April 2003 08:29
To: Sparling, Steve (PS, GENS)
Cc: 'dev@perl.apache.org'
Subject: Re: Mixed-case environment variables in Win32 don't get handled
corre ctly


Sparling, Steve (PS, GENS) wrote:
> Hi,
> 
> Found a problem running mod_perl under Win32: (ME, 2K and XP).
> 
> Mixed-case environment variables don't get handled correctly.
> 
> They appear in the %ENV, but have no value.
> 
> I've also identified in the source where the problem is + how to fix it -
> please find attached bug report.

Thanks Steve. In the future please inline the report, rather attach it.

Does 'make test' pass for you?

What kind of env vars you have a problem with? Where do you set them? Or
which 
ones do you expect to exist but they aren't there?

We populate %ENV with:

     modperl_env_table_populate(aTHX_ scfg->SetEnv);
     modperl_env_table_populate(aTHX_ scfg->PassEnv);

and if PerlOptions +SetupEnv (or SetHandler perl-script) are enabled:

     modperl_env_table_populate(aTHX_ r->subprocess_env);

SetEnv is already handling the upcasing. I'm not sure about PassEnv should
we 
need to do the same (if so the patch below should do).

As for r->subprocess_env, doesn't httpd already does the right thing?

Index: src/modules/perl/modperl_cmd.c
===================================================================
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
retrieving revision 1.45
diff -u -r1.45 modperl_cmd.c
--- src/modules/perl/modperl_cmd.c	4 Apr 2003 06:03:07 -0000	1.45
+++ src/modules/perl/modperl_cmd.c	7 Apr 2003 07:23:21 -0000
@@ -223,7 +223,15 @@
  {
      MP_dSCFG(parms->server);
      char *val = getenv(arg);
-
+
+#ifdef ENV_IS_CASELESS /* i.e. WIN32 */
+    /* we turn off env magic during hv_store later, so do this now,
+     * else lookups on keys with lowercase characters will fails
+     * because Perl will uppercase them prior to lookup.
+     */
+    modperl_str_toupper((char *)arg);
+#endif
+

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org


Re: Mixed-case environment variables in Win32 don't get handled c orrectly

Posted by Stas Bekman <st...@stason.org>.
steve.sparling@ps.ge.com wrote:
> Hi,
> 
> Make test works OK.

Great. Thanks Steve.

> Here's a diff of the standard "cgi-bin/printenv.pl" output from a mod_perl
> vs. straight perl :-

You probably mean mod_perl vs. mod_cgi. Can you use a unified diff (diff -u), 
I can't follow who gets the env keys mangled. Is that mod_perl's output that 
is not correct? it just calls subprocess_env, I wonder why is it different 
from mod_cgi.

>>DOWNGRADE_1_0="1"
> 
> < downgrade-1.0=""
> 
> 
>>FORCE_RESPONSE_1_0="1"
> 
> < force-response-1.0=""
> 
> 
>>NOKEEPALIVE="1"
> 
> < nokeepalive=""
> 
> < SSL_SERVER_I_DN_Email=""
> 
>>SSL_SERVER_I_DN_EMAIL="steve.sparling@ps.ge.com"
> 
> 
> < SSL_SERVER_S_DN_Email=""
> 
>>SSL_SERVER_S_DN_EMAIL="steve.sparling@ps.ge.com"
> 
> 
>>SSL_UNCLEAN_SHUTDOWN="1"
> 
> < ssl-unclean-shutdown=""
> 
> < SystemRoot="C:\WINDOWS"
> 
>>SYSTEMROOT="C:\WINDOWS"
> 
> 
> Most of these variables come from "mod_ssl" except "SystemRoot" - which
> comes from my
> standard XP environment.
> 
> Notice also, the difference in "-" vs "_" and "." vs "_".
> 
> The src I built already had the ENV_IS_CASELESS conversion in
> "modperl_cmd.c".
> 
> Hope this helps
> Cheers
> Steve
> 
> 
> 
> 
> -----Original Message-----
> From: Stas Bekman [mailto:stas@stason.org]
> Sent: 07 April 2003 08:29
> To: Sparling, Steve (PS, GENS)
> Cc: 'dev@perl.apache.org'
> Subject: Re: Mixed-case environment variables in Win32 don't get handled
> corre ctly
> 
> 
> Sparling, Steve (PS, GENS) wrote:
> 
>>Hi,
>>
>>Found a problem running mod_perl under Win32: (ME, 2K and XP).
>>
>>Mixed-case environment variables don't get handled correctly.
>>
>>They appear in the %ENV, but have no value.
>>
>>I've also identified in the source where the problem is + how to fix it -
>>please find attached bug report.
> 
> 
> Thanks Steve. In the future please inline the report, rather attach it.
> 
> Does 'make test' pass for you?
> 
> What kind of env vars you have a problem with? Where do you set them? Or
> which 
> ones do you expect to exist but they aren't there?
> 
> We populate %ENV with:
> 
>      modperl_env_table_populate(aTHX_ scfg->SetEnv);
>      modperl_env_table_populate(aTHX_ scfg->PassEnv);
> 
> and if PerlOptions +SetupEnv (or SetHandler perl-script) are enabled:
> 
>      modperl_env_table_populate(aTHX_ r->subprocess_env);
> 
> SetEnv is already handling the upcasing. I'm not sure about PassEnv should
> we 
> need to do the same (if so the patch below should do).
> 
> As for r->subprocess_env, doesn't httpd already does the right thing?
> 
> Index: src/modules/perl/modperl_cmd.c
> ===================================================================
> RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_cmd.c,v
> retrieving revision 1.45
> diff -u -r1.45 modperl_cmd.c
> --- src/modules/perl/modperl_cmd.c	4 Apr 2003 06:03:07 -0000	1.45
> +++ src/modules/perl/modperl_cmd.c	7 Apr 2003 07:23:21 -0000
> @@ -223,7 +223,15 @@
>   {
>       MP_dSCFG(parms->server);
>       char *val = getenv(arg);
> -
> +
> +#ifdef ENV_IS_CASELESS /* i.e. WIN32 */
> +    /* we turn off env magic during hv_store later, so do this now,
> +     * else lookups on keys with lowercase characters will fails
> +     * because Perl will uppercase them prior to lookup.
> +     */
> +    modperl_str_toupper((char *)arg);
> +#endif
> +
> 
> __________________________________________________________________
> Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
> http://stason.org/     mod_perl Guide ---> http://perl.apache.org
> mailto:stas@stason.org http://use.perl.org http://apacheweek.com
> http://modperlbook.org http://apache.org   http://ticketmaster.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
> For additional commands, e-mail: dev-help@perl.apache.org


-- 


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@perl.apache.org
For additional commands, e-mail: dev-help@perl.apache.org