SCRIPT_NAME is optional for handler

Avoid warning (#595)
This commit is contained in:
Xavier Guimard 2018-03-27 22:45:06 +02:00
parent ca93445c6f
commit e206be3322

View File

@ -23,11 +23,13 @@ sub BUILD {
sub new {
my $self = Plack::Request::new(@_);
my $tmp = $self->script_name;
$self->env->{REQUEST_URI} = $self->env->{X_ORIGINAL_URI}
if ( $self->env->{X_ORIGINAL_URI} );
$self->env->{PATH_INFO} =~ s|//+|/|g;
$self->env->{PATH_INFO} =~ s|^$tmp|/|;
if ( my $tmp = $self->script_name ) {
$self->env->{PATH_INFO} =~ s|^$tmp|/|;
}
$self->{uri} = uri_unescape( $self->env->{REQUEST_URI} );
$self->{uri} =~ s|//+|/|g;
$self->{datas} = {};