diff options
Diffstat (limited to 'plugins/tests/check_curl.t')
-rwxr-xr-x | plugins/tests/check_curl.t | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/plugins/tests/check_curl.t b/plugins/tests/check_curl.t index aa72ef6..72f2b7c 100755 --- a/plugins/tests/check_curl.t +++ b/plugins/tests/check_curl.t | |||
@@ -21,7 +21,7 @@ use FindBin qw($Bin); | |||
21 | 21 | ||
22 | $ENV{'LC_TIME'} = "C"; | 22 | $ENV{'LC_TIME'} = "C"; |
23 | 23 | ||
24 | my $common_tests = 72; | 24 | my $common_tests = 73; |
25 | my $ssl_only_tests = 8; | 25 | my $ssl_only_tests = 8; |
26 | # Check that all dependent modules are available | 26 | # Check that all dependent modules are available |
27 | eval "use HTTP::Daemon 6.01;"; | 27 | eval "use HTTP::Daemon 6.01;"; |
@@ -200,6 +200,14 @@ sub run_server { | |||
200 | $c->send_basic_header; | 200 | $c->send_basic_header; |
201 | $c->send_crlf; | 201 | $c->send_crlf; |
202 | $c->send_response(HTTP::Response->new( 200, 'OK', undef, $r->header ('Host'))); | 202 | $c->send_response(HTTP::Response->new( 200, 'OK', undef, $r->header ('Host'))); |
203 | } elsif ($r->url->path eq "/chunked") { | ||
204 | my $chunks = ["chunked", "encoding", "test\n"]; | ||
205 | $c->send_response(HTTP::Response->new( 200, 'OK', undef, sub { | ||
206 | my $chunk = shift @{$chunks}; | ||
207 | return unless $chunk; | ||
208 | sleep(1); | ||
209 | return($chunk); | ||
210 | })); | ||
203 | } else { | 211 | } else { |
204 | $c->send_error(HTTP::Status->RC_FORBIDDEN); | 212 | $c->send_error(HTTP::Status->RC_FORBIDDEN); |
205 | } | 213 | } |
@@ -472,7 +480,8 @@ sub run_common_tests { | |||
472 | local $SIG{ALRM} = sub { die "alarm\n" }; | 480 | local $SIG{ALRM} = sub { die "alarm\n" }; |
473 | alarm(2); | 481 | alarm(2); |
474 | $result = NPTest->testCmd( $cmd ); | 482 | $result = NPTest->testCmd( $cmd ); |
475 | alarm(0); }; | 483 | }; |
484 | alarm(0); | ||
476 | isnt( $@, "alarm\n", $cmd ); | 485 | isnt( $@, "alarm\n", $cmd ); |
477 | is( $result->return_code, 0, $cmd ); | 486 | is( $result->return_code, 0, $cmd ); |
478 | 487 | ||
@@ -482,7 +491,8 @@ sub run_common_tests { | |||
482 | local $SIG{ALRM} = sub { die "alarm\n" }; | 491 | local $SIG{ALRM} = sub { die "alarm\n" }; |
483 | alarm(2); | 492 | alarm(2); |
484 | $result = NPTest->testCmd( $cmd ); | 493 | $result = NPTest->testCmd( $cmd ); |
485 | alarm(0); }; | 494 | }; |
495 | alarm(0); | ||
486 | isnt( $@, "alarm\n", $cmd ); | 496 | isnt( $@, "alarm\n", $cmd ); |
487 | isnt( $result->return_code, 0, $cmd ); | 497 | isnt( $result->return_code, 0, $cmd ); |
488 | 498 | ||
@@ -508,4 +518,9 @@ sub run_common_tests { | |||
508 | }; | 518 | }; |
509 | is( $@, "", $cmd ); | 519 | is( $@, "", $cmd ); |
510 | 520 | ||
521 | $cmd = "$command -u /chunked -s 'chunkedencodingtest' -d 'Transfer-Encoding: chunked'"; | ||
522 | eval { | ||
523 | $result = NPTest->testCmd( $cmd, 5 ); | ||
524 | }; | ||
525 | is( $@, "", $cmd ); | ||
511 | } | 526 | } |