------------------------------
Version 2.0b2, 04 April 1997
- $Id: README,v 1.7 1999/07/26 05:06:09 roberts Exp $
+ $Id: README,v 1.8 1999/07/26 05:32:57 roberts Exp $
Copyright (c) 1996 Open Market, Inc.
See the file "LICENSE.TERMS" for information on usage and redistribution
of this file, and for a DISCLAIMER OF ALL WARRANTIES.
Changes with devkit 2.1.1
-------------------------
+ *) Cleaned up warnings in examples (mostly main() complaints).
+
*) Removed examples/tiny-cgi.c (it wasn't a FastCGI application?!).
*) Remove some debugging code and clean up some gcc warnings in cgi-fcgi.c.
*/
#ifndef lint
-static const char rcsid[] = "$Id: echo.c,v 1.2 1999/01/30 22:27:31 roberts Exp $";
+static const char rcsid[] = "$Id: echo.c,v 1.3 1999/07/26 05:32:59 roberts Exp $";
#endif /* not lint */
#if defined HAVE_UNISTD_H || __linux__
static void PrintEnv(char *label, char **envp)
{
printf("%s:<br>\n<pre>\n", label);
- for(; *envp != NULL; envp++) {
+ for ( ; *envp != NULL; envp++) {
printf("%s\n", *envp);
}
printf("</pre><p>\n");
}
-void main ()
+int main ()
{
char **initialEnv = environ;
int count = 0;
- while(FCGI_Accept() >= 0) {
+
+ while (FCGI_Accept() >= 0) {
char *contentLength = getenv("CONTENT_LENGTH");
int len;
+
printf("Content-type: text/html\r\n"
- "\r\n"
- "<title>FastCGI echo</title>"
- "<h1>FastCGI echo</h1>\n"
- "Request number %d, Process ID: %d<p>\n", ++count, getpid());
- if(contentLength != NULL) {
+ "\r\n"
+ "<title>FastCGI echo</title>"
+ "<h1>FastCGI echo</h1>\n"
+ "Request number %d, Process ID: %d<p>\n", ++count, getpid());
+
+ if (contentLength != NULL) {
len = strtol(contentLength, NULL, 10);
- } else {
+ }
+ else {
len = 0;
}
- if(len <= 0) {
+
+ if (len <= 0) {
printf("No data from standard input.<p>\n");
- } else {
+ }
+ else {
int i, ch;
+
printf("Standard input:<br>\n<pre>\n");
- for(i = 0; i < len; i++) {
- if((ch = getchar()) < 0) {
- printf("Error: Not enough bytes received "
- "on standard input<p>\n");
+ for (i = 0; i < len; i++) {
+ if ((ch = getchar()) < 0) {
+ printf("Error: Not enough bytes received on standard input<p>\n");
break;
}
putchar(ch);
}
printf("\n</pre><p>\n");
}
+
PrintEnv("Request environment", environ);
PrintEnv("Initial environment", initialEnv);
} /* while */
+
+ return 0;
}
*/
#ifndef lint
-static const char rcsid[] = "$Id: echo2.c,v 1.3 1999/06/10 21:20:35 roberts Exp $";
+static const char rcsid[] = "$Id: echo2.c,v 1.4 1999/07/26 05:33:00 roberts Exp $";
#endif /* not lint */
#if defined HAVE_UNISTD_H || __linux__
FCGX_FPrintF(out, "</pre><p>\n");
}
-void main ()
+int main ()
{
FCGX_Stream *in, *out, *err;
FCGX_ParamArray envp;
PrintEnv(out, "Request environment", envp);
PrintEnv(out, "Initial environment", environ);
} /* while */
+
+ exit(0);
}
*/
#ifndef lint
-static const char rcsid[] = "$Id: log-dump.c,v 1.2 1999/01/30 22:27:33 roberts Exp $";
+static const char rcsid[] = "$Id: log-dump.c,v 1.3 1999/07/26 05:33:01 roberts Exp $";
#endif /* not lint */
#if defined HAVE_UNISTD_H || defined __linux__
#include "fcgi_stdio.h"
#include <stdlib.h>
#include <signal.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#endif
+#include <string.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <errno.h>
static int successCount = 0;
static int failureCount = 0;
-void main(void)
+int main(void)
{
char *queryString = NULL;
char *rolePtr;
continue;
}
}
+
+ exit(0);
}
*/
#ifndef lint
-static const char rcsid[] = "$Id: sample-store.c,v 1.2 1999/01/30 22:27:34 roberts Exp $";
+static const char rcsid[] = "$Id: sample-store.c,v 1.3 1999/07/26 05:33:00 roberts Exp $";
#endif /* not lint */
#include "fcgi_stdio.h" /* FCGI_Accept, FCGI_Finish, stdio */
* sample-store is designed to be configured as follows (for the OM server):
*
* SI_Department SampleStoreDept -EnableAnonymousTicketing 1
- * Region /SampleStore/* { SI_RequireSI SampleStoreDept 1 }
+ * Region /SampleStore/ * { SI_RequireSI SampleStoreDept 1 }
*
* Filemap /SampleStore $fcgi-devel-kit/examples/SampleStore
* AppClass SampleStoreAppClass \
* -initial-env CART_HOLD_MINUTES=240 \
* -processes 2 -affinity
* Responder SampleStoreAppClass /SampleStore/App
- * AuthorizeRegion /SampleStore/Protected/* SampleStoreAppClass
+ * AuthorizeRegion /SampleStore/Protected/ * SampleStoreAppClass
*
* sample-store looks for three initial environment variables:
*
* calling FCGI_Accept and performing the accepted request.
* Do cleanup operations incrementally between requests.
*/
-void main(void)
+int main(void)
{
Initialize();
- while(FCGI_Accept() >= 0) {
+
+ while (FCGI_Accept() >= 0) {
PerformRequest();
FCGI_Finish();
GarbageCollectStep();
ConditionalCheckpoint();
}
+
+ return 0;
}
\f
/*
*/
#ifndef lint
-static const char rcsid[] = "$Id: tiny-authorizer.c,v 1.1 1997/09/16 15:36:28 stanleyg Exp $";
+static const char rcsid[] = "$Id: tiny-authorizer.c,v 1.2 1999/07/26 05:32:59 roberts Exp $";
#endif /* not lint */
#include "fcgi_stdio.h"
#include <stdlib.h>
#include <string.h>
-void main(void)
+int main(void)
{
char *user, *password;
+
user = getenv("USER");
- if(user == NULL) {
+ if (user == NULL) {
user = "doe";
}
+
password = getenv("PASSWORD");
- if(password == NULL) {
+ if (password == NULL) {
password = "xxxx";
}
- while(FCGI_Accept() >= 0) {
+ while (FCGI_Accept() >= 0) {
char *remoteUser, *remotePassword;
+
remoteUser = getenv("REMOTE_USER");
remotePassword = getenv("REMOTE_PASSWD");
- if((remoteUser == NULL) || (remotePassword == NULL) ||
- strcmp(remoteUser, user) || strcmp(remotePassword, password)) {
- printf("Status: 401 Unauthorized\r\n"
- "WWW-Authenticate: Basic realm=\"Test\"\r\n"
- "\r\n");
-
- } else {
+ if ((remoteUser == NULL) || (remotePassword == NULL)
+ || strcmp(remoteUser, user) || strcmp(remotePassword, password))
+ {
+ printf("Status: 401 Unauthorized\r\n"
+ "WWW-Authenticate: Basic realm=\"Test\"\r\n"
+ "\r\n");
+ }
+ else {
char *processId = getenv("QUERY_STRING");
- if(processId == NULL || strlen(processId) == 0) {
+ if (processId == NULL || strlen(processId) == 0) {
processId = "0";
}
printf("Status: 200 OK\r\n"
- "Variable-AUTH_TYPE: Basic\r\n"
- "Variable-REMOTE_PASSWD:\r\n"
- "Variable-PROCESS_ID: %s\r\n"
- "\r\n", processId);
+ "Variable-AUTH_TYPE: Basic\r\n"
+ "Variable-REMOTE_PASSWD:\r\n"
+ "Variable-PROCESS_ID: %s\r\n"
+ "\r\n", processId);
}
}
+
+ return 0;
}
*/
#ifndef lint
-static const char rcsid[] = "$Id: tiny-fcgi.c,v 1.2 1999/01/30 22:27:36 roberts Exp $";
+static const char rcsid[] = "$Id: tiny-fcgi.c,v 1.3 1999/07/26 05:32:58 roberts Exp $";
#endif /* not lint */
#include "fcgi_stdio.h"
#include <process.h>
#endif
-void main(void)
+int main(void)
{
int count = 0;
while(FCGI_Accept() >= 0) {
"Process ID: %d\n",
++count, getenv("SERVER_NAME"), getpid());
}
+
+ return 0;
}
*/
#ifndef lint
-static const char rcsid[] = "$Id: tiny-fcgi2.c,v 1.2 1999/01/30 22:27:37 roberts Exp $";
+static const char rcsid[] = "$Id: tiny-fcgi2.c,v 1.3 1999/07/26 05:32:58 roberts Exp $";
#endif /* not lint */
#if defined HAVE_UNISTD_H || defined __linux__
#include <process.h>
#endif
-void main(void)
+int main(void)
{
FCGX_Stream *in, *out, *err;
FCGX_ParamArray envp;
int count = 0;
- while(FCGX_Accept(&in, &out, &err, &envp) >= 0)
+
+ while (FCGX_Accept(&in, &out, &err, &envp) >= 0) {
FCGX_FPrintF(out,
"Content-type: text/html\r\n"
"\r\n"
"Request number %d running on host <i>%s</i> "
"Process ID: %d\n",
++count, FCGX_GetParam("SERVER_NAME", envp), getpid());
+ }
+
+ return 0;
}