_Web Extensions and Applications Using FastCGI_
by Scott Dybiec and Philip Rousselle

Example 1: 

(a)
#include <time.h>
main()
{
   time_t tod;
   printf("Content-type: text/html\r\n");
   printf("\r\n");
   time(&tod);
   printf("The current time of day is %s <BR>", ctime(&tod));
}

(b)
#include <time.h>
#include <fcgi_stdio.h>
 
main()
{
   time_t tod;
   while(FCGI_Accept() >= 0) {
      printf("Content-type: text/html\r\n");
      printf("\r\n");
      time(&tod);
      printf("The current time of day is %s <BR>", ctime(&tod));
   }
   exit(0);
}

(c)
AppClass /server-root/fcgi-executables/tod.fcgi

(d) 
<Directory /server-root/fcgi-executables>
AddType application/x-httpd/x-httpd-fcgi .fcgi
</Directory>
 

Example 2: 

#include <time.h>
#include <fcgi_stdio.h>
 
main()
{
   time_t tod;
   long count = 0;
   while(FCGI_Accept() >= 0) {
      printf("Content-type: text/html\r\n");
      printf("\r\n");
      time(&tod);
      printf("The current time of day is %s <BR>", ctime(&tod));
      printf("\r\n");
      printf("This page has been accessed %d times<BR>", ++count);
   }
   exit(0);
}


Example 3: 

(a)
AppClass /server-root/auth/authftp-cache.fcg -initial-env FTP_HOST=plato
AddFastCgiAuth auth-keyword /server-root/auth/authftp-cache.fcg

(b)
<Directory /server-root/secret-docs>
AuthType Basic
AuthName realm
AuthFastCgi auth-keyword
<Limit GET>
require valid-user
</Limit>
</Directory>
 


