Fixes Engine::CGI for Lighttpd
Lighttpd has error-handler-404 feature which is useful as dynamic content handler.
But it seems that Catalyst does not support this.
This is problem of Catalyst's environment parser (Catalyst::Engine::CGI)
When I set error-handler-404 to "/script/myapp_fastcgi.pl" and request /foo/bar (no exsits path),
Lighttpd call /script/myapp_fastcgi.pl with following %ENV
PATH_INFO and QUERY_STRING are always empty via error-handler-404.REQUEST_URI: /foo/bar
REDIRECT_URI: /script/myapp_fastcgi.pl
PATH_INFO: ''
QUERY_STRING: ''
Instead of those vars, set REQUEST_URI (path+query)
It seems that Lighttpd always set REQUEST_URI whether error-handler is set or not.
So the solution about this problem is that Engine::CGI parses REQUEST_URI for any lighttpd's request.
Here is the patch:
Update at 2006-09-09 14:36 +0900: updated patch--- /usr/local/share/perl/5.8.8/Catalyst/Engine/CGI.pm 2006-07-20 06:45:16.000000000 +0900
+++ lib/Catalyst/Engine/CGI.pm 2006-09-09 20:07:45.000000000 +0900
@@ -140,12 +140,28 @@
my $path = $base_path . ( $ENV{PATH_INFO} || '' );
$path =~ s{^/+}{};- my $uri = URI->new;
- $uri->scheme($scheme);
- $uri->host($host);
- $uri->port($port);
- $uri->path($path);
- $uri->query( $ENV{QUERY_STRING} ) if $ENV{QUERY_STRING};
+ my $uri;
+
+ # lighttpd always set requested uri into REQUEST_URI
+ if ( ( $ENV{SERVER_SOFTWARE} || '' ) =~ /lighttpd/ and $ENV{REQUEST_URI} ) {
+ $uri = URI->new( $ENV{REQUEST_URI} );
+ $uri->scheme($scheme);
+ $uri->host($host);
+ $uri->port($port);
+
+ use YAML;
+ warn Dump $uri;
+
+ $ENV{QUERY_STRING} = $uri->query if $uri->query;
+ }
+ else {
+ $uri = URI->new;
+ $uri->scheme($scheme);
+ $uri->host($host);
+ $uri->port($port);
+ $uri->path($path);
+ $uri->query( $ENV{QUERY_STRING} ) if $ENV{QUERY_STRING};
+ }# sanitize the URI
$uri = $uri->canonical;
@@ -167,7 +183,11 @@
my ( $self, $c ) = @_;
local (*ENV) = $self->env || \%ENV;- if ( $ENV{QUERY_STRING} ) {
+ if ( ( $ENV{SERVER_SOFTWARE} || '' ) =~ /lighttpd/ and $ENV{REQUEST_URI} ) {
+ my ($query_string) = $ENV{REQUEST_URI} =~ /\?(.*)/;
+ $self->SUPER::prepare_query_parameters( $c, $query_string );
+ }
+ elsif ( $ENV{QUERY_STRING} ) {
$self->SUPER::prepare_query_parameters( $c, $ENV{QUERY_STRING} );
}
}
Update at 2006-09-09 20:13 +0900: updated patch again, added prepare_query_parameters fixes for query_parameters.
Comments
порно онлайн, смотреть порно ролики онлайн, порно видео бесплатно, скачать порно бесплатно
смотреть порно онлайн, порно видео ролики скачать бесплатно, бесплатное порно онлайн, бесплатные порно ролики
скачать порно бесплатно, порно ролики онлайн, порно видео бесплатное