[cgiapp] Moving to PSGI: Issues with $ENV
    Jiří Pavlovský 
    jira at getnet.cz
       
    Tue Oct 16 17:45:35 EDT 2012
    
    
  
On 16.10.2012 17:14, Mark Stosberg wrote:
>> However today I stumbled across an issue with
>> CGI::Application::Plugin::DetectAjax
>>
>>    my $header = 'HTTP_X_REQUESTED_WITH';
>>
>>    if (exists $ENV{$header} && lc $ENV{$header} eq 'xmlhttprequest') {
>>      return 1;
>>    }
>>    else {
>>      return 0;
>>    }
>>
>> This does not work under PSGI.
>>
>> Looking at CGI::PSGI the correct approach seems to be:
>>
>> $self->env->{$header}
>>
>> so a possible patch would look something like:
>>
>>    my $header = 'HTTP_X_REQUESTED_WITH';
>>
>>    my $header_value = $self->{__IS_PSGI} ? $self->env->{$header} : $ENV{$header};
>>
>>    if ($header_value && lc $header_value eq 'xmlhttprequest') {
>>      return 1;
>>    }
>>    else {
>>      return 0;
>>    }
>>
>> Can anyone help / confirm / improve on this?
Hi,
I'm a humble author of this humble plugin. If you have a patch, please 
send it to me.
Thanks,
Jiri
-- 
Jiří Pavlovský
    
    
More information about the cgiapp
mailing list