leejo / cgi-fast

The new home for CGI::Fast, removing it from the original CGI.pm distribution
4 stars 5 forks source link

socket permissions #8

Closed powerman closed 9 years ago

powerman commented 9 years ago

With CGI::Fast-1.10 fastcgi socket was created while use CGI::Fast, so this works:

use CGI::Fast;
chmod 0666, $ENV{FCGI_SOCKET_PATH} or die "chmod: $!";

But with CGI::Fast-2.05 fastcgi socket is created while calling CGI::Fast->new() for the first time, which result in needs in ugly workaround like this:

my $umask = umask 0;
while (CGI::Fast->new()) {
    umask $umask;
    ...
}

Can you please provide some more reasonable way to set socket permissions, without changing umask for unknown amount of code executed while CGI::Fast->new with ugly restoring it to previous value (probably already incorrect in case CGI has changed umask while processing incoming request for it's own needs) on each incoming request.

leejo commented 9 years ago

Can you have a go at a fork/fix/PR for this?

powerman commented 9 years ago

Sure, but there are many ways to implement this and I'm not sure which one you'll prefer. I propose this interface:

use CGI::Fast
    socket_path  => '9000',
    socket_perm  => 0666,
    listen_queue => 50;

If you like this - I'll make PR.

leejo commented 9 years ago

I propose this interface

Seems sensible to me, and fits with the existing interface, so go ahead. Cheers!

leejo commented 9 years ago

Closing, see #9