summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--THANKS.in1
-rw-r--r--plugins/check_http.c4
-rwxr-xr-xplugins/tests/check_http.t31
4 files changed, 34 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 01e8663a..670e4766 100644
--- a/NEWS
+++ b/NEWS
@@ -13,6 +13,7 @@ This file documents the major additions and syntax changes between releases.
13 Fixed segfault in extra-opts under some circumstance when reading multiple sections 13 Fixed segfault in extra-opts under some circumstance when reading multiple sections
14 Fix long options parsing in check_tcp 14 Fix long options parsing in check_tcp
15 check_icmp now reports min and max round trip time perfdata (Steve Rader) 15 check_icmp now reports min and max round trip time perfdata (Steve Rader)
16 Fixed bug where additional headers with redirection caused a segfault (Dieter Van de Walle - 2089159)
16 17
171.4.13 25th Sept 2008 181.4.13 25th Sept 2008
18 Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen) 19 Fix Debian bug #460097: check_http --max-age broken (Hilko Bengen)
diff --git a/THANKS.in b/THANKS.in
index b042f9e7..1835e614 100644
--- a/THANKS.in
+++ b/THANKS.in
@@ -241,3 +241,4 @@ Erik Wasser
241Tilman Koschnick 241Tilman Koschnick
242Olivier 'Babar' Raginel 242Olivier 'Babar' Raginel
243Steve Rader 243Steve Rader
244Dieter Van de Walle
diff --git a/plugins/check_http.c b/plugins/check_http.c
index df5daf2d..0746741c 100644
--- a/plugins/check_http.c
+++ b/plugins/check_http.c
@@ -815,7 +815,9 @@ check_http (void)
815 for ((pos = strtok(http_opt_headers[i], INPUT_DELIMITER)); pos; (pos = strtok(NULL, INPUT_DELIMITER))) 815 for ((pos = strtok(http_opt_headers[i], INPUT_DELIMITER)); pos; (pos = strtok(NULL, INPUT_DELIMITER)))
816 asprintf (&buf, "%s%s\r\n", buf, pos); 816 asprintf (&buf, "%s%s\r\n", buf, pos);
817 } 817 }
818 free(http_opt_headers); 818 /* This cannot be free'd here because a redirection will then try to access this and segfault */
819 /* Covered in a testcase in tests/check_http.t */
820 /* free(http_opt_headers); */
819 } 821 }
820 822
821 /* optionally send the authentication info */ 823 /* optionally send the authentication info */
diff --git a/plugins/tests/check_http.t b/plugins/tests/check_http.t
index d54932e6..c5f90803 100755
--- a/plugins/tests/check_http.t
+++ b/plugins/tests/check_http.t
@@ -28,7 +28,8 @@ if ($pid) {
28 #print "child\n"; 28 #print "child\n";
29 29
30 my $d = HTTP::Daemon->new( 30 my $d = HTTP::Daemon->new(
31 LocalPort => $port 31 LocalPort => $port,
32 LocalAddr => "127.0.0.1",
32 ) || die; 33 ) || die;
33 print "Please contact me at: <URL:", $d->url, ">\n"; 34 print "Please contact me at: <URL:", $d->url, ">\n";
34 while (my $c = $d->accept ) { 35 while (my $c = $d->accept ) {
@@ -57,6 +58,12 @@ if ($pid) {
57 $c->send_basic_header; 58 $c->send_basic_header;
58 $c->send_crlf; 59 $c->send_crlf;
59 $c->send_response($r->method.":".$r->content); 60 $c->send_response($r->method.":".$r->content);
61 } elsif ($r->url->path eq "/redirect") {
62 $c->send_redirect( "/redirect2" );
63 } elsif ($r->url->path eq "/redirect2") {
64 $c->send_basic_header;
65 $c->send_crlf;
66 $c->send_response("redirected");
60 } else { 67 } else {
61 $c->send_error(RC_FORBIDDEN); 68 $c->send_error(RC_FORBIDDEN);
62 } 69 }
@@ -73,7 +80,7 @@ if ($ARGV[0] && $ARGV[0] eq "-d") {
73} 80}
74 81
75if (-x "./check_http") { 82if (-x "./check_http") {
76 plan tests => 39; 83 plan tests => 47;
77} else { 84} else {
78 plan skip_all => "No check_http compiled"; 85 plan skip_all => "No check_http compiled";
79} 86}
@@ -180,3 +187,23 @@ $result = NPTest->testCmd( $cmd );
180is( $result->return_code, 0, $cmd); 187is( $result->return_code, 0, $cmd);
181like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output ); 188like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - ([\d\.]+) second/', "Output correct: ".$result->output );
182 189
190$cmd = "$command -u /redirect";
191$result = NPTest->testCmd( $cmd );
192is( $result->return_code, 0, $cmd);
193like( $result->output, '/^HTTP OK - HTTP/1.1 301 Moved Permanently - [\d\.]+ second/', "Output correct: ".$result->output );
194
195$cmd = "$command -f follow -u /redirect";
196$result = NPTest->testCmd( $cmd );
197is( $result->return_code, 0, $cmd);
198like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 183 bytes in [\d\.]+ second/', "Output correct: ".$result->output );
199
200$cmd = "$command -u /redirect -k 'follow: me'";
201$result = NPTest->testCmd( $cmd );
202is( $result->return_code, 0, $cmd);
203like( $result->output, '/^HTTP OK - HTTP/1.1 301 Moved Permanently - [\d\.]+ second/', "Output correct: ".$result->output );
204
205$cmd = "$command -f follow -u /redirect -k 'follow: me'";
206$result = NPTest->testCmd( $cmd );
207is( $result->return_code, 0, $cmd);
208like( $result->output, '/^HTTP OK HTTP/1.1 200 OK - 183 bytes in [\d\.]+ second/', "Output correct: ".$result->output );
209