2008-02-25 06:56:48 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
2006-10-03 22:22:47 +00:00
|
|
|
#include "config.h"
|
2008-02-25 06:56:48 +00:00
|
|
|
#endif
|
2006-10-03 22:22:47 +00:00
|
|
|
#ifdef HAVE_FASTCGI_FASTCGI_H
|
|
|
|
#include <fastcgi/fcgi_stdio.h>
|
|
|
|
#else
|
2005-03-01 13:37:40 +00:00
|
|
|
#include <fcgi_stdio.h>
|
2006-10-03 22:22:47 +00:00
|
|
|
#endif
|
2005-03-01 13:37:40 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2012-08-31 14:11:41 +00:00
|
|
|
int main (void) {
|
2005-03-01 16:57:24 +00:00
|
|
|
int num_requests = 2;
|
2006-10-05 00:09:51 +00:00
|
|
|
|
2005-03-01 16:57:24 +00:00
|
|
|
while (num_requests > 0 &&
|
|
|
|
FCGI_Accept() >= 0) {
|
|
|
|
char* p;
|
2006-10-05 00:09:51 +00:00
|
|
|
|
2005-03-01 13:37:40 +00:00
|
|
|
if (NULL != (p = getenv("QUERY_STRING"))) {
|
|
|
|
if (0 == strcmp(p, "lf")) {
|
|
|
|
printf("Status: 200 OK\n\n");
|
|
|
|
} else if (0 == strcmp(p, "crlf")) {
|
|
|
|
printf("Status: 200 OK\r\n\r\n");
|
|
|
|
} else if (0 == strcmp(p, "slow-lf")) {
|
|
|
|
printf("Status: 200 OK\n");
|
|
|
|
fflush(stdout);
|
|
|
|
printf("\n");
|
|
|
|
} else if (0 == strcmp(p,"slow-crlf")) {
|
|
|
|
printf("Status: 200 OK\r\n");
|
|
|
|
fflush(stdout);
|
|
|
|
printf("\r\n");
|
2005-03-01 16:57:24 +00:00
|
|
|
} else if (0 == strcmp(p, "die-at-end")) {
|
|
|
|
printf("Status: 200 OK\r\n\r\n");
|
|
|
|
num_requests--;
|
2005-03-01 13:37:40 +00:00
|
|
|
} else {
|
|
|
|
printf("Status: 200 OK\r\n\r\n");
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
printf("Status: 500 Internal Foo\r\n\r\n");
|
|
|
|
}
|
2006-10-05 00:09:51 +00:00
|
|
|
|
2009-04-01 17:35:17 +00:00
|
|
|
if (0 == strcmp(p, "path_info")) {
|
|
|
|
printf("%s", getenv("PATH_INFO"));
|
|
|
|
} else if (0 == strcmp(p, "script_name")) {
|
|
|
|
printf("%s", getenv("SCRIPT_NAME"));
|
|
|
|
} else {
|
|
|
|
printf("test123");
|
|
|
|
}
|
2005-03-01 13:37:40 +00:00
|
|
|
}
|
2006-10-05 00:09:51 +00:00
|
|
|
|
2005-03-01 13:37:40 +00:00
|
|
|
return 0;
|
|
|
|
}
|