GnuCash
2.6.99
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
experimental
cgi-bin
fastcgi-hello.c
1
2
#include <fcgi_stdio.h>
3
#include <stdlib.h>
4
#include <string.h>
5
6
extern
char
**environ;
7
8
int
main (
int
argc,
char
*argv[])
9
{
10
char
*query_string, *method, *len = 0x0;
11
int
count = 0;
12
int
i, ilen = 0;
13
14
while
(FCGI_Accept() >= 0)
15
{
16
printf(
"Content-type: text/html\r\n"
17
"\r\n"
18
"<title>FastCGI Hello!</title>"
19
"<h1>FastCGI Hello!</h1>"
20
"Request number %d running on host <i>%s</i>\n"
,
21
++count, getenv(
"SERVER_NAME"
));
22
23
printf(
"<p>If you have configured fastcgi correctly, then "
24
"the request number should increment every time you "
25
"hit reload on your browser. You should also see "
26
"\"%s\" (the name of this program) showing up in ps ax.\n"
,
27
argv[0]);
28
29
query_string = getenv (
"QUERY_STRING"
);
30
printf (
"<p>The QUERY_STRING environment vairable is %s\n"
31
"The other environment variables are:<p>"
, query_string);
32
33
for
(i = 0; environ[i]; i++)
34
{
35
printf (
"<br>%s\n"
, environ[i]);
36
}
37
38
method = getenv (
"REQUEST_METHOD"
);
39
if
(!strcmp (method,
"POST"
))
40
{
41
char
* bufp;
42
ilen = atoi (getenv (
"CONTENT_LENGTH"
));
43
printf (
"<P>This is a method=post request, "
44
"with content length=%d<P>\n"
, ilen);
45
bufp = (
char
*) malloc (ilen);
46
fread (bufp, ilen, 1, stdin);
47
48
printf (
"The POST data is<P>%s\n"
, bufp);
49
free (bufp);
50
}
51
52
}
53
return
0;
54
}
Generated by
1.8.6