Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FastCGI not compatible with Carp fatalsToBrowser?

Tags:

perl

fastcgi

I am developing a Perl script using FastCGI (using CGI::Fast and CGI::Carp 'fatalsToBrowser').
When my script has compile errors, it causes the browser to hang. It seems that fatalsToBrowser is not working the way it does with normal CGI (just send the compile errors to the browser). How can I fix this?

like image 319
JoelFan Avatar asked Dec 06 '25 23:12

JoelFan


2 Answers

I can not offer you a workaround but only an explanation, FastCGI works completely differently. When a CGI application is executed standard descriptors and environ is provided before execution, in a FastCGI application the server (application) must first accept a connection from the client (usually webserver) and exchange a few messages/records before a request is accepted and response can be sent. CGI::Carp does it's magic during perl's compile phase and assumes that standard descriptors is available when the syntax error occurs (compile phase) and that is to early for CGI::Fast.pm.

I'm one of the maintainers of FCGI.pm(and libfcgi) so I'll work with the CGI maintainers to get this resolved.

like image 151
chansen Avatar answered Dec 08 '25 16:12

chansen


I'm the CGI.pm maintainer. I would recommend avoiding using 'fatalsToBrowser' in this case. Some Perl frameworks over features which do the same thing. For example, with CGI::Application there is CGI::Application::Plugin::DebugScreen. Other frameworks have something similar.

In other cases, the popular 'Carp' and 'CGI::Carp' modules can conflict if they both end up imported in the same name space, because they both provide functions with the same names, like 'carp' and 'croak'. I recommend using Carp and avoiding CGI::Carp.

like image 32
Mark Stosberg Avatar answered Dec 08 '25 14:12

Mark Stosberg



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!