Add FastCGI approach
[matches/MCTX3420.git] / testing / fastcgi-approach / fastcgi_test.c
1 #include "fcgi_stdio.h" /* fcgi library; put it first*/
2 #include <stdlib.h>
3
4 int main (int argc, char *argv[])
5 {
6   int count = 0;
7
8   //Spawn thread to get sensor data here?
9   //Response loop
10         while (FCGI_Accept() >= 0)   {
11                 printf("Content-type: text/html\r\n"
12                            "\r\n"
13                            "<title>FastCGI Hello! (C, fcgi_stdio library)</title>"
14                            "<h1>FastCGI Hello! (C, fcgi_stdio library)</h1>"
15                            "Request number %d running on host <i>%s</i>\n",
16                            count++, getenv("SERVER_HOSTNAME"));
17
18                 char *data = getenv("QUERY_STRING");
19                 if (data) {
20                         printf("<br>Query string is: '%s'\n", data);
21                 }
22         }
23 }

UCC git Repository :: git.ucc.asn.au