httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Lucid <lu...@secret.org>
Subject perl answer and a question...
Date Wed, 12 Jun 1996 22:24:03 GMT
> 
> 
> anyone have a perl subroutine to convert a username & password
> into a HTTP header line for authorization?
> 
> I remember writing one some time ago (lots of base64 nonsense) but
> I've lost it.
> 
> Anyone have this?
> 
> 
> cheers,
> rob
> 

sub encode64    {
	my ($string) = @_;
	my $res = "";
	while ($string =~ /(.{1,45})/gs)        {
		$res .= substr(pack('u', $1), 1);
		chop($res);
	}
	$res =~ tr|` -_|AA-Za-z0-9+/|;
	my $padding = (3 - length($_[0]) % 3) % 3;
	$res =~ s/.{$padding}$/'=' x $padding/e if $padding;
	$res;
}

$auth = &encode64("$userid:$password");
print "Authorization: Basic $auth\n";


Heres my question...

I want to access a configuration value from another module
what is the prefered way to do this??

In a module I am writing I could really use knowing the
value of

<Directory /foo>

I have been trying to backtrace through the source but I am having no luck,
any ideas on accessing this from my module?

Bill Morris
memetic Design
BMorris@memetic.com
800-647-3597

Mime
View raw message