From e0c3654e9e83473ac0b91857e2bf2987c88fb563 Mon Sep 17 00:00:00 2001 From: Dobrica Pavlinusic Date: Sat, 23 Oct 2010 18:46:55 +0200 Subject: [PATCH] allocate session just once this will prevent our denial of service against Aleph if we get too many requests (and since it's random number, I might as well used 42 for it) --- Aleph.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Aleph.pm b/Aleph.pm index c8e529a..6a3cf3c 100644 --- a/Aleph.pm +++ b/Aleph.pm @@ -59,13 +59,16 @@ sub usemap {{ # 1016 => '', }}; +our $session_id; sub search { my ( $self, $query ) = @_; die "need query" unless defined $query; - my $url = 'http://161.53.240.197:8991/F?RN=' . int rand(1000000000); + $session_id ||= int rand(1000000000); + # FIXME allocate session just once + my $url = 'http://161.53.240.197:8991/F?RN=' . $session_id; # fake JavaScript code on page which creates random session diag "get $url"; -- 2.20.1