X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FCatalyst%2FEngine%2FFastCGI.pm;h=c6a9068e1232b6e459c85a21c3ace2d64c23022b;hb=88eee38e25dd1a991008fb5f61b848fcecb97ad0;hp=8058a2d92bbfe415829558783a714e280f74d513;hpb=500a16796a666045b3961eef7ceb3a2ed4ec0ca7;p=catagits%2FCatalyst-Runtime.git diff --git a/lib/Catalyst/Engine/FastCGI.pm b/lib/Catalyst/Engine/FastCGI.pm index 8058a2d..c6a9068 100644 --- a/lib/Catalyst/Engine/FastCGI.pm +++ b/lib/Catalyst/Engine/FastCGI.pm @@ -1,7 +1,9 @@ package Catalyst::Engine::FastCGI; -use strict; -use base 'Catalyst::Engine::CGI'; +use Moose; +extends 'Catalyst::Engine::CGI'; + +# eval { Class::MOP::load_class("FCGI") }; eval "use FCGI"; die "Unable to load the FCGI module, you may need to install it:\n$@\n" if $@; @@ -44,7 +46,9 @@ Options may also be specified; =item leave_umask -Set to 1 to disable setting umask to 0 for socket open =item nointr +Set to 1 to disable setting umask to 0 for socket open + +=item nointr Do not allow the listener to be interrupted by Ctrl+C @@ -97,7 +101,7 @@ sub run { my %env; my $error = \*STDERR; # send STDERR to the web server $error = \*STDOUT # send STDERR to stdout (a logfile) - if $options->{keep_stderr}; # (if asked to) + if $options->{keep_stderr}; # (if asked to) my $request = FCGI::Request( \*STDIN, \*STDOUT, $error, \%env, $sock, @@ -159,6 +163,15 @@ sub write { $self->prepare_write($c); $self->{_prepared_write} = 1; } + + # XXX: We can't use Engine's write() method because syswrite + # appears to return bogus values instead of the number of bytes + # written: http://www.fastcgi.com/om_archive/mail-archive/0128.html + + # Prepend the headers if they have not yet been sent + if ( my $headers = delete $self->{_header_buf} ) { + $buffer = $headers . $buffer; + } # FastCGI does not stream data properly if using 'print $handle', # but a syswrite appears to work properly. @@ -315,6 +328,16 @@ application. For more information on using FastCGI under Apache, visit L +=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 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. @@ -355,8 +378,9 @@ values are disabled. The above example would start 5 processes. =head3 Non-root configuration You can also run your application at any non-root location with either of the -above modes. +above modes. Note the required mod_rewrite rule. + url.rewrite = ( "myapp\$" => "myapp/" ) fastcgi.server = ( "/myapp" => ( "MyApp" => ( @@ -379,11 +403,7 @@ L, L. =head1 AUTHORS -Sebastian Riedel, - -Christian Hansen, - -Andy Grundman, +Catalyst Contributors, see Catalyst.pm =head1 THANKS