Skip Menu |

This queue is for tickets about the Web-Simple CPAN distribution.

Report information
The Basics
Id: 78110
Status: resolved
Priority: 0/
Queue: Web-Simple

People
Owner: Nobody in particular
Requestors: MITHALDU [...] cpan.org
Cc: s.priebe [...] profihost.ag
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



CC: s.priebe [...] profihost.ag
Subject: Failure in CGI/FCGI detection
Opening this as a ticket because it might need further discussion. Currently the detection mechanism looks like this: Web/Simple/Application.pm if ( $ENV{PHP_FCGI_CHILDREN} || $ENV{FCGI_ROLE} || $ENV{FCGI_SOCKET_PATH} || -S STDIN # STDIN is a socket, almost certainly FastCGI ) { return $self->_run_fcgi; } elsif ($ENV{GATEWAY_INTERFACE}) { return $self->_run_cgi; [...] However on our servers STDIN is a socket even for scripts accessed as CGI. There is however still a reliable way to detect them being run as CGI scripts, since %ENV contains this: 'GATEWAY_INTERFACE' => 'CGI/1.1', From what i can tell, the GATEWAY_INTERFACE env variable is set only for CGI, so pulling that check to the front of the if-chain should fix this. Are there any issues with this that i overlooked?
My immediate questions would be: 1) What does plack do? 2) Why can we not use/steal that? (i.e. why isn't this a plack bug). Further thinking to follow ;) ta t0m
As far as i am aware, Plack does nothing. Web::Simple does a little bit of heuristic to let you run it as CGI, FCGI, command line script or Plack app depending on how you call it and i haven't seen this in other web frameworks before. (Granted, i didn't look too hard.)
Alright, after some research, here's what i found: The Apache module mod_cgid is default in modern Apaches with multi-threaded MPM and opens STDIN as a Socket, so interpreting that fact to mean that we're under FastCGI works ONLY if $ENV{GATEWAY_INTERFACE} is not set. See: http://httpd.apache.org/docs/2.0/mod/mod_cgid.html Exception: Some nginx FastCGI configuration examples (probably as a result of copy/paste) instruct the user to set: $ENV{GATEWAY_INTERFACE} = "CGI 1.1" If anyone actually did that, FastCGI would be wrongly recognized as CGI in their case. See: http://wiki.nginx.org/FcgiExample ------ As such i've commited a change that should fix detection for mod_cgid: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/Web- Simple.git;a=commitdiff;h=7b930ebb30cddbb0133a0ad20e72d60a5eed5d19 Review of this and a speedy release would be much appreciated. :)