diff options
author | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-19 18:59:58 +0000 |
---|---|---|
committer | Ton Voon <tonvoon@users.sourceforge.net> | 2006-10-19 18:59:58 +0000 |
commit | 58ea98cc817d1d9c34b4895a8c828df6764e68a7 (patch) | |
tree | bf28f5ba0567f707a1494b1f7bd7ff757adf39ab | |
parent | d15721d2f8a26cd01259931cca5b3c00a6f77b6c (diff) | |
download | monitoring-plugins-58ea98cc817d1d9c34b4895a8c828df6764e68a7.tar.gz |
Redirection error if other headers beginning with L (Aravind Gottipati - 1562572)
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1502 f882894a-f735-0410-b71e-b25c423dba1c
-rw-r--r-- | THANKS.in | 1 | ||||
-rw-r--r-- | plugins/check_http.c | 5 | ||||
-rw-r--r-- | plugins/t/check_http.t | 6 |
3 files changed, 8 insertions, 4 deletions
@@ -193,3 +193,4 @@ Mike Emigh | |||
193 | Christian Mies | 193 | Christian Mies |
194 | Andreas Behal | 194 | Andreas Behal |
195 | O'Shaughnessy Evans | 195 | O'Shaughnessy Evans |
196 | Aravind Gottipati | ||
diff --git a/plugins/check_http.c b/plugins/check_http.c index 6810f5c1..93a68ef1 100644 --- a/plugins/check_http.c +++ b/plugins/check_http.c | |||
@@ -1094,9 +1094,8 @@ redir (char *pos, char *status_line) | |||
1094 | die (STATE_UNKNOWN, _("Could not allocate url\n")); | 1094 | die (STATE_UNKNOWN, _("Could not allocate url\n")); |
1095 | 1095 | ||
1096 | while (pos) { | 1096 | while (pos) { |
1097 | 1097 | sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i); | |
1098 | if (sscanf (pos, "%[Ll]%*[Oo]%*[Cc]%*[Aa]%*[Tt]%*[Ii]%*[Oo]%*[Nn]:%n", xx, &i) < 1) { | 1098 | if (i == 0) { |
1099 | |||
1100 | pos += (size_t) strcspn (pos, "\r\n"); | 1099 | pos += (size_t) strcspn (pos, "\r\n"); |
1101 | pos += (size_t) strspn (pos, "\r\n"); | 1100 | pos += (size_t) strspn (pos, "\r\n"); |
1102 | if (strlen(pos) == 0) | 1101 | if (strlen(pos) == 0) |
diff --git a/plugins/t/check_http.t b/plugins/t/check_http.t index 4e3c06cb..21ac0f7a 100644 --- a/plugins/t/check_http.t +++ b/plugins/t/check_http.t | |||
@@ -9,7 +9,7 @@ use strict; | |||
9 | use Test::More; | 9 | use Test::More; |
10 | use NPTest; | 10 | use NPTest; |
11 | 11 | ||
12 | plan tests => 21; | 12 | plan tests => 22; |
13 | 13 | ||
14 | my $successOutput = '/OK.*HTTP.*second/'; | 14 | my $successOutput = '/OK.*HTTP.*second/'; |
15 | 15 | ||
@@ -95,3 +95,7 @@ like ( $res->output, "/pattern found/", "Error message says 'pattern found'"); | |||
95 | 95 | ||
96 | $res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs' --invert-regex" ); | 96 | $res = NPTest->testCmd( "./check_http -H altinity.com -r 'nAGiOs' --invert-regex" ); |
97 | cmp_ok( $res->return_code, "==", 0, "And also when not found"); | 97 | cmp_ok( $res->return_code, "==", 0, "And also when not found"); |
98 | |||
99 | $res = NPTest->testCmd( "./check_http -H www.worldfirefoxday.com -f follow" ); | ||
100 | is( $res->return_code, 0, "Redirection based on location is okay"); | ||
101 | |||