| 27/38 |
© 2004 by Philippe "BooK" Bruhat.
|
Once again, I use the query string to communicate with the proxy
Being nice to the server, the refresh interval grows after time...
# dragongoserver auto refresh # refresh quickly at first, then more slowly $proxy->push_filter( host => 'www.dragongoserver.net', path => '^/status.php', response => HTTP::Proxy::HeaderFilter::simple->new( sub { my ( $self, $headers, $response ) = @_; ($response->request->uri->query || '') =~ /goreload=(\d+)/; my $n = ($1 || 0) + 1; my $delay = $n < 5 ? 30 : $n < 15 ? 60 : $n < 25 ? 300 : 3600; $headers->push_header( Refresh => "$delay;url=" . $response->request->uri->path . "?goreload=$n" ); } ) );
So, after about one hour, the status page is only reloaded every hour.
When the user clicks on the "Status" link or when the server redirects to the original status page, the original URL is queried, thus restarting the counter