in reply to Re: Re: Re: HTTP::Daemon aborting in send_status_line?
in thread HTTP::Daemon aborting in send_status_line?

I'll post some more tomorrow when I get in to work.
As far as the 'blocking' goes I don't see how that can be. The program does not hang (block) on the print statement, it stops at it (dies without raising an exception).
I'll also try putting the client file handle on a select and see if it can_write.
  • Comment on Re: Re: Re: Re: HTTP::Daemon aborting in send_status_line?

Replies are listed 'Best First'.
Re(5): HTTP::Daemon aborting in send_status_line?
by bart (Canon) on Apr 23, 2004 at 08:44 UTC
    The program does not hang (block) on the print statement, it stops at it (dies without raising an exception).
    Perhaps you're getting a "broken pipe" exception. Quote from Lincoln Stein's book "Network Programming in Perl":
    The PIPE signal is sent when a program writes to a pipe or socket but the process at the remote end has either exited or closed the pipe.

    Try setting a $SIG{PIPE} handler to an error reporting sub.

      GOOD catch!

      I put a sigpipe handler in and voila!
      no more ugly program aborting

      thanks

      sub send_http_resp { print "$$ begin: send_http_resp\n" if $verbose; my ($client, $content) = @_; local $SIG{PIPE} = sub { print "$$ SIGPIPE\n" }; eval { my $header = HTTP::Headers->new('Content-Type' => 'text/xml; cha +rset=utf-8'); print "$$ send_http_resp : created a new HTTP::Headers object\n" + if $verbose; my $response = HTTP::Response->new(200, 'OK', $header, $content) +; print "$$ send_http_resp : created a new HTTP::Response object\n +" if $verbose; $client->send_response($response); print "$$ send_http_resp OK\n" if $verbose; }; if ($@) { print "$$ caught http exception: $@\n" if $verbose; } print "$$ end: send_http_resp\n" if $verbose; }