[Catalyst-commits] r7490 - in Catalyst-Runtime/5.70/trunk: . lib
lib/Catalyst lib/Catalyst/Engine t t/conf
andyg at dev.catalyst.perl.org
andyg at dev.catalyst.perl.org
Wed Mar 12 16:09:17 GMT 2008
Author: andyg
Date: 2008-03-12 16:09:16 +0000 (Wed, 12 Mar 2008)
New Revision: 7490
Added:
Catalyst-Runtime/5.70/trunk/t/live_engine_request_auth.t
Modified:
Catalyst-Runtime/5.70/trunk/Changes
Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
Catalyst-Runtime/5.70/trunk/lib/Catalyst/Engine/FastCGI.pm
Catalyst-Runtime/5.70/trunk/lib/Catalyst/Runtime.pm
Catalyst-Runtime/5.70/trunk/t/conf/extra.conf.in
Log:
Add a test and update docs on how to pass-through the Authorization header under Apache mod_fastcgi/mod_cgi
Modified: Catalyst-Runtime/5.70/trunk/Changes
===================================================================
--- Catalyst-Runtime/5.70/trunk/Changes 2008-03-12 03:28:08 UTC (rev 7489)
+++ Catalyst-Runtime/5.70/trunk/Changes 2008-03-12 16:09:16 UTC (rev 7490)
@@ -1,5 +1,9 @@
# This file documents the revision history for Perl extension Catalyst.
+5.7013
+ - Added test and updated docs for handling the Authorization header
+ under mod_fastcgi/mod_cgi.
+
5.7012 2007-12-16 23:44:00
- Fix uri_for()'s and uri_with()'s handling of multibyte chars
(Daisuke Murase)
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/Engine/FastCGI.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/Engine/FastCGI.pm 2008-03-12 03:28:08 UTC (rev 7489)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/Engine/FastCGI.pm 2008-03-12 16:09:16 UTC (rev 7490)
@@ -324,6 +324,16 @@
For more information on using FastCGI under Apache, visit
L<http://www.fastcgi.com/mod_fastcgi/docs/mod_fastcgi.html>
+=head3 Authorization header with mod_fastcgi or mod_cgi
+
+By default, mod_fastcgi/mod_cgi do not pass along the Authorization header,
+so modules like C<Catalyst::Plugin::Authentication::Credential::HTTP> will
+not work. To enable pass-through of this header, add the following
+mod_rewrite directives:
+
+ RewriteCond %{HTTP:Authorization} ^(.+)
+ RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT]
+
=head2 Lighttpd
These configurations were tested with Lighttpd 1.4.7.
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst/Runtime.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst/Runtime.pm 2008-03-12 03:28:08 UTC (rev 7489)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst/Runtime.pm 2008-03-12 16:09:16 UTC (rev 7490)
@@ -7,7 +7,7 @@
# Remember to update this in Catalyst as well!
-our $VERSION='5.7012';
+our $VERSION='5.7013';
=head1 NAME
Modified: Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm
===================================================================
--- Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2008-03-12 03:28:08 UTC (rev 7489)
+++ Catalyst-Runtime/5.70/trunk/lib/Catalyst.pm 2008-03-12 16:09:16 UTC (rev 7490)
@@ -65,7 +65,7 @@
# Remember to update this in Catalyst::Runtime as well!
-our $VERSION = '5.7012';
+our $VERSION = '5.7013';
sub import {
my ( $class, @arguments ) = @_;
Modified: Catalyst-Runtime/5.70/trunk/t/conf/extra.conf.in
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/conf/extra.conf.in 2008-03-12 03:28:08 UTC (rev 7489)
+++ Catalyst-Runtime/5.70/trunk/t/conf/extra.conf.in 2008-03-12 16:09:16 UTC (rev 7490)
@@ -13,6 +13,10 @@
# one CGI test will fail if you don't have mod_rewrite enabled
RewriteEngine on
RewriteRule /cgi$ /cgi/ [PT]
+
+ # Pass-through Authorization header for CGI/FastCGI
+ RewriteCond %{HTTP:Authorization} ^(.+)
+ RewriteRule ^(.*)$ $1 [E=HTTP_AUTHORIZATION:%1,PT]
<Location /rewrite>
RewriteEngine on
Added: Catalyst-Runtime/5.70/trunk/t/live_engine_request_auth.t
===================================================================
--- Catalyst-Runtime/5.70/trunk/t/live_engine_request_auth.t (rev 0)
+++ Catalyst-Runtime/5.70/trunk/t/live_engine_request_auth.t 2008-03-12 16:09:16 UTC (rev 7490)
@@ -0,0 +1,43 @@
+#!perl
+
+# This tests to make sure the Authorization header is passed through by the engine.
+
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+
+use Test::More tests => 7;
+use Catalyst::Test 'TestApp';
+
+use Catalyst::Request;
+use HTTP::Headers;
+use HTTP::Request::Common;
+
+{
+ my $creq;
+
+ my $request = GET(
+ 'http://localhost/dump/request',
+ 'Authorization' => 'Basic dGVzdDoxMjM0NQ==',
+ );
+
+ ok( my $response = request($request), 'Request' );
+ ok( $response->is_success, 'Response Successful 2xx' );
+ is( $response->content_type, 'text/plain', 'Response Content-Type' );
+ like( $response->content, qr/'Catalyst::Request'/,
+ 'Content is a serialized Catalyst::Request' );
+
+ {
+ no strict 'refs';
+ ok(
+ eval '$creq = ' . $response->content,
+ 'Unserialize Catalyst::Request'
+ );
+ }
+
+ isa_ok( $creq, 'Catalyst::Request' );
+
+ is( $creq->header('Authorization'), 'Basic dGVzdDoxMjM0NQ==', 'auth header ok' );
+}
Property changes on: Catalyst-Runtime/5.70/trunk/t/live_engine_request_auth.t
___________________________________________________________________
Name: svn:keywords
+ Id
More information about the Catalyst-commits
mailing list