Subject: | HTTP server doesn't process PIPE signal |
If server process long request and clients gone in that time, server
crashes when trying to send reply to client.
attached patch ignoring sigpipe during writing response.
Subject: | HTTP.pm.diff |
--- /home/sk/tmp/SOAP-Lite-0.714/lib/SOAP/Transport/HTTP.pm 2011-08-18 22:48:33.000000000 +0300
+++ HTTP.pm 2012-02-15 10:06:50.578251970 +0300
@@ -691,7 +691,13 @@
while ( my $r = $c->get_request ) {
$self->request($r);
$self->SUPER::handle;
- $c->send_response( $self->response );
+ eval {
+ local $SIG{PIPE} = sub {die "SIGPIPE"};
+ $c->send_response( $self->response );
+ };
+ if ($@ && $@ !~ /^SIGPIPE/) {
+ die $@;
+ }
}
# replaced ->close, thanks to Sean Meisner <Sean.Meisner@VerizonWireless.com>