Browse Source

added tests for restarting fcgi-procs after they died

git-svn-id: svn://svn.lighttpd.net/lighttpd/trunk@64 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/tags/release-1.3.12
Jan Kneschke 17 years ago
parent
commit
5ca4dff14d
  1. 13
      tests/fastcgi-responder.conf
  2. 14
      tests/fcgi-responder.c
  3. 21
      tests/run-tests.pl

13
tests/fastcgi-responder.conf

@ -1,9 +1,12 @@
server.document-root = "/tmp/lighttpd/servers/www.example.org/pages/"
server.pid-file = "/tmp/lighttpd/lighttpd.pid"
debug.log-request-header = "enable"
debug.log-response-header = "enable"
debug.log-request-handling = "enable"
#debug.log-request-header = "enable"
#debug.log-response-header = "enable"
#debug.log-request-handling = "enable"
#debug.log-state-handling = "enable"
#fastcgi.debug = 1
## bind to port (default: 80)
server.port = 2048
@ -88,7 +91,9 @@ fastcgi.server = ( ".fcgi" => (
"host" => "192.168.0.2",
"port" => 1028,
"bin-path" => "./fcgi-responder",
"check-local" => "disable"
"check-local" => "disable",
"max-procs" => 1,
"min-procs" => 1
)
)
)

14
tests/fcgi-responder.c

@ -4,9 +4,12 @@
#include <string.h>
int main () {
char* p;
int num_requests = 2;
while (FCGI_Accept() >= 0) {
while (num_requests > 0 &&
FCGI_Accept() >= 0) {
char* p;
if (NULL != (p = getenv("QUERY_STRING"))) {
if (0 == strcmp(p, "lf")) {
printf("Status: 200 OK\n\n");
@ -20,6 +23,9 @@ int main () {
printf("Status: 200 OK\r\n");
fflush(stdout);
printf("\r\n");
} else if (0 == strcmp(p, "die-at-end")) {
printf("Status: 200 OK\r\n\r\n");
num_requests--;
} else {
printf("Status: 200 OK\r\n\r\n");
}
@ -27,8 +33,8 @@ int main () {
printf("Status: 500 Internal Foo\r\n\r\n");
}
printf("test123");
printf("test123");
}
return 0;
}

21
tests/run-tests.pl

@ -2,7 +2,7 @@
use strict;
use IO::Socket;
use Test::More tests => 124;
use Test::More tests => 126;
my $testname;
@ -1220,8 +1220,6 @@ EOF
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } );
ok(handle_http == 0, 'line-ending \n + \n');
@request = ( <<EOF
GET /index.fcgi?slow-crlf HTTP/1.0
Host: www.example.org
@ -1230,6 +1228,23 @@ EOF
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } );
ok(handle_http == 0, 'line-ending \r\n + \r\n');
@request = ( <<EOF
GET /index.fcgi?die-at-end HTTP/1.0
Host: www.example.org
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } );
ok(handle_http == 0, 'killing fastcgi and wait for restart');
@request = ( <<EOF
GET /index.fcgi?crlf HTTP/1.0
Host: www.example.org
EOF
);
@response = ( { 'HTTP-Protocol' => 'HTTP/1.0', 'HTTP-Status' => 200, 'HTTP-Content' => 'test123' } );
ok(handle_http == 0, 'regular response of after restart');
ok(stop_proc == 0, "Stopping lighttpd");
Loading…
Cancel
Save