问题
What does happen with Apache (or Nginx) running a CGI script when the client (I mean a browser or a TCP gateway) disconnects in the middle?
Does Apache/Nginx log an error? (If yes, which one and where?)
Is the CGI script sent SIGPIPE to?
回答1:
There is no SIGPIPE when Apache CGI script is interrupted.
Tested with the following code:
#!/usr/bin/perl
use strict;
use warnings;
$| = 1;
#$SIG{PIPE} = "IGNORE";
$SIG{PIPE} = sub {
open my $f, '>', 'log.txt';
print $f "PIPE: $ENV{SERVER_NAME}\n";
close $f;
};
print "Content-Type: text/plain\n\n";
sleep 10;
print "OK";
来源:https://stackoverflow.com/questions/52236675/cgi-from-apache-broken-pipe