Browse Source

[tests] collect code for "die-at-end" tests

master
Glenn Strauss 9 months ago
parent
commit
c68a7b4552
  1. 10
      tests/fcgi-responder.c
  2. 4
      tests/scgi-responder.c

10
tests/fcgi-responder.c

@ -11,10 +11,8 @@
#include <string.h>
int main (void) {
int num_requests = 1;
while (num_requests > 0 &&
FCGI_Accept() >= 0) {
while (FCGI_Accept() >= 0) {
char* p;
if (NULL != (p = getenv("QUERY_STRING"))) {
@ -32,7 +30,9 @@ int main (void) {
printf("\r\n");
} else if (0 == strcmp(p, "die-at-end")) {
printf("Status: 200 OK\r\n\r\n");
num_requests--;
printf("test123");
FCGI_Finish();
break;
} else {
printf("Status: 200 OK\r\n\r\n");
}
@ -50,8 +50,6 @@ int main (void) {
} else {
printf("test123");
}
if (0 == num_requests) FCGI_Finish();
}
return 0;

4
tests/scgi-responder.c

@ -56,7 +56,6 @@ static void
scgi_process (const int fd)
{
ssize_t rd = 0, offset = 0;
int num_requests = 1;
char *p = NULL, *r;
unsigned long rlen;
long long cl;
@ -178,7 +177,7 @@ scgi_process (const int fd)
printf("\r\n");
} else if (0 == strcmp(p, "die-at-end")) {
printf("Status: 200 OK\r\n\r\n");
num_requests--;
finished = 1;
} else {
printf("Status: 200 OK\r\n\r\n");
}
@ -199,7 +198,6 @@ scgi_process (const int fd)
}
fflush(stdout);
if (0 == num_requests) finished = 1;
}

Loading…
Cancel
Save