1 #include <fcgi_stdio.h>
5 char *FCGI_URLDecode(char *buf);
8 while (FCGI_Accept() >= 0) {
10 printf("Content-type: text/plain\r\n\r\n");
13 while(fgets(buf, BUFSIZ, stdin)) {
14 printf("POST (raw):\r\n");
16 printf("\r\nPOST (decoded):\r\n");
17 printf("%s", FCGI_URLDecode(buf));
20 snprintf(buf, BUFSIZ, "%s", getenv("QUERY_STRING"));
21 printf("\r\nGET (raw):\r\n");
22 printf("%s", getenv("QUERY_STRING"));
24 printf("\r\nGET (decoded):\r\n");
25 printf("%s", FCGI_URLDecode(buf));
31 char *FCGI_URLDecode(char *buf) {
32 char *head = buf, *tail = buf;
37 if (isxdigit(*tail) && isxdigit(*(tail+1))) {
40 *head++ = (char)strtol(hex, NULL, 16);
44 } else if (*tail == '+') {