diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2018-05-21 17:40:41 +1200 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2018-05-21 17:40:41 +1200 |
commit | a7e394b68ed493f2168c78450e496644fe31490f (patch) | |
tree | cccdf7cf866c5c72d9ebc4c83934a797b86365e8 | |
parent | Bump VERSION (diff) | |
download | nagios-check-speedtest-servers-a7e394b68ed493f2168c78450e496644fe31490f.tar.gz nagios-check-speedtest-servers-a7e394b68ed493f2168c78450e496644fe31490f.zip |
Add support for compressed list request
-rwxr-xr-x | check_speedtest_servers | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/check_speedtest_servers b/check_speedtest_servers index 7148938..81c5b17 100755 --- a/check_speedtest_servers +++ b/check_speedtest_servers @@ -79,10 +79,14 @@ eval { # Build a user agent that accepts only XML my $ua = LWP::UserAgent->new(); - $ua->default_header( Accept => 'application/xml;text/xml' ); # Attempt to retrieve the server list - my $response = $ua->get($SERVERS_LIST_URL); + my $headers = HTTP::Headers->new( + 'Accept' => 'application/xml;text/xml', + 'Accept-Encoding' => scalar HTTP::Message::decodable(), + ); + my $request = HTTP::Request->new( 'GET', $SERVERS_LIST_URL, $headers ); + my $response = $ua->request($request); $response->is_success or die "$response->status_line\n"; |