From 810548764dd48dc1c91e33111523b0d3a3fec2cd Mon Sep 17 00:00:00 2001 From: Mark Fowler Date: Tue, 29 May 2012 13:06:42 +0100 Subject: [PATCH] make detection of "Basic" case insenitive as perl RFC2617 --- lib/Plack/Middleware/Auth/Basic.pm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Plack/Middleware/Auth/Basic.pm b/lib/Plack/Middleware/Auth/Basic.pm index 25be748ed..45de01499 100644 --- a/lib/Plack/Middleware/Auth/Basic.pm +++ b/lib/Plack/Middleware/Auth/Basic.pm @@ -22,7 +22,9 @@ sub call { my $auth = $env->{HTTP_AUTHORIZATION} or return $self->unauthorized; - if ($auth =~ /^Basic (.*)$/) { + # note the 'i' on the regex, as, accoring to RFC2617 this is a + # "case-insensitive token to identify the authentication scheme" + if ($auth =~ /^Basic (.*)$/i) { my($user, $pass) = split /:/, (MIME::Base64::decode($1) || ":"); $pass = '' unless defined $pass; if ($self->authenticator->($user, $pass, $env)) {