X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~yarrgweb/git?a=blobdiff_plain;f=yarrg%2FCommods.pm;h=5003037b1389b4cede801a2300dea6e99be69c42;hb=847492a8eebac261fb3ffa5e97391b486a73d336;hp=62c1f5e6e94dd21d468d19923d5ea3e4840a7dbd;hpb=a0dfb8222afa87d6fabaa8234da89e2a1b57ea5a;p=ypp-sc-tools.web-live.git diff --git a/yarrg/Commods.pm b/yarrg/Commods.pm index 62c1f5e..5003037 100644 --- a/yarrg/Commods.pm +++ b/yarrg/Commods.pm @@ -41,7 +41,7 @@ BEGIN { &pipethrough_prep &pipethrough_run &pipethrough_run_along &pipethrough_run_finish &pipethrough_run_gzip - &cgipostform &yarrgpostform); + &cgipostform &yarrgpostform &cgi_get_caller); %EXPORT_TAGS = ( ); @EXPORT_OK = qw(); @@ -340,4 +340,17 @@ sub check_tsv_line ($$) { return @v; } +sub cgi_get_caller () { + my $caller= $ENV{'REMOTE_ADDR'}; + $caller= 'LOCAL' unless defined $caller; + + my $fwdf= $ENV{'HTTP_X_FORWARDED_FOR'}; + if (defined $fwdf) { + $fwdf =~ s/\s//g; + $fwdf =~ s/[^0-9.,]/?/g; + $caller= "$fwdf"; + } + return $caller; +} + 1;