On Sat, 15 Sep 2001, Geoffrey Young wrote:
> >> my $fileno = $r->connection->fileno;
> >> $s = IO::Select->new($fileno);
> >>
> >> die "aborted" if grep { m/$fileno/ } $s->can_read(1);
>
> >Hmm, does this actually work Geoff? What happens if mod_perl is running
> >as a back-end? In this case $r->connection->aborted doesn't work even if
> >you print.
>
> yes, it worked for me. actually, I guess I should have been clearer - this
> has nothing to do with $c->aborted or $r->print (well, on the outside
> anyway). for $c->aborted you have to wait for Apache to flush the print
> buffers. actually, in my tests $r->rflush didn't help things behave - only
> $|=1 did.
>
> $s->can_read should always work because Apache marks the client output file
> descriptor with a zero-length packet for reading when the client dies. so,
> when you can read from where you ought to be writing, you can assume a
> broken connection.
>
> at least this is my understanding. wish I could take credit, though - Eric
> discovered/documented this one a while ago:)
cool! Somehow I've missed this patch.
> at any rate, this worked for me just fine in some tests, but I never tested
> it against a front-end/back-end setup. seems like you would never be able
> to detect a broken client connection from in a proxy setup anyway, but
> that's not my area to comment on...
I'll give it a run when I get some time to play with it and update the
guide appropriately.
Thanks Geoff!
_____________________________________________________________________
Stas Bekman JAm_pH -- Just Another mod_perl Hacker
http://stason.org/ mod_perl Guide http://perl.apache.org/guide
mailto:[EMAIL PROTECTED] http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/