From 1f9ef66e4f024e1e44c088ca02dd1af81e452a5c Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 9 Apr 2020 19:49:11 +0000 Subject: [PATCH] Revert "Bug 24719: Remove use of CGI object in C4::Context::set_remote_address()" This reverts commit d8cb07d6658850a84f125956d6f058a1fa72de74. Signed-off-by: Lucas Gass --- C4/Context.pm | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/C4/Context.pm b/C4/Context.pm index 9eea861c34..fa612472f7 100644 --- a/C4/Context.pm +++ b/C4/Context.pm @@ -1078,25 +1078,6 @@ sub temporary_directory { return C4::Context->config('tmp_path') || File::Spec->tmpdir; } -=head3 set_remote_address - -set_remote_address should be called at the beginning of every script -that is *not* running under plack in order to the REMOTE_ADDR environment -variable to be set correctly. - -=cut - -sub set_remote_address { - if ( C4::Context->config('koha_trusted_proxies') ) { - require CGI; - my $header = CGI->http('HTTP_X_FORWARDED_FOR'); - - if ($header) { - require Koha::Middleware::RealIP; - $ENV{REMOTE_ADDR} = Koha::Middleware::RealIP::get_real_ip( $ENV{REMOTE_ADDR}, $header ); - } - } -} 1; -- 2.39.2