perl-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From steve.sparl...@ps.ge.com
Subject RE: [mp2.0] Win32 ENV still not compatible with mod_cgi
Date Fri, 09 May 2003 09:16:23 GMT
Hi,

>> I think Steve's saying that $ENV{SSL_SERVER_S_DN_Email} doesn't work for
him 
>> under mod_cgi and he has to use $ENV{SSL_SERVER_S_DN_EMAIL} which fails
under 
>> mod_perl.

NO - quite the opposite.

CGI behaviour (win32) :-

	$ENV{SSL_SERVER_S_DN_Email} gives 'steve.sparling@ps.ge.com'
	$ENV{SSL_SERVER_S_DN_EMAIL} gives 'steve.sparling@ps.ge.com'
	$ENV{SsL_SeRvEr_S_dN_EmAiL} gives 'steve.sparling@ps.ge.com'

ie - any combination when reading works a treat -> but I REALLY want to use
     'SSL_SERVER_S_DN_Email' in order to also work with the UNIX
environments.

mod_perl (win32) behaviour :-

	$ENV{SSL_SERVER_S_DN_Email} gives <undef>
	$ENV{SSL_SERVER_S_DN_EMAIL} gives <undef>
	$ENV{SsL_SeRvEr_S_dN_EmAiL} gives <undef>

ie - no matter what combination is used - it NEVER works at all...

------------------------

mod_ssl is responsible for 'creating' this variable by examining the
X509 SSL certificate credentials and creating a variable per item.

It does this via apr_table_setn(...) on r->process_env

------------------------

So, in summary (win32) :-

1) mod_ssl calls

	apr_table_setn(r->process_env, "SSL_SERVER_S_DN_Email",
"steve.sparling@ps.ge.com")

2) mod_perl calls

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

3) ModPerl::Registry invokes perl script to extract variable :-

	my $email = $ENV{SSL_SERVER_S_DN_Email};	# value is always
<undef>

-------------------------

As mod_perl has NO control of what other modules place into r->process_env,
mixed-case
keys are being placed into %ENV (through the back-door)...

You can prove this if you iterate through %ENV :-

	$ENV{testing} = 'Try this also...';

	while (($key, $value) = each %ENV)
	{
		print " $key = '$value'. Lookup gives '", $ENV{$key} ||
'<undef>', "'\n";
	}

You actually get the following :-

	SSL_SERVER_S_DN_Email = 'steve.sparling@ps.ge.com'. Lookup gives
'<undef>'

	TESTING = 'Try this also...'. Lookup gives 'Try this also...'

Which proves that if $ENV{..} is set through perl, it will automatically
place an UPPERCASE
version of the key into its internal hash - see TESTING above.

So, when my script is asking for $ENV{SSL_SERVER_S_DN_Email}, the underlying
perl is looking
for $ENV{SSL_SERVER_S_DN_EMAIL} - which it will never find in a month of
Sundays - as mod_perl
has blindy used the key from r->process_env - without 'fixing' it up as done
in PerlSetEnv or PerlPassEnv.

Regards
Steve

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


Mime
View raw message