chiark / gitweb /
Fix dictionary-update-receiver to cope with new cgi_get_caller
[ypp-sc-tools.db-test.git] / yarrg / Commods.pm
index 67277c20b78387e799079c83bef50511df4b2293..b670f58a0c5245c12a9f0d14082ae8c437a583d5 100644 (file)
@@ -40,7 +40,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();
@@ -332,4 +332,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;