Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Directory
dnmvisser
bydnmvisser, November 23, 2018
If the webserver that hosts your XML file supports ETag, then you can speed up things by using that caching mechanism. This is most noticeable with large XML files (such as eduGAIN metadata). I was a fairly trivial patch:
--- check_http_xpath.pl 2018-11-23 16:07:33.521799526 +0100
+++ test.pl 2018-11-24 00:27:34.848817509 +0100
@@ -27,6 +27,7 @@
use Getopt::Std;
use XML::XPath;
use Data::Dumper;
+use HTTP::Cache::Transparent;
my %optarg;
my $getopt_result;
@@ -294,6 +295,10 @@
$lwp_user_agent->default_header('Host' => "$host:$port");
}
+HTTP::Cache::Transparent::init( {
+ BasePath => '/tmp/cache',
+ } );
+
$url = "$http://${host_ip}:${port}$uri";
$http_request = HTTP::Request->new(GET => $url);
--- check_http_xpath.pl 2018-11-23 16:07:33.521799526 +0100
+++ test.pl 2018-11-24 00:27:34.848817509 +0100
@@ -27,6 +27,7 @@
use Getopt::Std;
use XML::XPath;
use Data::Dumper;
+use HTTP::Cache::Transparent;
my %optarg;
my $getopt_result;
@@ -294,6 +295,10 @@
$lwp_user_agent->default_header('Host' => "$host:$port");
}
+HTTP::Cache::Transparent::init( {
+ BasePath => '/tmp/cache',
+ } );
+
$url = "$http://${host_ip}:${port}$uri";
$http_request = HTTP::Request->new(GET => $url);