Re: Perl DBI::Pg - Stop button

Поиск
Список
Период
Сортировка
От Lincoln Yeoh
Тема Re: Perl DBI::Pg - Stop button
Дата
Msg-id 5.2.1.1.1.20030508235456.033ebe38@mbox.jaring.my
обсуждение исходный текст
Ответ на Re: Perl DBI::Pg - Stop button  (Richard Huxton <dev@archonet.com>)
Список pgsql-general
I don't see why HTTP being a stateless protocol should mean that an app
can't tell if a user disconnects from the webserver. The webserver in most
cases knows reasonably promptly, and the other cases after a timeout. If
that were not possible, webservers would be wasting a lot of resources by
keeping them around long after disconnects.

 From my dim memory, if you are using CGI and Apache, when the stop button
is hit and when you try to print something, you get a SIGTERM and possibly
a SIGPIPE (but your app could be dead by then :) ). Plus the print returns
false if you are still around.

If you are using Modperl and Apache >=1.3.6, when the stop button is hit,
and you try to print something, you get a SIGPIPE, and the print returns a
false. I don't think you get a SIGTERM.

AFAIK the print doesn't return a false immediately even if you turn off
buffering, so expect a delay in detection - depends on how much and how
often you print (not sure if you can change this, e.g. tcp options etc).

If you are using FCGI (at least the versions I tested), when the stop
button is hit, and you try to print something, you don't get a SIGPIPE, nor
does the print fail. So if you want to detect disconnections, you would
want to serve such requests with either CGI or modperl.

For mod_perl see:
http://perl.apache.org/docs/1.0/guide/debug.html#Handling_the__User_pressed_Stop_button__case

Your mileage may vary. Test first.

So far if I don't want to print anything but need to check if still
connected, print "\0" does what I want.

As for sending a cancel. I'm not sure how to do it with DBI::Pg. Would be
good to know.

Have a nice day,
Link.

At 07:32 AM 5/7/2003 +0100, Richard Huxton wrote:

>I think the thrust of Matt's question was whether there is any way to know
>when the user presses "stop" in their browser from the server end.
>Unfortunately, since HTTP is a stateless protocol, the short answer is no.
>
>This is of course simple if you have a java applet sitting on your page
>connecting to your server - it can signal out of band.
>
>[Not often I follow-up a post by Tom ;-]
>--
>   Richard Huxton
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 3: if posting/reading through Usenet, please send an appropriate
>subscribe-nomail command to majordomo@postgresql.org so that your
>message can get through to the mailing list cleanly


В списке pgsql-general по дате отправления:

Предыдущее
От: "scott.marlowe"
Дата:
Сообщение: Re: Creating functions and triggers
Следующее
От: "Johnson, Shaunn"
Дата:
Сообщение: interval function question