ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/Coro/myhttpd/err.pl
(Generate patch)

Comparing Coro/myhttpd/err.pl (file contents):
Revision 1.1 by root, Sun Aug 26 14:55:46 2001 UTC vs.
Revision 1.2 by root, Sun Sep 2 02:27:51 2001 UTC

92} 92}
93 93
94sub conn::err_blocked { 94sub conn::err_blocked {
95 my $self = shift; 95 my $self = shift;
96 my $ip = $self->{remote_addr}; 96 my $ip = $self->{remote_addr};
97 my $ctime = $HTTP_NOW;
97 my $time = time2str $conn::blocked{$ip} = $::NOW + $::BLOCKTIME; 98 my $etime = time2str $conn::blocked{$ip} = $::NOW + $::BLOCKTIME;
98 99
99 Coro::Event::do_timer(after => 20*rand); 100 Coro::Event::do_timer(after => 20*rand);
100 101
101 $self->err(401, "too many connections", 102 $self->err(401, "too many connections",
102 { 103 {
103 "Content-Type" => "text/html", 104 "Content-Type" => "text/html",
104 "Retry-After" => $::BLOCKTIME, 105 "Retry-After" => $::BLOCKTIME,
105 "Warning" => "Please do NOT retry, you have been blocked", 106 "Warning" => "Please do NOT retry, you have been blocked. Press Cancel instead.",
106 "WWW-Authenticate" => "Basic realm=\"Please do NOT retry, you have been blocked\"", 107 "WWW-Authenticate" => "Basic realm=\"Please do NOT retry, you have been blocked. Press Cancel instead.\"",
107 "Connection" => "close", 108 "Connection" => "close",
108 }, 109 },
109 <<EOF); 110 <<EOF);
110<html> 111<html>
111<head> 112<head>
114<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000080" alink="#ff0000"> 115<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#000080" alink="#ff0000">
115 116
116<p>You have been blocked because you opened too many connections. You 117<p>You have been blocked because you opened too many connections. You
117may retry at</p> 118may retry at</p>
118 119
119 <p><blockquote>$time.</blockquote></p> 120 <p><blockquote>$etime.</blockquote></p>
121
122<p>For your reference, the current time is:</p>
123
124 <p><blockquote>$ctime.</blockquote></p>
120 125
121<p>Until then, each new access will renew the block. You might want to have a 126<p>Until then, each new access will renew the block. You might want to have a
122look at the <a href="http://www.goof.com/pcg/marc/animefaq.html#connectionlimit">FAQ</a>.</p> 127look at the <a href="http://www.goof.com/pcg/marc/animefaq.html#blocked">FAQ</a>.</p>
123 128
124</body></html> 129</body></html>
125EOF 130EOF
126} 131}
127 132

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines