Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Catalyst: Users
Incorrect $c->req->base using Catalyst::Engine::SCGI on Win32
 

Index | Next | Previous | View Flat


wdhawes at gmail

Jun 24, 2009, 8:44 AM


Views: 645
Permalink
Incorrect $c->req->base using Catalyst::Engine::SCGI on Win32

I've noticed that $c->req->base is set incorrectly on Win32 using the
newly released Catalyst::Engine::SCGI.

Steps to reproduce:

catalyst.pl MyApp
cd MyApp
perl script\myapp_create.pl SCGI
perl script\myapp_scgi.pl

Start Apache with the following configuration:

LoadModule scgi_module modules/mod_scgi.so
<VirtualHost *>
SCGIMount / 127.0.0.1:9000
</VirtualHost>

Add the following methods to MyApp::Controller::Root:

sub action :Global {
my( $self, $c ) = @_;
die $c->uri_for( $c->action );
}

sub Catalyst::Engine::SCGI::prepare_path {
my( $self, $c ) = @_;
my $env = $self->env;
use Data::Dumper;
warn Dumper $env;
return $self->next::method( $c );
}

Visit http://localhost/action in a browser.

>From a combination of the debug screen in the browser and the server
output, I can see the following under Apache 2.0 on Win32 (observed on
2 machines):

PATH_INFO - /action
SCRIPT_NAME - /action
$c->req->base - http://localhost/action/
$c->uri_for( $c->action ) - http://localhost/action/action

I don't think the SCRIPT_NAME header should contain anything. Under
Apache 2.2 on Ubuntu 9.04, I see the behaviour I expected:

PATH_INFO - /action
SCRIPT_NAME - (not present)
$c->req->base - http://localhost/
$c->uri_for( $c->action ) - http://localhost/action

The old Catalyst::Engine::SCGI code addressed this kind of issue in
its prepare_path method. Not sure if that's still the recommended way
(that method has been removed from the CPAN release), but perhaps
something like the following would be sufficient (untested):

sub prepare_path {
my( $self, $c ) = @_;
my $env = $self->env;
if( $env->{PATH_INFO} && $env->{SCRIPT_NAME} && $env->{PATH_INFO}
eq $env->{SCRIPT_NAME} ) {
delete $env->{SCRIPT_NAME};
}
return $self->next::method( $c );
}

_______________________________________________
List: Catalyst[at]lists.scsys.co.uk
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst[at]lists.scsys.co.uk/
Dev site: http://dev.catalyst.perl.org/

Subject User Time
Incorrect $c->req->base using Catalyst::Engine::SCGI on Win32 wdhawes at gmail Jun 24, 2009, 8:44 AM
    Re: Incorrect $c->req->base using Catalyst::Engine::SCGI on Win32 ovazquez at gmail Jun 28, 2009, 12:41 PM
        Re: Re: Incorrect $c->req->base using Catalyst::Engine::SCGI on Win32 bobtfish at bobtfish Jun 28, 2009, 1:19 PM
        Re: Re: Incorrect $c->req->base using Catalyst::Engine::SCGI on Win32 bobtfish at bobtfish Jul 11, 2009, 5:34 PM
    Re: Incorrect $c->req->base using Catalyst::Engine::SCGI on Win32 wdhawes at gmail Jun 30, 2009, 6:51 AM

  Index | Next | Previous | View Flat
 
 


Interested in having your list archived? Contact lists@gossamer-threads.com
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.