You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Rob Hartill <ha...@ooo.lanl.gov> on 1996/06/12 22:35:53 UTC

perl subroutine for ascii -> HTTP auth header ?

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

Re: perl subroutine for ascii -> HTTP auth header ?

Posted by Doug MacEachern <do...@osf.org>.
On Wed, 12 Jun 1996, Rob Hartill wrote:

> 
> 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?

If you have the libwww-perl5 package:

use MIME::Base64;

my($uid,$pwd) = ("Apache", "BestServerEver");
my $auth_header = 
   "Authorization: Basic " . encode_base64("$uid:$pwd");

If you need to send a Digest header, see LWP::UserAgent, it's my one and
only hack to the great package...

Just another perl lover,

-Doug

> 
> 
> cheers,
> rob