summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'probe-mirmon')
-rwxr-xr-xprobe-mirmon23
1 files changed, 10 insertions, 13 deletions
diff --git a/probe-mirmon b/probe-mirmon
index 1e10ef1..5d99cda 100755
--- a/probe-mirmon
+++ b/probe-mirmon
@@ -53,19 +53,16 @@ sub handle_libcurl {
my $retcode = $curl->perform;
# Looking at the results...
- if ($retcode == 0) {
- #print("Transfer went ok\n");
- my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE);
- # judge result and next action based on $response_code
- #print("Received response: $response_code $response_body\n");
- chomp $response_body;
- #print("s='$response_body'\n");
- print(munge_date($response_body), "\n");
- } else {
- # Error code, type of error, error message
- #print("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n");
- exit 800;
- }
+ exit 800 unless ($retcode == 0);
+
+ my $response_code = $curl->getinfo(CURLINFO_HTTP_CODE);
+ exit 801 unless ($response_code == 200)
+ exit 802 unless defined($response_body);
+ chomp $response_body;
+ print(munge_date($response_body), "\n");
+
+ exit 0;
+ #print("An error happened: $retcode ".$curl->strerror($retcode)." ".$curl->errbuf."\n");
}