From aceb48f1503b86e4a4c5544687da53e3063e192a Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Wed, 10 Jul 2024 15:07:22 +0000 Subject: [PATCH] Bug 37308: Add user-agent for SUSHI outgoing requests Signed-off-by: Belal Ahmadi Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer (cherry picked from commit 8175cccca2f7f28c68445e702ec40c200010211c) Signed-off-by: Lucas Gass --- Koha/ERM/EUsage/UsageDataProvider.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Koha/ERM/EUsage/UsageDataProvider.pm b/Koha/ERM/EUsage/UsageDataProvider.pm index 28a6461935..1f2f7de9a3 100644 --- a/Koha/ERM/EUsage/UsageDataProvider.pm +++ b/Koha/ERM/EUsage/UsageDataProvider.pm @@ -27,6 +27,7 @@ use Koha::Exceptions; use base qw(Koha::Object); +use Koha; use Koha::ERM::EUsage::CounterFile; use Koha::ERM::EUsage::CounterFiles; use Koha::ERM::EUsage::UsageTitles; @@ -176,6 +177,7 @@ sub harvest_sushi { my $url = $self->_build_url_query; my $request = HTTP::Request->new( 'GET' => $url ); my $ua = LWP::UserAgent->new; + $ua->agent( 'Koha/' . Koha::version() ); my $response = $ua->simple_request($request); if ( $response->code >= 400 ) { @@ -279,6 +281,7 @@ sub test_connection { my $request = HTTP::Request->new( 'GET' => $url ); my $ua = LWP::UserAgent->new; + $ua->agent( 'Koha/' . Koha::version() ); my $response = $ua->simple_request($request); if ( $response->{_rc} >= 400 ) { -- 2.39.5