Re: Detection "connection reset by peer" in mod_perl before send a response

Andy Colson <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On 08/10/2013 06:54 AM, Lucas wrote:
> Dear all.
>
> I need to detect that user pressed escape, apache receives it like "connection reset by peer" (I saw it with truss, freebsd strace), before my script will send a response to client.
>
> I can explain: my script works some time (about 2-3 sec), it gathers some data. Within this period it is possible that user decide to press escape or even to close the page or browser.
>
> I need to detect it and clean some temporary files, what is normally happen by additional request from script on the page.
>
> I need your advice how to do it.
>
> Thanks.

I wrap an eval around it and ignore the error:

eval {
   $r->print($buf);
};

unlink($tempfiles);

-Andy
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.