24 | #else
25 | extern char **environ;
26 | #endif
27 |
28 | #include "fcgi_stdio.h"
29 |
30 |
31 | static void PrintEnv(char *label, char **envp)
32 | {
33 | printf("%s:
\n\n", label);
34 | for ( ; *envp != NULL; envp++) {
35 | printf("%s\n", *envp);
36 | }
37 | printf("\n");
38 | }
39 |
40 | int main ()
41 | {
42 | char **initialEnv = environ;
43 | int count = 0;
44 |
45 | while (FCGI_Accept() >= 0) {
46 | char *contentLength = getenv("CONTENT_LENGTH");
47 | int len;
48 |
49 | printf("Content-type: text/html\r\n"
50 | "\r\n"
51 | "
FastCGI echo"
52 | "FastCGI echo
\n"
53 | "Request number %d, Process ID: %d\n", ++count, getpid());
54 |
55 | if (contentLength != NULL) {
56 | len = strtol(contentLength, NULL, 10);
57 | }
58 | else {
59 | len = 0;
60 | }
61 |
62 | if (len <= 0) {
63 | printf("No data from standard input.
\n");
64 | }
65 | else {
66 | int i, ch;
67 |
68 | printf("Standard input:
\n
\n");
69 | for (i = 0; i < len; i++) {
70 | if ((ch = getchar()) < 0) {
71 | printf("Error: Not enough bytes received on standard input\n");
72 | break;
73 | }
74 | putchar(ch);
75 | }
76 | printf("\n
\n");
77 | }
78 |
79 | PrintEnv("Request environment", environ);
80 | PrintEnv("Initial environment", initialEnv);
81 | } /* while */
82 |
83 | return 0;
84 | }
85 |
--------------------------------------------------------------------------------
/examples/threaded.c:
--------------------------------------------------------------------------------
1 | /*
2 | * threaded.c -- A simple multi-threaded FastCGI application.
3 | */
4 |
5 | #include "fcgi_config.h"
6 |
7 | #include
8 | #include
9 |
10 | #ifdef HAVE_UNISTD_H
11 | #include
12 | #endif
13 |
14 | #include "fcgiapp.h"
15 |
16 |
17 | #define THREAD_COUNT 20
18 |
19 | static int counts[THREAD_COUNT];
20 |
21 | static void *doit(void *a)
22 | {
23 | int rc, i, thread_id = (int)a;
24 | pid_t pid = getpid();
25 | FCGX_Request request;
26 | char *server_name;
27 |
28 | FCGX_InitRequest(&request, 0, 0);
29 |
30 | for (;;)
31 | {
32 | static pthread_mutex_t accept_mutex = PTHREAD_MUTEX_INITIALIZER;
33 | static pthread_mutex_t counts_mutex = PTHREAD_MUTEX_INITIALIZER;
34 |
35 | /* Some platforms require accept() serialization, some don't.. */
36 | pthread_mutex_lock(&accept_mutex);
37 | rc = FCGX_Accept_r(&request);
38 | pthread_mutex_unlock(&accept_mutex);
39 |
40 | if (rc < 0)
41 | break;
42 |
43 | server_name = FCGX_GetParam("SERVER_NAME", request.envp);
44 |
45 | FCGX_FPrintF(request.out,
46 | "Content-type: text/html\r\n"
47 | "\r\n"
48 | "FastCGI Hello! (multi-threaded C, fcgiapp library)"
49 | "FastCGI Hello! (multi-threaded C, fcgiapp library)
"
50 | "Thread %d, Process %ld"
51 | "Request counts for %d threads running on host %s
",
52 | thread_id, pid, THREAD_COUNT, server_name ? server_name : "?");
53 |
54 | sleep(2);
55 |
56 | pthread_mutex_lock(&counts_mutex);
57 | ++counts[thread_id];
58 | for (i = 0; i < THREAD_COUNT; i++)
59 | FCGX_FPrintF(request.out, "%5d " , counts[i]);
60 | pthread_mutex_unlock(&counts_mutex);
61 |
62 | FCGX_Finish_r(&request);
63 | }
64 |
65 | return NULL;
66 | }
67 |
68 | int main(void)
69 | {
70 | int i;
71 | pthread_t id[THREAD_COUNT];
72 |
73 | FCGX_Init();
74 |
75 | for (i = 1; i < THREAD_COUNT; i++)
76 | pthread_create(&id[i], NULL, doit, (void*)i);
77 |
78 | doit(0);
79 |
80 | return 0;
81 | }
82 |
83 |
--------------------------------------------------------------------------------
/examples/echo-x.c:
--------------------------------------------------------------------------------
1 | /*
2 | * echo2.c --
3 | *
4 | * Produce a page containing all the inputs (fcgiapp version)
5 | *
6 | *
7 | * Copyright (c) 1996 Open Market, Inc.
8 | *
9 | * See the file "LICENSE" for information on usage and redistribution
10 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 | *
12 | */
13 |
14 | #include "fcgi_config.h"
15 |
16 | #include
17 |
18 | #ifdef HAVE_UNISTD_H
19 | #include
20 | #endif
21 |
22 | #ifdef _WIN32
23 | #include
24 | #else
25 | extern char **environ;
26 | #endif
27 |
28 | #include "fcgiapp.h"
29 |
30 | static void PrintEnv(FCGX_Stream *out, char *label, char **envp)
31 | {
32 | FCGX_FPrintF(out, "%s:
\n\n", label);
33 | for( ; *envp != NULL; envp++) {
34 | FCGX_FPrintF(out, "%s\n", *envp);
35 | }
36 | FCGX_FPrintF(out, "\n");
37 | }
38 |
39 | int main ()
40 | {
41 | FCGX_Stream *in, *out, *err;
42 | FCGX_ParamArray envp;
43 | int count = 0;
44 |
45 | while (FCGX_Accept(&in, &out, &err, &envp) >= 0) {
46 | char *contentLength = FCGX_GetParam("CONTENT_LENGTH", envp);
47 | int len = 0;
48 |
49 | FCGX_FPrintF(out,
50 | "Content-type: text/html\r\n"
51 | "\r\n"
52 | "
FastCGI echo (fcgiapp version)"
53 | "FastCGI echo (fcgiapp version)
\n"
54 | "Request number %d, Process ID: %d\n", ++count, getpid());
55 |
56 | if (contentLength != NULL)
57 | len = strtol(contentLength, NULL, 10);
58 |
59 | if (len <= 0) {
60 | FCGX_FPrintF(out, "No data from standard input.
\n");
61 | }
62 | else {
63 | int i, ch;
64 |
65 | FCGX_FPrintF(out, "Standard input:
\n
\n");
66 | for (i = 0; i < len; i++) {
67 | if ((ch = FCGX_GetChar(in)) < 0) {
68 | FCGX_FPrintF(out,
69 | "Error: Not enough bytes received on standard input\n");
70 | break;
71 | }
72 | FCGX_PutChar(ch, out);
73 | }
74 | FCGX_FPrintF(out, "\n
\n");
75 | }
76 |
77 | PrintEnv(out, "Request environment", envp);
78 | PrintEnv(out, "Initial environment", environ);
79 | } /* while */
80 |
81 | return 0;
82 | }
83 |
--------------------------------------------------------------------------------
/perl/README:
--------------------------------------------------------------------------------
1 | $Id: README,v 1.7 2001/10/04 08:08:34 skimo Exp $
2 |
3 | Copyright (c) 1996 Open Market, Inc.
4 | See the file "LICENSE" for information on usage and redistribution
5 | of this file, and for a DISCLAIMER OF ALL WARRANTIES.
6 |
7 | Copyright (c) 1996-1998 Sven Verdoolaege
8 | No additional restrictions/warranties.
9 |
10 | This is a Fast CGI module for perl. It's based on the FCGI module
11 | that comes with Open Market's FastCGI Developer's Kit, but does
12 | not require you to recompile perl.
13 |
14 | It even no longer requires perl to be compiled with sfio.
15 | To compile with sfio you'll need at least perl 5.003_02 and you'll have
16 | to have configured it with eg './Configure -Duseperlio -Dusesfio'.
17 | (See the INSTALL file that comes with the perl distribution.)
18 | To compile without sfio you'll need an even more recent perl version.
19 | (perl 5.004 and up should be fine.)
20 |
21 | See http://www.fastcgi.com/ for more information about fastcgi.
22 | Lincoln D. Stein's perl CGI module also contains some information
23 | about fastcgi programming.
24 |
25 | See echo.fpl for an example on how to use this module.
26 |
27 | You need to install gcc, gnu make, m4, aclocal, autoconf, automake and libtool packages.
28 |
29 | And to install, do the usual
30 |
31 | ./distrib
32 | perl Makefile.PL
33 | make
34 | make install
35 |
36 | If you want to use the (experimental) pure perl version, that
37 | doesn't require a compiler and currently only works on Unix,
38 | you have to pass the --pure-perl option as in
39 | "perl Makefile.PL --pure-perl".
40 |
41 | Note that the pure version does not support Window's Named Pipes.
42 | Support for Named Pipes is not a requirement of the FastCGI specification.
43 | Named Pipes are used by mod_fastcgi and the FastCGI application library as a
44 | replacement for Unix sockets. mod_fastcgi uses Named Pipes on Windows (Unix
45 | sockets on Unix) by default (see the mod_fastcgi docs for more information).
46 |
47 | If you want the module to use a previously installed fcgi library
48 | instead of the included files, use the --use-installed option,
49 | optionally followed by the name of the directory in which it can
50 | be found.
51 |
52 | To configure the library Makefile.PL will run ./configure .
53 | You may want to run it yourself beforehand because its findings
54 | may not always be correct.
55 | The configure.readme file describes how to run ./configure (and only that).
56 |
57 | If you're on a solaris system and your installed fcgi library is 2.02b
58 | or earlier, you'll probably want to use the included files.
59 |
60 | The old interface of the FCGI module installs die and warn
61 | handlers that merely print the error/warning to STDERR (the
62 | default handlers print directly to stderr, which isn't redirected
63 | in the non sfio case). I'm not very happy with the result.
64 | Suggestions welcome.
65 |
66 | Sven Verdoolaege
67 | skimo@kotnet.org
68 |
--------------------------------------------------------------------------------
/perl/t/02-unix_domain_socket.t:
--------------------------------------------------------------------------------
1 | use strict;
2 | use warnings;
3 |
4 | use Config;
5 | use FCGI;
6 | use FCGI::Client;
7 | use File::Temp qw(tempfile);
8 | use IO::Socket;
9 | use Test::More 0.88;
10 |
11 | my $can_fork = $Config{d_fork}
12 | || (
13 | ($^O eq 'MSWin32' || $^O eq 'NetWare')
14 | and $Config{useithreads}
15 | and $Config{ccflags} =~ /-DPERL_IMPLICIT_SYS/
16 | );
17 | if ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bSocket\b/) {
18 | plan skip_all => 'Socket extension unavailable';
19 | } elsif ($ENV{PERL_CORE} and $Config{'extensions'} !~ /\bIO\b/) {
20 | plan skip_all => 'IO extension unavailable';
21 | } elsif ($^O eq 'os2') {
22 | eval { IO::Socket::pack_sockaddr_un('/foo/bar') || 1 };
23 | if ($@ !~ /not implemented/) {
24 | plan skip_all => 'compiled without TCP/IP stack v4';
25 | }
26 | } elsif ($^O =~ m/^(?:qnx|nto|vos)$/ ) {
27 | plan skip_all => "UNIX domain sockets not implemented on $^O";
28 | } elsif (! $can_fork) {
29 | plan skip_all => 'no fork';
30 | } elsif ($^O eq 'MSWin32') {
31 | if ($ENV{CONTINUOUS_INTEGRATION}) {
32 | # https://github.com/Perl/perl5/issues/17429
33 | plan skip_all => 'Skipping on Windows CI';
34 | } else {
35 | # https://github.com/Perl/perl5/issues/17575
36 | if (! eval { socket(my $sock, PF_UNIX, SOCK_STREAM, 0) }) {
37 | plan skip_all => "AF_UNIX unavailable or disabled on this platform"
38 | }
39 | }
40 | }
41 |
42 | my (undef, $unix_socket_file) = tempfile();
43 | my $fcgi_socket = FCGI::OpenSocket($unix_socket_file, 5);
44 |
45 | # Client
46 | if (my $pid = fork()) {
47 | my $right_ret = <<'END';
48 | Content-Type: text/plain
49 |
50 | END
51 |
52 | my ($stdout, $stderr) = client_request($unix_socket_file);
53 | is($stdout, $right_ret."0\n", 'Test first round on stdout.');
54 | is($stderr, undef, 'Test first round on stderr.');
55 |
56 | ($stdout, $stderr) = client_request($unix_socket_file);
57 | is($stdout, $right_ret."1\n", 'Test second round on stdout.');
58 | is($stderr, undef, 'Test second round on stderr.');
59 |
60 | # Server
61 | } elsif (defined $pid) {
62 | my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV, $fcgi_socket);
63 |
64 | # Only two cycles.
65 | my $count = 0;
66 | while ($count < 2 && $request->Accept() >= 0) {
67 | print "Content-Type: text/plain\n\n";
68 | print $count++."\n";
69 | }
70 | exit;
71 |
72 | } else {
73 | die $!;
74 | }
75 |
76 | # Cleanup.
77 | FCGI::CloseSocket($fcgi_socket);
78 | unlink $unix_socket_file;
79 |
80 | done_testing;
81 |
82 | sub client_request {
83 | my $unix_socket_file = shift;
84 |
85 | my $sock = IO::Socket::UNIX->new(
86 | Peer => $unix_socket_file,
87 | ) or die $!;
88 | my $client = FCGI::Client::Connection->new(sock => $sock);
89 | my ($stdout, $stderr) = $client->request({
90 | REQUEST_METHOD => 'GET',
91 | }, '');
92 |
93 | return ($stdout, $stderr);
94 | }
95 |
--------------------------------------------------------------------------------
/libfcgi/strerror.c:
--------------------------------------------------------------------------------
1 | /*
2 | * The terms in the file "LICENSE" do not apply to this file.
3 | * See terms below.
4 | *
5 | * Copyright (c) 1988 Regents of the University of California.
6 | * All rights reserved.
7 | *
8 | * Redistribution and use in source and binary forms, with or without
9 | * modification, are permitted provided that the following conditions
10 | * are met:
11 | * 1. Redistributions of source code must retain the above copyright
12 | * notice, this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright
14 | * notice, this list of conditions and the following disclaimer in the
15 | * documentation and/or other materials provided with the distribution.
16 | * 3. All advertising materials mentioning features or use of this software
17 | * must display the following acknowledgement:
18 | * This product includes software developed by the University of
19 | * California, Berkeley and its contributors.
20 | * 4. Neither the name of the University nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 | * SUCH DAMAGE.
35 | */
36 |
37 | #include "fcgi_config.h"
38 |
39 | #if ! defined (HAVE_STRERROR)
40 | #include
41 |
42 | /*
43 | * Since perror() is not allowed to change the contents of strerror()'s
44 | * static buffer, both functions supply their own buffers to the
45 | * internal function __strerror().
46 | */
47 |
48 | char *
49 | __strerror(int num, char *buf)
50 | {
51 | #define UPREFIX "Unknown error: "
52 | extern char *sys_errlist[];
53 | extern int sys_nerr;
54 | register unsigned int errnum;
55 | register char *p, *t;
56 | char tmp[40];
57 |
58 | errnum = num; /* convert to unsigned */
59 | if (errnum < sys_nerr)
60 | return(sys_errlist[errnum]);
61 |
62 | /* Do this by hand, so we don't include stdio(3). */
63 | t = tmp;
64 | do {
65 | *t++ = "0123456789"[errnum % 10];
66 | } while (errnum /= 10);
67 |
68 | strcpy (buf, UPREFIX);
69 | for (p = buf + sizeof(UPREFIX) -1;;) {
70 | *p++ = *--t;
71 | if (t <= tmp)
72 | break;
73 | }
74 |
75 | return buf;
76 | }
77 |
78 |
79 | char *
80 | strerror(int num)
81 | {
82 | static char buf[40]; /* 64-bit number + slop */
83 | return __strerror(num, buf);
84 | }
85 |
86 | #endif
87 |
--------------------------------------------------------------------------------
/include/fcgi_config.h.in:
--------------------------------------------------------------------------------
1 | /* include/fcgi_config.h.in. Generated automatically from configure.in by autoheader. */
2 |
3 | /* Define if you have the header file. */
4 | #undef HAVE_ARPA_INET_H
5 |
6 | /* Define if you have the header file. */
7 | #undef HAVE_DLFCN_H
8 |
9 | /* Define if there's a fileno() prototype in stdio.h */
10 | #undef HAVE_FILENO_PROTO
11 |
12 | /* Define if the fpos_t typedef is in stdio.h */
13 | #undef HAVE_FPOS
14 |
15 | /* Define if you have the header file. */
16 | #undef HAVE_INTTYPES_H
17 |
18 | /* Define if you have the `dnet_stub' library (-ldnet_stub). */
19 | #undef HAVE_LIBDNET_STUB
20 |
21 | /* Define if you have the `ieee' library (-lieee). */
22 | #undef HAVE_LIBIEEE
23 |
24 | /* Define if you have the `nsl' library (-lnsl). */
25 | #undef HAVE_LIBNSL
26 |
27 | /* Define if you have the pthread library */
28 | #undef HAVE_LIBPTHREAD
29 |
30 | /* Define if you have the `resolv' library (-lresolv). */
31 | #undef HAVE_LIBRESOLV
32 |
33 | /* Define if you have the `socket' library (-lsocket). */
34 | #undef HAVE_LIBSOCKET
35 |
36 | /* Define if you have the header file. */
37 | #undef HAVE_LIMITS_H
38 |
39 | /* Define if you have the header file. */
40 | #undef HAVE_MEMORY_H
41 |
42 | /* Define if you have the header file. */
43 | #undef HAVE_NETDB_H
44 |
45 | /* Define if you have the header file. */
46 | #undef HAVE_NETINET_IN_H
47 |
48 | /* Define if sockaddr_un in sys/un.h contains a sun_len component */
49 | #undef HAVE_SOCKADDR_UN_SUN_LEN
50 |
51 | /* Define if the socklen_t typedef is in sys/socket.h */
52 | #undef HAVE_SOCKLEN
53 |
54 | /* Define if you have the header file. */
55 | #undef HAVE_STDINT_H
56 |
57 | /* Define if you have the header file. */
58 | #undef HAVE_STDLIB_H
59 |
60 | /* Define if you have the `strerror' function. */
61 | #undef HAVE_STRERROR
62 |
63 | /* Define if you have the header file. */
64 | #undef HAVE_STRINGS_H
65 |
66 | /* Define if you have the header file. */
67 | #undef HAVE_STRING_H
68 |
69 | /* Define if you have the header file. */
70 | #undef HAVE_SYS_PARAM_H
71 |
72 | /* Define if you have the header file. */
73 | #undef HAVE_SYS_SOCKET_H
74 |
75 | /* Define if you have the header file. */
76 | #undef HAVE_SYS_STAT_H
77 |
78 | /* Define if you have the header file. */
79 | #undef HAVE_SYS_TIME_H
80 |
81 | /* Define if you have the header file. */
82 | #undef HAVE_SYS_TYPES_H
83 |
84 | /* Define if you have the header file. */
85 | #undef HAVE_UNISTD_H
86 |
87 | /* Define if va_arg(arg, long double) crashes the compiler */
88 | #undef HAVE_VA_ARG_LONG_DOUBLE_BUG
89 |
90 | /* Name of package */
91 | #undef PACKAGE
92 |
93 | /* Define if you have the ANSI C header files. */
94 | #undef STDC_HEADERS
95 |
96 | /* Define if cross-process locking is required by accept() */
97 | #undef USE_LOCKING
98 |
99 | /* Version number of package */
100 | #undef VERSION
101 |
102 | /* Define to empty if `const' does not conform to ANSI C. */
103 | #undef const
104 |
105 | /* Define as `__inline' if that's what the C compiler calls it, or to nothing
106 | if it is not supported. */
107 | #undef inline
108 |
109 | /* Define to `int' if does not define. */
110 | #undef ssize_t
111 |
--------------------------------------------------------------------------------
/configure.ac:
--------------------------------------------------------------------------------
1 | dnl $Id: configure.in,v 1.27 2003/06/22 02:15:10 robs Exp $
2 | dnl
3 | dnl This file is an input file used by the GNU "autoconf" program to
4 | dnl generate the file "configure", which is run during the build
5 | dnl to configure the system for the local environment.
6 |
7 | AC_INIT([fcgi], [2.4.7])
8 | AM_INIT_AUTOMAKE([1.11 foreign])
9 | AC_CONFIG_MACRO_DIR([m4])
10 | AM_CONFIG_HEADER(fcgi_config.h)
11 |
12 | LT_INIT([win32-dll])
13 |
14 | AC_PROG_CC
15 | AC_PROG_CPP
16 | AC_PROG_INSTALL
17 | AC_PROG_LIBTOOL
18 |
19 | AC_PROG_CXX
20 |
21 | AC_LANG([C++])
22 |
23 | dnl autoconf defaults CXX to 'g++', so its unclear whether it exists/works
24 | AC_MSG_CHECKING([whether $CXX works])
25 | AC_TRY_COMPILE([#include ],
26 | [std::cout << "ok";],
27 | [AC_MSG_RESULT(yes)
28 | LIBFCGIXX=libfcgi++.la
29 | ECHO_CPP=echo-cpp${EXEEXT}
30 | AC_MSG_CHECKING([whether cin has a streambuf assignment operator])
31 | AC_TRY_COMPILE([#include ],
32 | [cin = static_cast(0);],
33 | [AC_MSG_RESULT(yes)
34 | AC_DEFINE([HAVE_IOSTREAM_WITHASSIGN_STREAMBUF], [1],
35 | [Define if cin/cout/cerr has a streambuf assignment operator])],
36 | [AC_MSG_RESULT(no)])
37 | AC_MSG_CHECKING([whether char_type is defined in the context of streambuf])
38 | AC_TRY_COMPILE([#include ],
39 | [class fcgi_streambuf : public std::streambuf { char_type ct; }],
40 | [AC_MSG_RESULT(yes)
41 | AC_DEFINE([HAVE_STREAMBUF_CHAR_TYPE], [1],
42 | [Define if char_type is defined in the context of streambuf])],
43 | [AC_MSG_RESULT(no)])],
44 | [AC_MSG_RESULT(no)])
45 | AC_SUBST(LIBFCGIXX)
46 | AC_SUBST(ECHO_CPP)
47 |
48 | AC_LANG([C])
49 |
50 | AC_CHECK_LIB([nsl], [gethostbyname])
51 | AC_CHECK_LIB([socket], [socket])
52 |
53 | ACX_PTHREAD([THREADED=threaded${EXEEXT}])
54 | AC_SUBST([THREADED])
55 |
56 | FCGI_COMMON_CHECKS
57 |
58 | AC_REPLACE_FUNCS([strerror])
59 |
60 | AC_C_INLINE
61 |
62 | AC_CANONICAL_HOST
63 |
64 | AS_CASE([$host_os],
65 | [*mingw*], [SYSTEM=win32],
66 | [SYSTEM=unix]
67 | )
68 | AC_SUBST([SYSTEM])
69 |
70 | AS_CASE([$host_os],
71 | [*mingw*], [EXTRA_LIBS=-lws2_32],
72 | [EXTRA_LIBS=]
73 | )
74 | AC_SUBST([EXTRA_LIBS])
75 |
76 | AC_PROG_CC_WARNINGS
77 |
78 | AC_ARG_ENABLE([examples],
79 | [AS_HELP_STRING([--disable-examples], [Disable examples])],
80 | [enable_examples=$enableval],
81 | [enable_examples=yes])
82 | AM_CONDITIONAL([HAVE_EXAMPLES], [test x"$enable_examples" = xyes])
83 |
84 | AC_ARG_WITH([pkgconfigdir],
85 | [AS_HELP_STRING([--with-pkgconfigdir=DIR], [pkgconfig files])],
86 | [pkgconfigdir=$withval],
87 | [pkgconfigdir="\${libdir}/pkgconfig"])
88 | AC_SUBST([pkgconfigdir], [$pkgconfigdir])
89 |
90 | AC_CONFIG_FILES([Makefile
91 | cgi-fcgi/Makefile
92 | include/Makefile
93 | libfcgi/Makefile
94 | examples/Makefile
95 | fcgi.pc
96 | fcgi++.pc])
97 |
98 | AC_OUTPUT
99 |
100 |
--------------------------------------------------------------------------------
/java/FCGIGlobalDefs.java:
--------------------------------------------------------------------------------
1 | /*
2 | * @(#)FCGIGlobalDefs.java
3 | *
4 | *
5 | * FastCGi compatibility package Interface
6 | *
7 | *
8 | * Copyright (c) 1996 Open Market, Inc.
9 | *
10 | * See the file "LICENSE" for information on usage and redistribution
11 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
12 | *
13 | * $Id: FCGIGlobalDefs.java,v 1.3 2000/03/21 12:12:25 robs Exp $
14 | */
15 |
16 | /* This class contains FCGI global definitions corresponding to
17 | * the #defs in the C version.
18 | */
19 |
20 | package com.fastcgi;
21 |
22 | import java.io.PrintStream;
23 |
24 | public abstract class FCGIGlobalDefs
25 | {
26 | private static final String RCSID = "$Id: FCGIGlobalDefs.java,v 1.3 2000/03/21 12:12:25 robs Exp $";
27 |
28 | public static final int def_FCGIMaxLen = 0xffff;
29 | /*
30 | * Define Length of FCGI message bodies in bytes
31 | */
32 | public static final int def_FCGIHeaderLen = 8;
33 | public static final int def_FCGIEndReqBodyLen = 8;
34 | public static final int def_FCGIBeginReqBodyLen = 8;
35 | public static final int def_FCGIUnknownBodyTypeBodyLen = 8;
36 | /*
37 | * Header defines
38 | */
39 | public static int def_FCGIVersion1 = 1;
40 | /* FCGI Record Types */
41 | public static final int def_FCGIBeginRequest = 1;
42 | public static final int def_FCGIAbortRequest = 2;
43 | public static final int def_FCGIEndRequest = 3;
44 | public static final int def_FCGIParams = 4;
45 | public static final int def_FCGIStdin = 5;
46 | public static final int def_FCGIStdout = 6;
47 | public static final int def_FCGIStderr = 7;
48 | public static final int def_FCGIData = 8;
49 | public static final int def_FCGIGetValues = 9;
50 | public static final int def_FCGIGetValuesResult = 10;
51 | public static final int def_FCGIUnknownType = 11;
52 | public static final int def_FCGIMaxType = def_FCGIUnknownType;
53 | /* Request ID Values */
54 | public static final int def_FCGINullRequestID = 0;
55 | /*
56 | * Begin Request defines
57 | */
58 | /* Mask flags */
59 | public static int def_FCGIKeepConn = 1;
60 | /* Roles */
61 | public static final int def_FCGIResponder = 1;
62 | public static final int def_FCGIAuthorizer = 2;
63 | public static final int def_FCGIFilter = 3;
64 | /*
65 | * End Request defines
66 | */
67 | /* Protocol status */
68 | public static final int def_FCGIRequestComplete = 0;
69 | public static final int def_FCGICantMpxConn = 1;
70 | public static final int def_FCGIOverload = 2;
71 | public static final int def_FCGIUnknownRole = 3;
72 | /*
73 | * Get Values, Get Values Results defines
74 | */
75 | public static final String def_FCGIMaxConns = "FCGI_MAX_CONNS";
76 | public static final String def_FCGIMaxReqs = "FCGI_MAX_REQS";
77 | public static final String def_FCGIMpxsConns = "FCGI_MPXS_CONNS";
78 | /*
79 | * Return codes for Process* functions
80 | */
81 | public static final int def_FCGIStreamRecord = 0;
82 | public static final int def_FCGISkip = 1;
83 | public static final int def_FCGIBeginRecord = 2;
84 | public static final int def_FCGIMgmtRecord = 3;
85 | /*
86 | * Error Codes
87 | */
88 | public static final int def_FCGIUnsupportedVersion = -2;
89 | public static final int def_FCGIProtocolError = -3;
90 | public static final int def_FCGIParamsError = -4;
91 | public static final int def_FCGICallSeqError = -5;
92 | }
93 |
--------------------------------------------------------------------------------
/include/fastcgi.h:
--------------------------------------------------------------------------------
1 | /*
2 | * fastcgi.h --
3 | *
4 | * Defines for the FastCGI protocol.
5 | *
6 | *
7 | * Copyright (c) 1995-1996 Open Market, Inc.
8 | *
9 | * See the file "LICENSE" for information on usage and redistribution
10 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 | *
12 | * $Id: fastcgi.h,v 1.1.1.1 1997/09/16 15:36:32 stanleyg Exp $
13 | */
14 |
15 | #ifndef _FASTCGI_H
16 | #define _FASTCGI_H
17 |
18 | /*
19 | * Listening socket file number
20 | */
21 | #define FCGI_LISTENSOCK_FILENO 0
22 |
23 | typedef struct {
24 | unsigned char version;
25 | unsigned char type;
26 | unsigned char requestIdB1;
27 | unsigned char requestIdB0;
28 | unsigned char contentLengthB1;
29 | unsigned char contentLengthB0;
30 | unsigned char paddingLength;
31 | unsigned char reserved;
32 | } FCGI_Header;
33 |
34 | #define FCGI_MAX_LENGTH 0xffff
35 |
36 | /*
37 | * Number of bytes in a FCGI_Header. Future versions of the protocol
38 | * will not reduce this number.
39 | */
40 | #define FCGI_HEADER_LEN 8
41 |
42 | /*
43 | * Value for version component of FCGI_Header
44 | */
45 | #define FCGI_VERSION_1 1
46 |
47 | /*
48 | * Values for type component of FCGI_Header
49 | */
50 | #define FCGI_BEGIN_REQUEST 1
51 | #define FCGI_ABORT_REQUEST 2
52 | #define FCGI_END_REQUEST 3
53 | #define FCGI_PARAMS 4
54 | #define FCGI_STDIN 5
55 | #define FCGI_STDOUT 6
56 | #define FCGI_STDERR 7
57 | #define FCGI_DATA 8
58 | #define FCGI_GET_VALUES 9
59 | #define FCGI_GET_VALUES_RESULT 10
60 | #define FCGI_UNKNOWN_TYPE 11
61 | #define FCGI_MAXTYPE (FCGI_UNKNOWN_TYPE)
62 |
63 | /*
64 | * Value for requestId component of FCGI_Header
65 | */
66 | #define FCGI_NULL_REQUEST_ID 0
67 |
68 |
69 | typedef struct {
70 | unsigned char roleB1;
71 | unsigned char roleB0;
72 | unsigned char flags;
73 | unsigned char reserved[5];
74 | } FCGI_BeginRequestBody;
75 |
76 | typedef struct {
77 | FCGI_Header header;
78 | FCGI_BeginRequestBody body;
79 | } FCGI_BeginRequestRecord;
80 |
81 | /*
82 | * Mask for flags component of FCGI_BeginRequestBody
83 | */
84 | #define FCGI_KEEP_CONN 1
85 |
86 | /*
87 | * Values for role component of FCGI_BeginRequestBody
88 | */
89 | #define FCGI_RESPONDER 1
90 | #define FCGI_AUTHORIZER 2
91 | #define FCGI_FILTER 3
92 |
93 |
94 | typedef struct {
95 | unsigned char appStatusB3;
96 | unsigned char appStatusB2;
97 | unsigned char appStatusB1;
98 | unsigned char appStatusB0;
99 | unsigned char protocolStatus;
100 | unsigned char reserved[3];
101 | } FCGI_EndRequestBody;
102 |
103 | typedef struct {
104 | FCGI_Header header;
105 | FCGI_EndRequestBody body;
106 | } FCGI_EndRequestRecord;
107 |
108 | /*
109 | * Values for protocolStatus component of FCGI_EndRequestBody
110 | */
111 | #define FCGI_REQUEST_COMPLETE 0
112 | #define FCGI_CANT_MPX_CONN 1
113 | #define FCGI_OVERLOADED 2
114 | #define FCGI_UNKNOWN_ROLE 3
115 |
116 |
117 | /*
118 | * Variable names for FCGI_GET_VALUES / FCGI_GET_VALUES_RESULT records
119 | */
120 | #define FCGI_MAX_CONNS "FCGI_MAX_CONNS"
121 | #define FCGI_MAX_REQS "FCGI_MAX_REQS"
122 | #define FCGI_MPXS_CONNS "FCGI_MPXS_CONNS"
123 |
124 |
125 | typedef struct {
126 | unsigned char type;
127 | unsigned char reserved[7];
128 | } FCGI_UnknownTypeBody;
129 |
130 | typedef struct {
131 | FCGI_Header header;
132 | FCGI_UnknownTypeBody body;
133 | } FCGI_UnknownTypeRecord;
134 |
135 | #endif /* _FASTCGI_H */
136 |
137 |
--------------------------------------------------------------------------------
/Win32/FastCGI.dsw:
--------------------------------------------------------------------------------
1 | Microsoft Developer Studio Workspace File, Format Version 6.00
2 | # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
3 |
4 | ###############################################################################
5 |
6 | Project: "authorizer"=".\authorizer.dsp" - Package Owner=<4>
7 |
8 | Package=<5>
9 | {{{
10 | }}}
11 |
12 | Package=<4>
13 | {{{
14 | Begin Project Dependency
15 | Project_Dep_Name libfcgi
16 | End Project Dependency
17 | }}}
18 |
19 | ###############################################################################
20 |
21 | Project: "cgifcgi"=".\cgifcgi.dsp" - Package Owner=<4>
22 |
23 | Package=<5>
24 | {{{
25 | }}}
26 |
27 | Package=<4>
28 | {{{
29 | Begin Project Dependency
30 | Project_Dep_Name libfcgi
31 | End Project Dependency
32 | }}}
33 |
34 | ###############################################################################
35 |
36 | Project: "config_h"=".\config_h.dsp" - Package Owner=<4>
37 |
38 | Package=<5>
39 | {{{
40 | }}}
41 |
42 | Package=<4>
43 | {{{
44 | }}}
45 |
46 | ###############################################################################
47 |
48 | Project: "echo"=".\echo.dsp" - Package Owner=<4>
49 |
50 | Package=<5>
51 | {{{
52 | }}}
53 |
54 | Package=<4>
55 | {{{
56 | Begin Project Dependency
57 | Project_Dep_Name libfcgi
58 | End Project Dependency
59 | }}}
60 |
61 | ###############################################################################
62 |
63 | Project: "echo_cpp"=".\echo-cpp.dsp" - Package Owner=<4>
64 |
65 | Package=<5>
66 | {{{
67 | }}}
68 |
69 | Package=<4>
70 | {{{
71 | Begin Project Dependency
72 | Project_Dep_Name libfcgi
73 | End Project Dependency
74 | }}}
75 |
76 | ###############################################################################
77 |
78 | Project: "echox"=".\echox.dsp" - Package Owner=<4>
79 |
80 | Package=<5>
81 | {{{
82 | }}}
83 |
84 | Package=<4>
85 | {{{
86 | Begin Project Dependency
87 | Project_Dep_Name libfcgi
88 | End Project Dependency
89 | }}}
90 |
91 | ###############################################################################
92 |
93 | Project: "libfcgi"=".\libfcgi.dsp" - Package Owner=<4>
94 |
95 | Package=<5>
96 | {{{
97 | }}}
98 |
99 | Package=<4>
100 | {{{
101 | Begin Project Dependency
102 | Project_Dep_Name config_h
103 | End Project Dependency
104 | }}}
105 |
106 | ###############################################################################
107 |
108 | Project: "logdump"=".\logdump.dsp" - Package Owner=<4>
109 |
110 | Package=<5>
111 | {{{
112 | }}}
113 |
114 | Package=<4>
115 | {{{
116 | Begin Project Dependency
117 | Project_Dep_Name libfcgi
118 | End Project Dependency
119 | }}}
120 |
121 | ###############################################################################
122 |
123 | Project: "size"=".\size.dsp" - Package Owner=<4>
124 |
125 | Package=<5>
126 | {{{
127 | }}}
128 |
129 | Package=<4>
130 | {{{
131 | Begin Project Dependency
132 | Project_Dep_Name libfcgi
133 | End Project Dependency
134 | }}}
135 |
136 | ###############################################################################
137 |
138 | Project: "threaded"=".\threaded.dsp" - Package Owner=<4>
139 |
140 | Package=<5>
141 | {{{
142 | }}}
143 |
144 | Package=<4>
145 | {{{
146 | Begin Project Dependency
147 | Project_Dep_Name libfcgi
148 | End Project Dependency
149 | }}}
150 |
151 | ###############################################################################
152 |
153 | Global:
154 |
155 | Package=<5>
156 | {{{
157 | }}}
158 |
159 | Package=<3>
160 | {{{
161 | }}}
162 |
163 | ###############################################################################
164 |
165 |
--------------------------------------------------------------------------------
/include/fcgios.h:
--------------------------------------------------------------------------------
1 | /*
2 | * fcgios.h --
3 | *
4 | * Description of file.
5 | *
6 | *
7 | * Copyright (c) 1996 Open Market, Inc.
8 | * All rights reserved.
9 | *
10 | * This file contains proprietary and confidential information and
11 | * remains the unpublished property of Open Market, Inc. Use,
12 | * disclosure, or reproduction is prohibited except as permitted by
13 | * express written license agreement with Open Market, Inc.
14 | *
15 | * Bill Snapper
16 | * snapper@openmarket.com
17 | */
18 | #ifndef _FCGIOS_H
19 | #define _FCGIOS_H
20 |
21 | #ifdef _WIN32
22 | #define WIN32_LEAN_AND_MEAN
23 | #include
24 | #include
25 | #endif
26 |
27 | #include "fcgi_config.h"
28 |
29 | #ifdef HAVE_SYS_TIME_H
30 | #include
31 | #endif
32 |
33 | #ifdef HAVE_SYS_TYPES_H
34 | #include
35 | #endif
36 |
37 | #if defined (c_plusplus) || defined (__cplusplus)
38 | extern "C" {
39 | #endif
40 |
41 | #ifdef _WIN32
42 | #define OS_Errno GetLastError()
43 | #define OS_SetErrno(err) SetLastError(err)
44 | #ifndef O_NONBLOCK
45 | #define O_NONBLOCK 0x0004 /* no delay */
46 | #endif
47 | #else /* !_WIN32 */
48 | #define OS_Errno errno
49 | #define OS_SetErrno(err) errno = (err)
50 | #endif /* !_WIN32 */
51 |
52 | #ifndef DLLAPI
53 | #if defined (_WIN32) && defined (_MSC_VER)
54 | #define DLLAPI __declspec(dllimport)
55 | #else
56 | #define DLLAPI
57 | #endif
58 | #endif
59 |
60 |
61 | /* This is the initializer for a "struct timeval" used in a select() call
62 | * right after a new request is accept()ed to determine readablity. Its
63 | * a drop-dead timer. Its only used for AF_UNIX sockets (not TCP sockets).
64 | * Its a workaround for a kernel bug in Linux 2.0.x and SCO Unixware.
65 | * Making this as small as possible, yet remain reliable would be best.
66 | * 2 seconds is very conservative. 0,0 is not reliable. The shorter the
67 | * timeout, the faster request processing will recover. The longer the
68 | * timeout, the more likely this application being "busy" will cause other
69 | * requests to abort and cause more dead sockets that need this timeout. */
70 | #define READABLE_UNIX_FD_DROP_DEAD_TIMEVAL 2,0
71 |
72 | #ifndef STDIN_FILENO
73 | #define STDIN_FILENO 0
74 | #endif
75 |
76 | #ifndef STDOUT_FILENO
77 | #define STDOUT_FILENO 1
78 | #endif
79 |
80 | #ifndef STDERR_FILENO
81 | #define STDERR_FILENO 2
82 | #endif
83 |
84 | #ifndef MAXPATHLEN
85 | #define MAXPATHLEN 1024
86 | #endif
87 |
88 | #ifndef X_OK
89 | #define X_OK 0x01
90 | #endif
91 |
92 | #ifndef _CLIENTDATA
93 | # if defined(__STDC__) || defined(__cplusplus)
94 | typedef void *ClientData;
95 | # else
96 | typedef int *ClientData;
97 | # endif /* __STDC__ */
98 | #define _CLIENTDATA
99 | #endif
100 |
101 | typedef void (*OS_AsyncProc) (ClientData clientData, int len);
102 |
103 | DLLAPI int OS_LibInit(int stdioFds[3]);
104 | DLLAPI void OS_LibShutdown(void);
105 | DLLAPI int OS_CreateLocalIpcFd(const char *bindPath, int backlog);
106 | DLLAPI int OS_FcgiConnect(char *bindPath);
107 | DLLAPI int OS_Read(int fd, char * buf, size_t len);
108 | DLLAPI int OS_Write(int fd, char * buf, size_t len);
109 | DLLAPI int OS_SpawnChild(char *execPath, int listenFd);
110 | DLLAPI int OS_AsyncReadStdin(void *buf, int len, OS_AsyncProc procPtr,
111 | ClientData clientData);
112 | DLLAPI int OS_AsyncRead(int fd, int offset, void *buf, int len,
113 | OS_AsyncProc procPtr, ClientData clientData);
114 | DLLAPI int OS_AsyncWrite(int fd, int offset, void *buf, int len,
115 | OS_AsyncProc procPtr, ClientData clientData);
116 | DLLAPI int OS_Close(int fd, int shutdown);
117 | DLLAPI int OS_CloseRead(int fd);
118 | DLLAPI int OS_DoIo(struct timeval *tmo);
119 | DLLAPI int OS_Accept(int listen_sock, int fail_on_intr, const char *webServerAddrs);
120 | DLLAPI int OS_IpcClose(int ipcFd, int shutdown);
121 | DLLAPI int OS_IsFcgi(int sock);
122 | DLLAPI void OS_SetFlags(int fd, int flags);
123 |
124 | DLLAPI void OS_ShutdownPending(void);
125 |
126 | #if defined (__cplusplus) || defined (c_plusplus)
127 | } /* terminate extern "C" { */
128 | #endif
129 |
130 | #endif /* _FCGIOS_H */
131 |
--------------------------------------------------------------------------------
/examples/log-dump.c:
--------------------------------------------------------------------------------
1 | /*
2 | * log-dump.c --
3 | *
4 | * FastCGI example program to illustrate both an Authorizer and a
5 | * Responder in a single application that are used to provide access
6 | * to an ascii text file. The intent of this application is to
7 | * show the basic mechanics needed to display a log file for example
8 | * though any ascii text file should work.
9 | *
10 | *
11 | * Copyright (c) 1996 Open Market, Inc.
12 | *
13 | * See the file "LICENSE" for information on usage and redistribution
14 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
15 | *
16 | */
17 |
18 | #include "fcgi_config.h"
19 |
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 |
28 | #if defined __linux__
29 | int kill(pid_t pid, int sig);
30 | #endif
31 |
32 | #ifdef HAVE_UNISTD_H
33 | #include
34 | #endif
35 |
36 | #include "fcgi_stdio.h"
37 |
38 | static int successCount = 0;
39 | static int failureCount = 0;
40 |
41 | int main(void)
42 | {
43 | char *queryString = NULL;
44 | char *rolePtr;
45 | char *authPtr;
46 | char *fileNamePtr = NULL;
47 | int fd, n, i, j;
48 | char temp[4096];
49 | char temp2[5000];
50 |
51 | while(FCGI_Accept() >= 0) {
52 | rolePtr = getenv("FCGI_ROLE");
53 | if(rolePtr == NULL) {
54 | #ifndef _WIN32
55 | kill(getpid(), SIGQUIT);
56 | #endif
57 | exit(-1);
58 | }
59 | if(strstr(rolePtr, "AUTHORIZER")) {
60 | queryString = getenv("QUERY_STRING");
61 | if((queryString == NULL) ||
62 | (strstr(queryString, "showme_the_log") == NULL)) {
63 | failureCount++;
64 | printf("Status: 403 Forbidden\r\n"
65 | "Content-type: text/html\r\n"
66 | "\r\n"
67 | "FastCGI Forbidden!"
68 | "Access to URL: \"%s\" forbidden!
"
69 | "
This is password protected and you "
70 | "have not specified a valid password.
"
71 | "Total Failed Accesses: %d
",
72 | getenv("URL_PATH"), failureCount);
73 | } else {
74 | successCount++;
75 | printf("Status: 200 OK\r\n"
76 | "Variable-LOG_ACCESS: ACCESS_OK.%d\r\n"
77 | "\r\n", successCount);
78 | }
79 | continue;
80 | }
81 |
82 | /*
83 | * If we're being invoked as a RESPONDER, make sure that we've
84 | * been granted access to return the file or that the file being
85 | * requested is beyond access control (ie. per request file data).
86 | */
87 | if(strstr(rolePtr, "RESPONDER")) {
88 | authPtr = getenv("LOG_ACCESS");
89 | if((authPtr == NULL) || (strstr(authPtr, "ACCESS_OK") == NULL)) {
90 | failureCount++;
91 | printf("Content-type: text/html\r\n\r\n"
92 | "Access to log file \"%s\" denied
"
93 | "Total Invalid Access Attempts: %d\r\n\r\n",
94 | fileNamePtr, failureCount);
95 | continue;
96 | }
97 |
98 | fileNamePtr = getenv("LOG_FILE");
99 | if(fileNamePtr == NULL || *fileNamePtr == '\0') {
100 | failureCount++;
101 | printf("Content-type: text/html\r\n\r\n"
102 | "
No file specified.
>>"
103 | "Total Invalid Access Attempts: %d\r\n\r\n",
104 | failureCount);
105 | continue;
106 | }
107 |
108 | fd = open(fileNamePtr, O_RDONLY, (S_IRGRP | S_IROTH | S_IRUSR));
109 | if(fd < 0) {
110 | printf("Content-type: text/html\r\n\r\n"
111 | "
File Error trying to access file \"%s\".
"
112 | "Error = %s\r\n\r\n", fileNamePtr, strerror(errno));
113 | continue;
114 | }
115 | printf("Content-type: text/html\r\n\r\n"
116 | "Sending contents of file: %s
"
117 | "
Successful Accesses: %d
", fileNamePtr,
118 | successCount);
119 | while((n = read(fd, temp, 4096)) > 0) {
120 | j = 0;
121 | for(i = 0; i < n; i++) {
122 | temp2[j] = temp[i];
123 | if(temp[i] == '\n') {
124 | strcpy(&temp2[j], "");
125 | printf(temp2);
126 | j = 0;
127 | } else {
128 | j++;
129 | }
130 | }
131 | }
132 | close(fd);
133 | continue;
134 | }
135 | }
136 |
137 | exit(0);
138 | }
139 |
--------------------------------------------------------------------------------
/include/fcgio.h:
--------------------------------------------------------------------------------
1 | //
2 | // Provides support for FastCGI via C++ iostreams.
3 | //
4 | // $Id: fcgio.h,v 1.15 2002/02/25 13:16:11 robs Exp $
5 | //
6 | // This work is based on routines written by George Feinberg. They
7 | // have been mostly re-written and extensively changed by
8 | // Michael Richards.
9 | //
10 | // Rewritten again with bug fixes and numerous enhancements by
11 | // Michael Shell.
12 | //
13 | // And rewritten again by Rob Saccoccio.
14 | //
15 | // Special Thanks to Dietmar Kuehl for his help and the numerous custom
16 | // streambuf examples on his web site.
17 | //
18 | // Copyright (c) 2000 Tux the Linux Penguin
19 | // Copyright (c) 2001 Rob Saccoccio and Chelsea Networks
20 | //
21 | // You are free to use this software without charge or royalty
22 | // as long as this notice is not removed or altered, and recognition
23 | // is given to the author(s)
24 | //
25 | // This code is offered as-is without any warranty either expressed or
26 | // implied; without even the implied warranty of MERCHANTABILITY or
27 | // FITNESS FOR A PARTICULAR PURPOSE. If it breaks, you get to keep
28 | // both halves.
29 |
30 | #ifndef FCGIO_H
31 | #define FCGIO_H
32 |
33 | #include
34 |
35 | #include "fcgiapp.h"
36 |
37 | #ifndef DLLAPI
38 | #if defined (_WIN32) && defined (_MSC_VER)
39 | #define DLLAPI __declspec(dllimport)
40 | #else
41 | #define DLLAPI
42 | #endif
43 | #endif
44 |
45 | #if ! HAVE_STREAMBUF_CHAR_TYPE
46 | typedef char char_type;
47 | #endif
48 |
49 | /*
50 | * fcgi_streambuf
51 | */
52 | class DLLAPI fcgi_streambuf : public std::streambuf
53 | {
54 | public:
55 |
56 | // Note that if no buf is assigned (the default), iostream methods
57 | // such as peek(), unget() and putback() will fail. If a buf is
58 | // assigned, I/O is a bit less efficient and output streams will
59 | // have to be flushed (or the streambuf destroyed) before the next
60 | // call to "accept".
61 | fcgi_streambuf(FCGX_Stream * fcgx, char * buf, int len);
62 |
63 | fcgi_streambuf(char_type * buf, std::streamsize len);
64 |
65 | fcgi_streambuf(FCGX_Stream * fcgx = 0);
66 |
67 | ~fcgi_streambuf(void);
68 |
69 | int attach(FCGX_Stream * fcgx);
70 |
71 | protected:
72 |
73 | // Consume the put area (if buffered) and c (if c is not EOF).
74 | virtual int overflow(int);
75 |
76 | // Flush the put area (if buffered) and the FCGX buffer to the client.
77 | virtual int sync();
78 |
79 | // Remove and return the current character.
80 | virtual int uflow();
81 |
82 | // Fill the get area (if buffered) and return the current character.
83 | virtual int underflow();
84 |
85 | // Use a buffer. The only reasons that a buffer would be useful is
86 | // to support the use of the unget()/putback() or seek() methods. Using
87 | // a buffer will result in less efficient I/O. Note: the underlying
88 | // FastCGI library (FCGX) maintains its own input and output buffers.
89 | virtual std::streambuf * setbuf(char_type * buf, std::streamsize len);
90 |
91 | virtual std::streamsize xsgetn(char_type * s, std::streamsize n);
92 | virtual std::streamsize xsputn(const char_type * s, std::streamsize n);
93 |
94 | private:
95 |
96 | FCGX_Stream * fcgx;
97 |
98 | // buf is just handy to have around
99 | char_type * buf;
100 |
101 | // this isn't kept by the base class
102 | std::streamsize bufsize;
103 |
104 | void init(FCGX_Stream * fcgx, char_type * buf, std::streamsize bufsize);
105 |
106 | void reset(void);
107 | };
108 |
109 | /*
110 | * fcgi_istream - deprecated
111 | */
112 | class DLLAPI fcgi_istream : public std::istream
113 | {
114 | public:
115 |
116 | // deprecated
117 | fcgi_istream(FCGX_Stream * fcgx = 0);
118 |
119 | // deprecated
120 | ~fcgi_istream(void) {}
121 |
122 | // deprecated
123 | virtual void attach(FCGX_Stream * fcgx);
124 |
125 | private:
126 |
127 | fcgi_streambuf fcgi_strmbuf;
128 | };
129 |
130 | /*
131 | * fcgi_ostream - deprecated
132 | */
133 | class DLLAPI fcgi_ostream : public std::ostream
134 | {
135 | public:
136 |
137 | // deprecated
138 | fcgi_ostream(FCGX_Stream * fcgx = 0);
139 |
140 | // deprecated
141 | ~fcgi_ostream(void) {}
142 |
143 | // deprecated
144 | virtual void attach(FCGX_Stream *fcgx);
145 |
146 | private:
147 |
148 | fcgi_streambuf fcgi_strmbuf;
149 | };
150 |
151 | #endif /* FCGIO_H */
152 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | #
2 | # Makefile for FastCGI development kit
3 | #
4 | # $Id: Makefile.am,v 1.8 2003/11/02 21:42:47 robs Exp $
5 | #
6 |
7 | ACLOCAL_AMFLAGS = -I m4
8 |
9 | DISTCLEANFILES= compile config.guess config.sub configure configure~ depcomp fcgi_config.h.in fcgi_config.h.in~ \
10 | aclocal.m4 m4/libtool.m4 m4/lt*.m4 Makefile.in install-sh missing ltmain.sh \
11 | COPYING INSTALL fcgi-*.tar.gz
12 |
13 | SUBDIRS = libfcgi cgi-fcgi include
14 |
15 | if HAVE_EXAMPLES
16 | SUBDIRS += examples
17 | endif
18 |
19 | include_HEADERS = fcgi_config.h
20 |
21 | man_MANS= doc/cgi-fcgi.1 \
22 | doc/FCGI_Accept.3 \
23 | doc/FCGI_Finish.3 \
24 | doc/FCGI_SetExitStatus.3 \
25 | doc/FCGI_StartFilterData.3
26 |
27 | pkgconfigdir = @pkgconfigdir@
28 | pkgconfig_DATA = fcgi.pc \
29 | fcgi++.pc
30 |
31 | EXTRA_DIST = LICENSE \
32 | Makefile.nt \
33 | cgi-fcgi/cgi-fcgi.mak \
34 | examples/authorizer.mak \
35 | examples/echo.mak \
36 | examples/echox.mak \
37 | examples/size.mak \
38 | examples/echo-cpp.mak \
39 | libfcgi/libfcgi.mak \
40 | images/aplib-hd.gif \
41 | images/divider.gif \
42 | images/fcgi-hd.gif \
43 | images/mail-hd.gif \
44 | images/navbar.gif \
45 | images/serv-hd.gif \
46 | images/words-hd.gif \
47 | include/fcgi_config_x86.h \
48 | java/FCGIGlobalDefs.java \
49 | java/FCGIInputStream.java \
50 | java/FCGIInterface.java \
51 | java/FCGIMessage.java \
52 | java/FCGIOutputStream.java \
53 | java/FCGIRequest.java \
54 | libfcgi/os_unix.c \
55 | libfcgi/os_win32.c \
56 | perl/eg/echo.pl \
57 | perl/eg/remote.pl \
58 | perl/eg/threaded.pl \
59 | perl/README \
60 | perl/ChangeLog \
61 | perl/t/02-unix_domain_socket.t \
62 | perl/t/01-load.t \
63 | perl/FCGI.pm \
64 | perl/Makefile.PL \
65 | perl/MANIFEST \
66 | perl/MANIFEST.SKIP \
67 | perl/configure.in \
68 | perl/distrib \
69 | perl/configure.readme \
70 | perl/typemap \
71 | perl/FCGI.xs \
72 | Win32/FastCGI.dsw \
73 | Win32/authorizer.dsp \
74 | Win32/cgifcgi.dsp \
75 | Win32/config_h.dsp \
76 | Win32/echo-cpp.dsp \
77 | Win32/echo.dsp \
78 | Win32/echox.dsp \
79 | Win32/libfcgi.dsp \
80 | Win32/logdump.dsp \
81 | Win32/size.dsp \
82 | Win32/threaded.dsp \
83 | doc/FCGI_Accept.3 \
84 | doc/FCGI_Finish.3 \
85 | doc/FCGI_SetExitStatus.3 \
86 | doc/FCGI_StartFilterData.3 \
87 | doc/cgi-fcgi.1 \
88 | doc/fcgi-devel-kit.htm \
89 | doc/fcgi-java.htm \
90 | doc/fcgi-perf.htm \
91 | doc/fcgi-perl.htm \
92 | doc/fcgi-spec.html \
93 | doc/fcgi-tcl.htm \
94 | doc/omi-logo.gif \
95 | doc/overview.html \
96 | doc/www5-api-workshop.html \
97 | doc/fastcgi-prog-guide/ap_guida.htm \
98 | doc/fastcgi-prog-guide/ap_guide.htm \
99 | doc/fastcgi-prog-guide/apaman.htm \
100 | doc/fastcgi-prog-guide/ch1inta1.gif \
101 | doc/fastcgi-prog-guide/ch1intra.gif \
102 | doc/fastcgi-prog-guide/ch1intro.htm \
103 | doc/fastcgi-prog-guide/ch2c.htm \
104 | doc/fastcgi-prog-guide/ch3perl.htm \
105 | doc/fastcgi-prog-guide/ch4tcl.htm \
106 | doc/fastcgi-prog-guide/cover.htm \
107 | doc/fastcgi-prog-guide/covera.gif \
108 | doc/fastcgi-whitepaper/fastcgi.htm \
109 | doc/fastcgi-whitepaper/img00001.gif \
110 | doc/fastcgi-whitepaper/img00002.gif \
111 | doc/fastcgi-whitepaper/img00003.gif
112 |
113 | distclean-local:
114 | -rm -rf autom4te.cache
115 |
--------------------------------------------------------------------------------
/Win32/size.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="size" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=size - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "size.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "size.mak" CFG="size - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "size - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "size - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName "size"
27 | # PROP Scc_LocalPath ".."
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "size - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "size\Release"
37 | # PROP BASE Intermediate_Dir "size\Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\examples\size\Release"
42 | # PROP Intermediate_Dir "..\examples\size\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
47 | # SUBTRACT CPP /Fr
48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
50 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
51 | # ADD RSC /l 0x409 /d "NDEBUG"
52 | BSC32=bscmake.exe
53 | # ADD BASE BSC32 /nologo
54 | # ADD BSC32 /nologo
55 | LINK32=link.exe
56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
57 | # ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release"
58 |
59 | !ELSEIF "$(CFG)" == "size - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "../examples/size\Debug"
69 | # PROP Intermediate_Dir "../examples/size\Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /libpath:"..\libfcgi\Debug"
84 |
85 | !ENDIF
86 |
87 | # Begin Target
88 |
89 | # Name "size - Win32 Release"
90 | # Name "size - Win32 Debug"
91 | # Begin Group "Source Files"
92 |
93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
94 | # Begin Source File
95 |
96 | SOURCE=..\examples\size.c
97 | # End Source File
98 | # End Group
99 | # Begin Group "Header Files"
100 |
101 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
102 | # End Group
103 | # Begin Group "Resource Files"
104 |
105 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
106 | # End Group
107 | # End Target
108 | # End Project
109 |
--------------------------------------------------------------------------------
/Win32/echo.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="echo" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=echo - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "echo.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "echo.mak" CFG="echo - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "echo - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "echo - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName "echo"
27 | # PROP Scc_LocalPath ".."
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "echo - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "echo\Release"
37 | # PROP BASE Intermediate_Dir "echo\Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\examples\echo\Release"
42 | # PROP Intermediate_Dir "..\examples\echo\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
47 | # SUBTRACT CPP /Fr
48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
50 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
51 | # ADD RSC /l 0x409 /d "NDEBUG"
52 | BSC32=bscmake.exe
53 | # ADD BASE BSC32 /nologo
54 | # ADD BSC32 /nologo
55 | LINK32=link.exe
56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
57 | # ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release"
58 |
59 | !ELSEIF "$(CFG)" == "echo - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "../examples/echo\Debug"
69 | # PROP Intermediate_Dir "../examples/echo\Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 libfcgi.lib /nologo /profile /map /debug /machine:IX86 /libpath:"..\libfcgi\Debug"
84 | # SUBTRACT LINK32 /verbose
85 |
86 | !ENDIF
87 |
88 | # Begin Target
89 |
90 | # Name "echo - Win32 Release"
91 | # Name "echo - Win32 Debug"
92 | # Begin Group "Source Files"
93 |
94 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
95 | # Begin Source File
96 |
97 | SOURCE=..\examples\echo.c
98 | # End Source File
99 | # End Group
100 | # Begin Group "Header Files"
101 |
102 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
103 | # End Group
104 | # Begin Group "Resource Files"
105 |
106 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
107 | # End Group
108 | # End Target
109 | # End Project
110 |
--------------------------------------------------------------------------------
/Win32/cgifcgi.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="cgifcgi" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=cgifcgi - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "cgifcgi.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "cgifcgi.mak" CFG="cgifcgi - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "cgifcgi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "cgifcgi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName ""
27 | # PROP Scc_LocalPath ""
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "cgifcgi - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "Release"
37 | # PROP BASE Intermediate_Dir "Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\cgi-fcgi\Release"
42 | # PROP Intermediate_Dir "..\cgi-fcgi\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
47 | # SUBTRACT CPP /Fr
48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
50 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
51 | # ADD RSC /l 0x409 /d "NDEBUG"
52 | BSC32=bscmake.exe
53 | # ADD BASE BSC32 /nologo
54 | # ADD BSC32 /nologo
55 | LINK32=link.exe
56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
57 | # ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /out:"..\cgi-fcgi\Release\cgi-fcgi.exe" /libpath:"..\libfcgi\Release"
58 |
59 | !ELSEIF "$(CFG)" == "cgifcgi - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "../cgi-fcgi/Debug"
69 | # PROP Intermediate_Dir "../cgi-fcgi/Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /out:"..\cgi-fcgi\Debug\cgi-fcgi.exe" /libpath:"..\libfcgi\Debug"
84 |
85 | !ENDIF
86 |
87 | # Begin Target
88 |
89 | # Name "cgifcgi - Win32 Release"
90 | # Name "cgifcgi - Win32 Debug"
91 | # Begin Group "Source Files"
92 |
93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
94 | # Begin Source File
95 |
96 | SOURCE="..\cgi-fcgi\cgi-fcgi.c"
97 | # End Source File
98 | # End Group
99 | # Begin Group "Header Files"
100 |
101 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
102 | # End Group
103 | # Begin Group "Resource Files"
104 |
105 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
106 | # End Group
107 | # End Target
108 | # End Project
109 |
--------------------------------------------------------------------------------
/Win32/threaded.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="threaded" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=threaded - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "threaded.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "threaded.mak" CFG="threaded - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "threaded - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "threaded - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName ""
27 | # PROP Scc_LocalPath ""
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "threaded - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "Release"
37 | # PROP BASE Intermediate_Dir "Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\examples\threaded\Release"
42 | # PROP Intermediate_Dir "..\examples\threaded\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /Gi /GX /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
47 | # SUBTRACT CPP /Fr
48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
50 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
51 | # ADD RSC /l 0x409 /d "NDEBUG"
52 | BSC32=bscmake.exe
53 | # ADD BASE BSC32 /nologo
54 | # ADD BSC32 /nologo
55 | LINK32=link.exe
56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
57 | # ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release"
58 |
59 | !ELSEIF "$(CFG)" == "threaded - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "..\examples/threaded/Debug"
69 | # PROP Intermediate_Dir "..\examples/threaded/Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /libpath:"..\libfcgi\Debug"
84 |
85 | !ENDIF
86 |
87 | # Begin Target
88 |
89 | # Name "threaded - Win32 Release"
90 | # Name "threaded - Win32 Debug"
91 | # Begin Group "Source Files"
92 |
93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
94 | # Begin Source File
95 |
96 | SOURCE=..\examples\threaded.c
97 | # PROP Exclude_From_Build 1
98 | # End Source File
99 | # End Group
100 | # Begin Group "Header Files"
101 |
102 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
103 | # End Group
104 | # Begin Group "Resource Files"
105 |
106 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
107 | # End Group
108 | # End Target
109 | # End Project
110 |
--------------------------------------------------------------------------------
/Win32/echox.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="echox" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=echox - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "echox.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "echox.mak" CFG="echox - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "echox - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "echox - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName "echox"
27 | # PROP Scc_LocalPath ".."
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "echox - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "echo-x\Release"
37 | # PROP BASE Intermediate_Dir "echo-x\Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\examples\echo-x\Release"
42 | # PROP Intermediate_Dir "..\examples\echo-x\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
47 | # SUBTRACT CPP /Fr
48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
50 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
51 | # ADD RSC /l 0x409 /d "NDEBUG"
52 | BSC32=bscmake.exe
53 | # ADD BASE BSC32 /nologo
54 | # ADD BSC32 /nologo
55 | LINK32=link.exe
56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
57 | # ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /out:"..\examples\echo-x\Release\echo-x.exe" /libpath:"..\libfcgi\Release"
58 |
59 | !ELSEIF "$(CFG)" == "echox - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "../examples/echo-x\Debug"
69 | # PROP Intermediate_Dir "../examples/echo-x\Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /out:"..\examples\echo-x\Debug\echo-x.exe" /libpath:"..\libfcgi\Debug"
84 |
85 | !ENDIF
86 |
87 | # Begin Target
88 |
89 | # Name "echox - Win32 Release"
90 | # Name "echox - Win32 Debug"
91 | # Begin Group "Source Files"
92 |
93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
94 | # Begin Source File
95 |
96 | SOURCE="..\examples\echo-x.c"
97 | # End Source File
98 | # End Group
99 | # Begin Group "Header Files"
100 |
101 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
102 | # End Group
103 | # Begin Group "Resource Files"
104 |
105 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
106 | # End Group
107 | # End Target
108 | # End Project
109 |
--------------------------------------------------------------------------------
/Win32/echo-cpp.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="echo_cpp" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=echo_cpp - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "echo-cpp.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "echo-cpp.mak" CFG="echo_cpp - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "echo_cpp - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "echo_cpp - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName ""
27 | # PROP Scc_LocalPath ""
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "echo_cpp - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "echo-cpp\Release"
37 | # PROP BASE Intermediate_Dir "echo-cpp\Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\examples\echo-cpp\Release"
42 | # PROP Intermediate_Dir "..\examples\echo-cpp\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /Gi /GX /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
47 | # SUBTRACT CPP /Fr
48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
50 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
51 | # ADD RSC /l 0x409 /d "NDEBUG"
52 | BSC32=bscmake.exe
53 | # ADD BASE BSC32 /nologo
54 | # ADD BSC32 /nologo
55 | LINK32=link.exe
56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
57 | # ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release"
58 |
59 | !ELSEIF "$(CFG)" == "echo_cpp - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "../examples/echo-cpp\Debug"
69 | # PROP Intermediate_Dir "../examples/echo-cpp\Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /libpath:"..\libfcgi\Debug"
84 |
85 | !ENDIF
86 |
87 | # Begin Target
88 |
89 | # Name "echo_cpp - Win32 Release"
90 | # Name "echo_cpp - Win32 Debug"
91 | # Begin Group "Source Files"
92 |
93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
94 | # Begin Source File
95 |
96 | SOURCE="..\examples\echo-cpp.cpp"
97 | # End Source File
98 | # End Group
99 | # Begin Group "Header Files"
100 |
101 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
102 | # End Group
103 | # Begin Group "Resource Files"
104 |
105 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
106 | # End Group
107 | # End Target
108 | # End Project
109 |
--------------------------------------------------------------------------------
/doc/fastcgi-prog-guide/cover.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | FastCGI Programmer's Guide
6 |
7 |
12 |
13 |
14 |
15 | [Top] [Prev] [Next] [Bottom]
16 |
17 |
18 |
19 |
20 |
21 | Open Market FastCGI 1.0
22 |
23 |
24 |
25 | Open Market, Inc.
26 | 245 First Street, Cambridge, MA 02142
27 | T: 617-621-9500 F: 617-252-3492
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 | Programmer's Guide
36 |
37 |
38 | April 15, 1996 s p/n 42-10530-001 Rev. A
39 |
40 |
41 |
42 |
43 |
44 | OPEN MARKET, INC., PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
45 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR
46 | PURPOSE. In no event shall Open Market be liable for any loss of profits, loss of business, loss of use of
47 | data, interruption of business, or for indirect, special, incidental, or consequential damages of any kind,
48 | even if Open Market has been advised of the possibility of such damages arising from any defect or error in
49 | this publication.
50 |
51 |
52 |
53 |
54 |
55 | Open Market may revise this publication from time to time without notice. Some states or
56 | jurisdictions do not allow disclaimer of express or implied warranties in certain transactions; therefore,
57 | this statement may not apply to you.
58 |
59 |
60 |
61 |
62 |
63 | Copyright © 1996 Open Market, Inc.
64 |
65 |
66 |
67 |
68 |
69 | All rights reserved.
70 |
71 |
72 |
73 |
74 |
75 | Alpha/OSF is a trademark of Digital Equipment Corporation.
76 |
77 |
78 | Digital UNIX is a trademark of Digital Equipment Corporation.
79 | BSD/386 is a trademark of Berkeley Software Design, Inc.
80 | BSD/OS is a trademark of Berkeley Software Design, Inc.
81 |
82 |
83 | Great Circle is a trademark of Geodesic Systems, Inc.
84 | HP-UX is a trademark of Hewlett-Packard Co., Inc.
85 | IBM AIX is a trademark of International Business Machines, Inc.
86 | Word is a trademark of Microsoft Corporation.
87 | Netscape is a trademark of Netscape Communications Company.
88 | PostScript is a trademark of Adobe Systems Inc.
89 |
90 |
91 | Purify is a trademark of Pure Software, Inc.
92 | SecureWeb is a trademark of Terisa Systems, Inc.
93 | HylaFAX is a trademark of Silicon Graphics, Inc.
94 | SGI IRIX is a trademark of Silicon Graphics, Inc.
95 | Solaris is a trademark of Sun Microsystems, Inc.
96 | SunOS is a trademark of Sun Microsystems, Inc.
97 | UNIX is a trademark of UNIX Systems Laboratories, Inc.
98 |
99 |
100 |
101 |
102 |
103 | Any other trademarks and product names used herein may be the trademarks of their
104 | respective companies.
105 |
106 |
107 | [Top] [Prev] [Next] [Bottom]
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
--------------------------------------------------------------------------------
/Win32/authorizer.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="authorizer" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=authorizer - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "authorizer.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "authorizer.mak" CFG="authorizer - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "authorizer - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "authorizer - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName ""
27 | # PROP Scc_LocalPath ""
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "authorizer - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "Release"
37 | # PROP BASE Intermediate_Dir "Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\examples\authorizer\Release"
42 | # PROP Intermediate_Dir "..\examples\authorizer\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
47 | # SUBTRACT CPP /Fr
48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
50 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
51 | # ADD RSC /l 0x409 /d "NDEBUG"
52 | BSC32=bscmake.exe
53 | # ADD BASE BSC32 /nologo
54 | # ADD BSC32 /nologo
55 | LINK32=link.exe
56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
57 | # ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /libpath:"..\libfcgi\Release"
58 |
59 | !ELSEIF "$(CFG)" == "authorizer - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "..\examples/authorizer/Debug"
69 | # PROP Intermediate_Dir "..\examples/authorizer/Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /libpath:"..\libfcgi\Debug"
84 |
85 | !ENDIF
86 |
87 | # Begin Target
88 |
89 | # Name "authorizer - Win32 Release"
90 | # Name "authorizer - Win32 Debug"
91 | # Begin Group "Source Files"
92 |
93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
94 | # Begin Source File
95 |
96 | SOURCE=..\examples\authorizer.c
97 | # End Source File
98 | # End Group
99 | # Begin Group "Header Files"
100 |
101 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
102 | # End Group
103 | # Begin Group "Resource Files"
104 |
105 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
106 | # End Group
107 | # End Target
108 | # End Project
109 |
--------------------------------------------------------------------------------
/Win32/logdump.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="logdump" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=logdump - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "logdump.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "logdump.mak" CFG="logdump - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "logdump - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "logdump - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName "logdump"
27 | # PROP Scc_LocalPath ".."
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "logdump - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "log-dump\Release"
37 | # PROP BASE Intermediate_Dir "log-dump\Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\examples\log-dump\Release"
42 | # PROP Intermediate_Dir "..\examples\log-dump\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
47 | # SUBTRACT CPP /Fr
48 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
50 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
51 | # ADD RSC /l 0x409 /d "NDEBUG"
52 | BSC32=bscmake.exe
53 | # ADD BASE BSC32 /nologo
54 | # ADD BSC32 /nologo
55 | LINK32=link.exe
56 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
57 | # ADD LINK32 libfcgi.lib /nologo /pdb:none /machine:IX86 /out:"..\examples\log-dump\Release\log-dump.exe" /libpath:"..\libfcgi\Release"
58 |
59 | !ELSEIF "$(CFG)" == "logdump - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "../examples/log-dump\Debug"
69 | # PROP Intermediate_Dir "../examples/log-dump\Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 libfcgi.lib /nologo /profile /debug /machine:IX86 /out:"..\examples\log-dump\Debug\log-dump.exe" /libpath:"..\libfcgi\Debug"
84 |
85 | !ENDIF
86 |
87 | # Begin Target
88 |
89 | # Name "logdump - Win32 Release"
90 | # Name "logdump - Win32 Debug"
91 | # Begin Group "Source Files"
92 |
93 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
94 | # Begin Source File
95 |
96 | SOURCE="..\examples\log-dump.c"
97 | # PROP Exclude_From_Build 1
98 | # End Source File
99 | # End Group
100 | # Begin Group "Header Files"
101 |
102 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
103 | # End Group
104 | # Begin Group "Resource Files"
105 |
106 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
107 | # End Group
108 | # End Target
109 | # End Project
110 |
--------------------------------------------------------------------------------
/doc/fastcgi-prog-guide/ch4tcl.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | FastCGI Programmer's Guide - Chapter 4, Developing FastCGI Applications in Tcl
6 |
7 |
14 |
15 |
16 | [Top] [Prev] [Next] [Bottom]
18 |
19 |
20 |
21 |
22 |
23 | 4 Developing FastCGI
24 | Applications in Tcl
25 |
26 |
27 |
28 |
29 | This chapter explains how to code FastCGI applications in Tcl. Prior to creating a FastCGI application, you
30 | must have a FastCGI-savvy version of the Tcl interpreter. Open Market develops Tcl binaries for popular
31 | platforms and makes them available with our developer's kit.
32 |
33 |
34 | The FastCGI-savvy binaries are extensions of standard Tcl, and are intended to replace
35 | your existing Tcl installation. There is no need to maintain two versions of Tcl: the version that we supply
36 | will work fine when invoked from a shell or a CGI program. There are also directions in the developer's
37 | kit for how to make your own FastCGI-savvy Tcl, if you need a version for some platform that we don't
38 | supply.
39 |
40 |
41 | In many cases, you can convert a Tcl script from CGI to FastCGI by adding a few lines of
42 | code to an existing script. For more complex scripts, you may also need to rearrange some existing code.
43 |
44 |
45 |
46 |
47 | Getting Started
48 |
49 |
50 |
51 | The first line of any Tcl script typically specifies the pathname of the Tcl interpreter itself. You must
52 | specify the pathname of a FastCGI-savvy Tcl.
53 |
54 |
55 | Then, you have to divide FastCGI scripts into the following two sections:
56 |
57 |
58 |
59 |
60 | -
61 |
62 |
63 | -
64 | Initialization section, which is executed only once.
65 |
66 | -
67 | Response loop section, which gets executed every time the FastCGI script gets called.
68 |
69 |
70 |
71 |
72 | A response loop typically has the following format:
73 |
74 |
75 |
76 |
77 | while {[FCGI_Accept] >= 0 } {
78 |
79 | # body of response loop
80 |
81 | }
82 |
83 |
84 |
85 |
86 | The FCGI_Accept call returns 0 whenever a client requests the FastCGI script. Otherwise, the
87 | FCGI_Accept call returns -1.
88 |
89 |
90 |
91 |
92 | Example: TinyFastCGI
93 |
94 |
95 |
96 | Here is a simple example of a FastCGI application written in Tcl:
97 |
98 |
99 |
100 |
101 |
102 | #!fcgi-savvy-tcl
103 |
104 | set count 0
105 |
106 | # Response Loop
107 | while {[FCGI_Accept] >= 0 } {
108 | incr count
109 | puts -nonewline "Content-type: text/html\r\n\r\n"
110 | puts "<title>FastCGI Hello! (Tcl)</title>"
111 | puts "<h1>FastCGI Hello! (Tcl)</h1>"
112 | puts "Request number $count running on host <i>$env(SERVER_NAME)</i>"
113 | }
114 |
115 |
116 |
117 |
118 |
119 | [Top] [Prev] [Next] [Bottom]
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
--------------------------------------------------------------------------------
/doc/cgi-fcgi.1:
--------------------------------------------------------------------------------
1 | NAME
2 | cgi-fcgi - bridge from CGI to FastCGI
3 |
4 | SYNOPSIS
5 | cgi-fcgi -f cmdPath
6 | cgi-fcgi -bind -connect connName
7 | cgi-fcgi -start -connect connName appPath [nServers]
8 | cgi-fcgi -connect connName appPath [nServers]
9 |
10 | DESCRIPTION
11 | cgi-fcgi is a CGI/1.1 program that communicates with an
12 | already-running FastCGI application in order to respond to an
13 | HTTP request. cgi-fcgi is also capable of starting a FastCGI
14 | application.
15 |
16 | When you invoke cgi-fcgi as
17 |
18 | cgi-fcgi -f cmdPath
19 |
20 | then cgi-fcgi opens the file at cmdPath and reads its
21 | arguments from that file. cgi-fcgi will skip lines
22 | that begin with the comment character #. The first
23 | non-comment line should contain valid arguments in
24 | one of the other three forms.
25 |
26 | The -f form of cgi-fcgi is designed for Unix systems
27 | whose exec(2) family of system calls supports the execution of
28 | command interpreter files. For instance, if a file with
29 | execute permission contains the text
30 |
31 | #! /bin/cgi-fcgi -f
32 | -connect /httpd/root/sock/app /httpd/root/bin/app
33 |
34 | the effect is the same as executing
35 |
36 | /bin/cgi-fcgi -connect /httpd/root/sock/app /httpd/root/bin/app
37 |
38 | When you invoke cgi-fcgi as
39 |
40 | cgi-fcgi -bind -connect connName
41 |
42 | the connName argument is either the path name of a Unix domain
43 | listening socket or a host:port pair. If connName contains
44 | a colon, it is assumed to be host:port. cgi-fcgi performs
45 | a connect(2) using connName. If the connect succeeds, cgi-fcgi
46 | forwards the CGI environment variables and stdin data to the
47 | FastCGI application, and forwards the stdout and stderr data from
48 | the application to cgi-fcgi's stdout (most likely connected to
49 | a Web server). When the FastCGI application signals the end of
50 | its response, cgi-fcgi flushes its buffers and
51 | exits, and the Web server completes the http response.
52 |
53 | When you invoke cgi-fcgi as
54 |
55 | cgi-fcgi -start -connect connName appPath [nServers]
56 |
57 | then cgi-fcgi performs the function of starting one or more
58 | FastCGI application processes. The connName argument specifies
59 | either the path name of the Unix domain listening socket that
60 | cgi-fcgi will create, or is "localhost:NNN" where NNN is the port
61 | number of the TCP/IP listening socket that cgi-fcgi will create
62 | on the local machine. (cgi-fcgi will not create processes
63 | on remote machines.) After cgi-fcgi creates the listening socket,
64 | it forks nServers copies of a process running the executable file
65 | appPath. If nServers is omitted, the effect is as if the value "1"
66 | had been specified. The processes share the single listening socket.
67 |
68 | When you invoke cgi-fcgi as
69 |
70 | cgi-fcgi -connect connName appPath [nServers]
71 |
72 | cgi-fcgi performs -bind and then, if necssary, performs -start
73 | and repeats the -bind. That is, cgi-fcgi first operates as if
74 | the command had been
75 |
76 | cgi-fcgi -bind -connect connName
77 |
78 | If the connect fails, cgi-fcgi tries
79 |
80 | cgi-fcgi -start -connect connName appPath [nServers]
81 |
82 | and finally retries
83 |
84 | cgi-fcgi -bind -connect connName
85 |
86 | In this form, cgi-fcgi does not support TCP/IP connections.
87 |
88 | ENVIRONMENT VARIABLES
89 | The usual CGI ones, but they are not interpreted by cgi-fcgi.
90 |
91 | SEE ALSO
92 | FGCI_accept(3)
93 |
94 | BUGS
95 | cgi-fcgi doesn't generate useful HTTP responses in case of error,
96 | and it generates no response at all when run as start-fcgi.
97 |
98 | On Digital UNIX 3.0 systems the implementation of Unix Domain
99 | sockets does not work when such sockets are stored on NFS file
100 | systems. Symptom: cgi-fcgi may core dump or may exit with
101 | status 38. Work-around: store sockets in local file systems
102 | (/tmp often works) or use TCP/IP.
103 |
104 | On AIX systems the implementation of listening sockets
105 | does not support socket sharing, and the standard FastCGI
106 | application libraries can't synchronize access to AIX listening
107 | sockets. Work-around: Don't use the nServers argument on AIX.
108 |
109 | HISTORY
110 | Copyright (c) 1996 Open Market, Inc.
111 | See the file "LICENSE" for information on usage and redistribution
112 | of this file, and for a DISCLAIMER OF ALL WARRANTIES.
113 | $Id: cgi-fcgi.1,v 1.1.1.1 1997/09/16 15:36:26 stanleyg Exp $
114 |
--------------------------------------------------------------------------------
/examples/size.mak:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Generated NMAKE File, Based on size.dsp
2 |
3 | !IF "$(CFG)" == ""
4 | CFG=release
5 | !ENDIF
6 |
7 | !IF "$(CFG)" != "release" && "$(CFG)" != "debug"
8 | !MESSAGE Invalid configuration "$(CFG)" specified.
9 | !MESSAGE You can specify a configuration when running NMAKE
10 | !MESSAGE by defining the macro CFG on the command line. For example:
11 | !MESSAGE
12 | !MESSAGE NMAKE /f "size.mak" CFG="debug"
13 | !MESSAGE
14 | !MESSAGE Possible choices for configuration are:
15 | !MESSAGE
16 | !MESSAGE "release" (based on "Win32 (x86) Dynamic-Link Library")
17 | !MESSAGE "debug" (based on "Win32 (x86) Dynamic-Link Library")
18 | !MESSAGE
19 | !ERROR An invalid configuration is specified.
20 | !ENDIF
21 |
22 | !IF "$(OS)" == "Windows_NT"
23 | NULL=
24 | !ELSE
25 | NULL=nul
26 | !ENDIF
27 |
28 | !IF "$(CFG)" == "release"
29 |
30 | OUTDIR=.\..\examples\size\Release
31 | INTDIR=.\..\examples\size\Release
32 | # Begin Custom Macros
33 | OutDir=.\..\examples\size\Release
34 | # End Custom Macros
35 |
36 | ALL : "$(OUTDIR)\size.exe"
37 |
38 | CLEAN :
39 | -@erase "$(INTDIR)\size.obj"
40 | -@erase "$(INTDIR)\vc60.idb"
41 | -@erase "$(OUTDIR)\size.exe"
42 |
43 | "$(OUTDIR)" :
44 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
45 |
46 | CPP=cl.exe
47 | CPP_PROJ=/nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\size.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
48 |
49 | .c{$(INTDIR)}.obj::
50 | $(CPP) @<<
51 | $(CPP_PROJ) $<
52 | <<
53 |
54 | .cpp{$(INTDIR)}.obj::
55 | $(CPP) @<<
56 | $(CPP_PROJ) $<
57 | <<
58 |
59 | .cxx{$(INTDIR)}.obj::
60 | $(CPP) @<<
61 | $(CPP_PROJ) $<
62 | <<
63 |
64 | .c{$(INTDIR)}.sbr::
65 | $(CPP) @<<
66 | $(CPP_PROJ) $<
67 | <<
68 |
69 | .cpp{$(INTDIR)}.sbr::
70 | $(CPP) @<<
71 | $(CPP_PROJ) $<
72 | <<
73 |
74 | .cxx{$(INTDIR)}.sbr::
75 | $(CPP) @<<
76 | $(CPP_PROJ) $<
77 | <<
78 |
79 | MTL=midl.exe
80 | MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
81 | RSC=rc.exe
82 | BSC32=bscmake.exe
83 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\size.bsc"
84 | BSC32_SBRS= \
85 |
86 | LINK32=link.exe
87 | LINK32_FLAGS=libfcgi.lib /nologo /pdb:none /out:"$(OUTDIR)\size.exe" /libpath:"..\libfcgi\Release"
88 | LINK32_OBJS= \
89 | "$(INTDIR)\size.obj" \
90 | "..\libfcgi\Release\libfcgi.lib"
91 |
92 | "$(OUTDIR)\size.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
93 | $(LINK32) @<<
94 | $(LINK32_FLAGS) $(LINK32_OBJS)
95 | <<
96 |
97 | !ELSEIF "$(CFG)" == "debug"
98 |
99 | OUTDIR=.\../examples/size\Debug
100 | INTDIR=.\../examples/size\Debug
101 | # Begin Custom Macros
102 | OutDir=.\../examples/size\Debug
103 | # End Custom Macros
104 |
105 | ALL : "$(OUTDIR)\size.exe" "$(OUTDIR)\size.bsc"
106 |
107 | CLEAN :
108 | -@erase "$(INTDIR)\size.obj"
109 | -@erase "$(INTDIR)\size.sbr"
110 | -@erase "$(INTDIR)\vc60.idb"
111 | -@erase "$(INTDIR)\vc60.pdb"
112 | -@erase "$(OUTDIR)\size.bsc"
113 | -@erase "$(OUTDIR)\size.exe"
114 |
115 | "$(OUTDIR)" :
116 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
117 |
118 | CPP=cl.exe
119 | CPP_PROJ=/nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\size.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
120 |
121 | .c{$(INTDIR)}.obj::
122 | $(CPP) @<<
123 | $(CPP_PROJ) $<
124 | <<
125 |
126 | .cpp{$(INTDIR)}.obj::
127 | $(CPP) @<<
128 | $(CPP_PROJ) $<
129 | <<
130 |
131 | .cxx{$(INTDIR)}.obj::
132 | $(CPP) @<<
133 | $(CPP_PROJ) $<
134 | <<
135 |
136 | .c{$(INTDIR)}.sbr::
137 | $(CPP) @<<
138 | $(CPP_PROJ) $<
139 | <<
140 |
141 | .cpp{$(INTDIR)}.sbr::
142 | $(CPP) @<<
143 | $(CPP_PROJ) $<
144 | <<
145 |
146 | .cxx{$(INTDIR)}.sbr::
147 | $(CPP) @<<
148 | $(CPP_PROJ) $<
149 | <<
150 |
151 | MTL=midl.exe
152 | MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
153 | RSC=rc.exe
154 | BSC32=bscmake.exe
155 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\size.bsc"
156 | BSC32_SBRS= \
157 | "$(INTDIR)\size.sbr"
158 |
159 | "$(OUTDIR)\size.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
160 | $(BSC32) @<<
161 | $(BSC32_FLAGS) $(BSC32_SBRS)
162 | <<
163 |
164 | LINK32=link.exe
165 | LINK32_FLAGS=libfcgi.lib /nologo /profile /debug /out:"$(OUTDIR)\size.exe" /libpath:"..\libfcgi\Debug"
166 | LINK32_OBJS= \
167 | "$(INTDIR)\size.obj" \
168 | "..\libfcgi\Debug\libfcgi.lib"
169 |
170 | "$(OUTDIR)\size.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
171 | $(LINK32) @<<
172 | $(LINK32_FLAGS) $(LINK32_OBJS)
173 | <<
174 |
175 | !ENDIF
176 |
177 |
178 | ..\examples\size.c : \
179 | "..\include\fcgiapp.h"\
180 |
181 |
182 | !IF "$(CFG)" == "release" || "$(CFG)" == "debug"
183 | SOURCE=..\examples\size.c
184 |
185 | !IF "$(CFG)" == "release"
186 |
187 |
188 | "$(INTDIR)\size.obj" : $(SOURCE) "$(INTDIR)"
189 | $(CPP) $(CPP_PROJ) $(SOURCE)
190 |
191 |
192 | !ELSEIF "$(CFG)" == "debug"
193 |
194 |
195 | "$(INTDIR)\size.obj" "$(INTDIR)\size.sbr" : $(SOURCE) "$(INTDIR)"
196 | $(CPP) $(CPP_PROJ) $(SOURCE)
197 |
198 |
199 | !ENDIF
200 |
201 | !ENDIF
202 |
203 |
--------------------------------------------------------------------------------
/libfcgi/fcgio.cpp:
--------------------------------------------------------------------------------
1 | //
2 | // $Id: fcgio.cpp,v 1.14 2003/06/22 00:51:27 robs Exp $
3 | //
4 | // Allows you communicate with FastCGI streams using C++ iostreams
5 | //
6 | // ORIGINAL AUTHOR: George Feinberg
7 | // REWRITTEN BY: Michael Richards 06/20/1999
8 | // REWRITTEN AGAIN BY: Michael Shell 02/23/2000
9 | // REWRITTEN AGAIN BY: Rob Saccoccio 11 Nov 2001
10 | //
11 | // Copyright (c) 2000 Tux the Linux Penguin
12 | //
13 | // You are free to use this software without charge or royalty
14 | // as long as this notice is not removed or altered, and recognition
15 | // is given to the author(s)
16 | //
17 | // This code is offered as-is without any warranty either expressed or
18 | // implied; without even the implied warranty of MERCHANTABILITY or
19 | // FITNESS FOR A PARTICULAR PURPOSE.
20 |
21 | #include
22 | #include
23 | #include "fcgio.h"
24 |
25 | using std::streambuf;
26 | using std::istream;
27 | using std::ostream;
28 | using std::streamsize;
29 |
30 | fcgi_streambuf::fcgi_streambuf(FCGX_Stream * fs, char * b, int bs)
31 | {
32 | init(fs, b, bs);
33 | }
34 |
35 | fcgi_streambuf::fcgi_streambuf(char_type * b, streamsize bs)
36 | {
37 | init(0, b, bs);
38 | }
39 |
40 | fcgi_streambuf::fcgi_streambuf(FCGX_Stream * fs)
41 | {
42 | init(fs, 0, 0);
43 | }
44 |
45 | fcgi_streambuf::~fcgi_streambuf(void)
46 | {
47 | overflow(EOF);
48 | // FCGX_Finish()/FCGX_Accept() will flush and close
49 | }
50 |
51 | void fcgi_streambuf::init(FCGX_Stream * fs, char_type * b, streamsize bs)
52 | {
53 | this->fcgx = fs;
54 | this->buf = 0;
55 | this->bufsize = 0;
56 | setbuf(b, bs);
57 | }
58 |
59 | int fcgi_streambuf::overflow(int c)
60 | {
61 | if (this->bufsize)
62 | {
63 | int plen = pptr() - pbase();
64 |
65 | if (plen)
66 | {
67 | if (FCGX_PutStr(pbase(), plen, this->fcgx) != plen) return EOF;
68 | pbump(-plen);
69 | }
70 | }
71 |
72 | if (c != EOF)
73 | {
74 | if (FCGX_PutChar(c, this->fcgx) != c) return EOF;
75 | }
76 |
77 | return 0;
78 | }
79 |
80 | // default base class behaviour seems to be inconsistent
81 | int fcgi_streambuf::sync()
82 | {
83 | if (overflow(EOF)) return EOF;
84 | if (FCGX_FFlush(this->fcgx)) return EOF;
85 | return 0;
86 | }
87 |
88 | // uflow() removes the char, underflow() doesn't
89 | int fcgi_streambuf::uflow()
90 | {
91 | if (this->bufsize)
92 | {
93 | int c = underflow();
94 | gbump(1);
95 | return c;
96 | }
97 | else
98 | {
99 | return FCGX_GetChar(this->fcgx);
100 | }
101 | }
102 |
103 | int fcgi_streambuf::underflow()
104 | {
105 | if (this->bufsize)
106 | {
107 | if (in_avail() == 0)
108 | {
109 | int glen = FCGX_GetStr(eback(), this->bufsize, this->fcgx);
110 | if (glen <= 0) return EOF;
111 |
112 | setg(eback(), eback(), eback() + glen);
113 | }
114 |
115 | return (unsigned char) *gptr();
116 | }
117 | else
118 | {
119 | return FCGX_UnGetChar(FCGX_GetChar(this->fcgx), this->fcgx);
120 | }
121 | }
122 |
123 | void fcgi_streambuf::reset(void)
124 | {
125 | // it should be ok to set up both the get and put areas
126 | setg(this->buf, this->buf, this->buf);
127 | setp(this->buf, this->buf + this->bufsize);
128 | }
129 |
130 | std::streambuf * fcgi_streambuf::setbuf(char_type * b, streamsize bs)
131 | {
132 | // XXX support moving data from an old buffer
133 | if (this->bufsize) return 0;
134 |
135 | this->buf = b;
136 | this->bufsize = bs;
137 |
138 | // the base setbuf() *has* to be called
139 | streambuf::setbuf(b, bs);
140 |
141 | reset();
142 |
143 | return this;
144 | }
145 |
146 | int fcgi_streambuf::attach(FCGX_Stream * fs)
147 | {
148 | this->fcgx = fs;
149 |
150 | if (this->bufsize)
151 | {
152 | reset();
153 | }
154 |
155 | return 0;
156 | }
157 |
158 | streamsize fcgi_streambuf::xsgetn(char_type * s, streamsize n)
159 | {
160 | return (this->bufsize)
161 | ? streambuf::xsgetn(s, n)
162 | : (streamsize) FCGX_GetStr((char *) s, (int) n, this->fcgx);
163 | }
164 |
165 | streamsize fcgi_streambuf::xsputn(const char_type * s, streamsize n)
166 | {
167 | return (this->bufsize)
168 | ? streambuf::xsputn(s, n)
169 | : (streamsize) FCGX_PutStr((char *) s, (int) n, this->fcgx);
170 | }
171 |
172 | // deprecated
173 | fcgi_istream::fcgi_istream(FCGX_Stream * fs) :
174 | istream(&fcgi_strmbuf)
175 | {
176 | fcgi_strmbuf.attach(fs);
177 | }
178 |
179 | // deprecated
180 | void fcgi_istream::attach(FCGX_Stream * fs)
181 | {
182 | fcgi_strmbuf.attach(fs);
183 | }
184 |
185 | // deprecated
186 | fcgi_ostream::fcgi_ostream(FCGX_Stream * fs) :
187 | ostream(&fcgi_strmbuf)
188 | {
189 | fcgi_strmbuf.attach(fs);
190 | }
191 |
192 | // deprecated
193 | void fcgi_ostream::attach(FCGX_Stream * fs)
194 | {
195 | fcgi_strmbuf.attach(fs);
196 | }
197 |
--------------------------------------------------------------------------------
/Win32/config_h.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="config_h" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Console Application" 0x0103
6 |
7 | CFG=config_h - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "config_h.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "config_h.mak" CFG="config_h - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "config_h - Win32 Release" (based on "Win32 (x86) Console Application")
21 | !MESSAGE "config_h - Win32 Debug" (based on "Win32 (x86) Console Application")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName "config_h"
27 | # PROP Scc_LocalPath ".."
28 | CPP=cl.exe
29 | RSC=rc.exe
30 |
31 | !IF "$(CFG)" == "config_h - Win32 Release"
32 |
33 | # PROP BASE Use_MFC 0
34 | # PROP BASE Use_Debug_Libraries 0
35 | # PROP BASE Output_Dir "Release"
36 | # PROP BASE Intermediate_Dir "Release"
37 | # PROP BASE Target_Dir ""
38 | # PROP Use_MFC 0
39 | # PROP Use_Debug_Libraries 0
40 | # PROP Output_Dir "Release"
41 | # PROP Intermediate_Dir "Release"
42 | # PROP Target_Dir ""
43 | # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
44 | # ADD CPP /nologo /W3 /GX /O2 /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
45 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
46 | # ADD RSC /l 0x409 /d "NDEBUG"
47 | BSC32=bscmake.exe
48 | # ADD BASE BSC32 /nologo
49 | # ADD BSC32 /nologo
50 | LINK32=link.exe
51 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
52 | # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
53 |
54 | !ELSEIF "$(CFG)" == "config_h - Win32 Debug"
55 |
56 | # PROP BASE Use_MFC 0
57 | # PROP BASE Use_Debug_Libraries 1
58 | # PROP BASE Output_Dir "Debug"
59 | # PROP BASE Intermediate_Dir "Debug"
60 | # PROP BASE Target_Dir ""
61 | # PROP Use_MFC 0
62 | # PROP Use_Debug_Libraries 1
63 | # PROP Output_Dir "Debug"
64 | # PROP Intermediate_Dir "Debug"
65 | # PROP Ignore_Export_Lib 0
66 | # PROP Target_Dir ""
67 | # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c
68 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /GX /ZI /Od /I "../libfastcgi" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
69 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
70 | # ADD RSC /l 0x409 /d "_DEBUG"
71 | BSC32=bscmake.exe
72 | # ADD BASE BSC32 /nologo
73 | # ADD BSC32 /nologo
74 | LINK32=link.exe
75 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
76 | # ADD LINK32 Ws2_32.lib /nologo /subsystem:console /profile /debug /machine:I386
77 |
78 | !ENDIF
79 |
80 | # Begin Target
81 |
82 | # Name "config_h - Win32 Release"
83 | # Name "config_h - Win32 Debug"
84 | # Begin Group "Source Files"
85 |
86 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
87 | # End Group
88 | # Begin Group "Header Files"
89 |
90 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
91 | # Begin Source File
92 |
93 | SOURCE=..\include\fcgi_config_x86.h
94 |
95 | !IF "$(CFG)" == "config_h - Win32 Release"
96 |
97 | # Begin Custom Build
98 | InputPath=..\include\fcgi_config_x86.h
99 |
100 | "..\include\fcgi_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
101 | copy $(InputPath) ..\include\fcgi_config.h
102 |
103 | # End Custom Build
104 |
105 | !ELSEIF "$(CFG)" == "config_h - Win32 Debug"
106 |
107 | # Begin Custom Build
108 | InputPath=..\include\fcgi_config_x86.h
109 |
110 | "..\include\fcgi_config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
111 | copy $(InputPath) ..\include\fcgi_config.h
112 |
113 | # End Custom Build
114 |
115 | !ENDIF
116 |
117 | # End Source File
118 | # End Group
119 | # Begin Group "Resource Files"
120 |
121 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
122 | # End Group
123 | # End Target
124 | # End Project
125 |
--------------------------------------------------------------------------------
/examples/echox.mak:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Generated NMAKE File, Based on echox.dsp
2 |
3 | !IF "$(CFG)" == ""
4 | CFG=release
5 | !ENDIF
6 |
7 | !IF "$(CFG)" != "release" && "$(CFG)" != "debug"
8 | !MESSAGE Invalid configuration "$(CFG)" specified.
9 | !MESSAGE You can specify a configuration when running NMAKE
10 | !MESSAGE by defining the macro CFG on the command line. For example:
11 | !MESSAGE
12 | !MESSAGE NMAKE /f "echox.mak" CFG="debug"
13 | !MESSAGE
14 | !MESSAGE Possible choices for configuration are:
15 | !MESSAGE
16 | !MESSAGE "release" (based on "Win32 (x86) Dynamic-Link Library")
17 | !MESSAGE "debug" (based on "Win32 (x86) Dynamic-Link Library")
18 | !MESSAGE
19 | !ERROR An invalid configuration is specified.
20 | !ENDIF
21 |
22 | !IF "$(OS)" == "Windows_NT"
23 | NULL=
24 | !ELSE
25 | NULL=nul
26 | !ENDIF
27 |
28 | !IF "$(CFG)" == "release"
29 |
30 | OUTDIR=.\..\examples\echo-x\Release
31 | INTDIR=.\..\examples\echo-x\Release
32 | # Begin Custom Macros
33 | OutDir=.\..\examples\echo-x\Release
34 | # End Custom Macros
35 |
36 | ALL : "$(OUTDIR)\echo-x.exe"
37 |
38 | CLEAN :
39 | -@erase "$(INTDIR)\echo-x.obj"
40 | -@erase "$(INTDIR)\vc60.idb"
41 | -@erase "$(OUTDIR)\echo-x.exe"
42 |
43 | "$(OUTDIR)" :
44 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
45 |
46 | CPP=cl.exe
47 | CPP_PROJ=/nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\echox.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
48 |
49 | .c{$(INTDIR)}.obj::
50 | $(CPP) @<<
51 | $(CPP_PROJ) $<
52 | <<
53 |
54 | .cpp{$(INTDIR)}.obj::
55 | $(CPP) @<<
56 | $(CPP_PROJ) $<
57 | <<
58 |
59 | .cxx{$(INTDIR)}.obj::
60 | $(CPP) @<<
61 | $(CPP_PROJ) $<
62 | <<
63 |
64 | .c{$(INTDIR)}.sbr::
65 | $(CPP) @<<
66 | $(CPP_PROJ) $<
67 | <<
68 |
69 | .cpp{$(INTDIR)}.sbr::
70 | $(CPP) @<<
71 | $(CPP_PROJ) $<
72 | <<
73 |
74 | .cxx{$(INTDIR)}.sbr::
75 | $(CPP) @<<
76 | $(CPP_PROJ) $<
77 | <<
78 |
79 | MTL=midl.exe
80 | MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
81 | RSC=rc.exe
82 | BSC32=bscmake.exe
83 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\echox.bsc"
84 | BSC32_SBRS= \
85 |
86 | LINK32=link.exe
87 | LINK32_FLAGS=libfcgi.lib /nologo /pdb:none /out:"$(OUTDIR)\echo-x.exe" /libpath:"..\libfcgi\Release"
88 | LINK32_OBJS= \
89 | "$(INTDIR)\echo-x.obj" \
90 | "..\libfcgi\Release\libfcgi.lib"
91 |
92 | "$(OUTDIR)\echo-x.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
93 | $(LINK32) @<<
94 | $(LINK32_FLAGS) $(LINK32_OBJS)
95 | <<
96 |
97 | !ELSEIF "$(CFG)" == "debug"
98 |
99 | OUTDIR=.\../examples/echo-x\Debug
100 | INTDIR=.\../examples/echo-x\Debug
101 | # Begin Custom Macros
102 | OutDir=.\../examples/echo-x\Debug
103 | # End Custom Macros
104 |
105 | ALL : "$(OUTDIR)\echo-x.exe" "$(OUTDIR)\echox.bsc"
106 |
107 | CLEAN :
108 | -@erase "$(INTDIR)\echo-x.obj"
109 | -@erase "$(INTDIR)\echo-x.sbr"
110 | -@erase "$(INTDIR)\vc60.idb"
111 | -@erase "$(INTDIR)\vc60.pdb"
112 | -@erase "$(OUTDIR)\echo-x.exe"
113 | -@erase "$(OUTDIR)\echox.bsc"
114 |
115 | "$(OUTDIR)" :
116 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
117 |
118 | CPP=cl.exe
119 | CPP_PROJ=/nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\echox.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
120 |
121 | .c{$(INTDIR)}.obj::
122 | $(CPP) @<<
123 | $(CPP_PROJ) $<
124 | <<
125 |
126 | .cpp{$(INTDIR)}.obj::
127 | $(CPP) @<<
128 | $(CPP_PROJ) $<
129 | <<
130 |
131 | .cxx{$(INTDIR)}.obj::
132 | $(CPP) @<<
133 | $(CPP_PROJ) $<
134 | <<
135 |
136 | .c{$(INTDIR)}.sbr::
137 | $(CPP) @<<
138 | $(CPP_PROJ) $<
139 | <<
140 |
141 | .cpp{$(INTDIR)}.sbr::
142 | $(CPP) @<<
143 | $(CPP_PROJ) $<
144 | <<
145 |
146 | .cxx{$(INTDIR)}.sbr::
147 | $(CPP) @<<
148 | $(CPP_PROJ) $<
149 | <<
150 |
151 | MTL=midl.exe
152 | MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
153 | RSC=rc.exe
154 | BSC32=bscmake.exe
155 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\echox.bsc"
156 | BSC32_SBRS= \
157 | "$(INTDIR)\echo-x.sbr"
158 |
159 | "$(OUTDIR)\echox.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
160 | $(BSC32) @<<
161 | $(BSC32_FLAGS) $(BSC32_SBRS)
162 | <<
163 |
164 | LINK32=link.exe
165 | LINK32_FLAGS=libfcgi.lib /nologo /profile /debug /out:"$(OUTDIR)\echo-x.exe" /libpath:"..\libfcgi\Debug"
166 | LINK32_OBJS= \
167 | "$(INTDIR)\echo-x.obj" \
168 | "..\libfcgi\Debug\libfcgi.lib"
169 |
170 | "$(OUTDIR)\echo-x.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
171 | $(LINK32) @<<
172 | $(LINK32_FLAGS) $(LINK32_OBJS)
173 | <<
174 |
175 | !ENDIF
176 |
177 |
178 | "..\examples\echo-x.c" : \
179 | "..\include\fcgi_config.h"\
180 | "..\include\fcgiapp.h"\
181 |
182 |
183 | !IF "$(CFG)" == "release" || "$(CFG)" == "debug"
184 | SOURCE="..\examples\echo-x.c"
185 |
186 | !IF "$(CFG)" == "release"
187 |
188 |
189 | "$(INTDIR)\echo-x.obj" : $(SOURCE) "$(INTDIR)"
190 | $(CPP) $(CPP_PROJ) $(SOURCE)
191 |
192 |
193 | !ELSEIF "$(CFG)" == "debug"
194 |
195 |
196 | "$(INTDIR)\echo-x.obj" "$(INTDIR)\echo-x.sbr" : $(SOURCE) "$(INTDIR)"
197 | $(CPP) $(CPP_PROJ) $(SOURCE)
198 |
199 |
200 | !ENDIF
201 |
202 | !ENDIF
203 |
204 |
--------------------------------------------------------------------------------
/examples/echo.mak:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Generated NMAKE File, Based on echo.dsp
2 |
3 | !IF "$(CFG)" == ""
4 | CFG=release
5 | !ENDIF
6 |
7 | !IF "$(CFG)" != "release" && "$(CFG)" != "debug"
8 | !MESSAGE Invalid configuration "$(CFG)" specified.
9 | !MESSAGE You can specify a configuration when running NMAKE
10 | !MESSAGE by defining the macro CFG on the command line. For example:
11 | !MESSAGE
12 | !MESSAGE NMAKE /f "echo.mak" CFG="debug"
13 | !MESSAGE
14 | !MESSAGE Possible choices for configuration are:
15 | !MESSAGE
16 | !MESSAGE "release" (based on "Win32 (x86) Dynamic-Link Library")
17 | !MESSAGE "debug" (based on "Win32 (x86) Dynamic-Link Library")
18 | !MESSAGE
19 | !ERROR An invalid configuration is specified.
20 | !ENDIF
21 |
22 | !IF "$(OS)" == "Windows_NT"
23 | NULL=
24 | !ELSE
25 | NULL=nul
26 | !ENDIF
27 |
28 | !IF "$(CFG)" == "release"
29 |
30 | OUTDIR=.\..\examples\echo\Release
31 | INTDIR=.\..\examples\echo\Release
32 | # Begin Custom Macros
33 | OutDir=.\..\examples\echo\Release
34 | # End Custom Macros
35 |
36 | ALL : "$(OUTDIR)\echo.exe"
37 |
38 | CLEAN :
39 | -@erase "$(INTDIR)\echo.obj"
40 | -@erase "$(INTDIR)\vc60.idb"
41 | -@erase "$(OUTDIR)\echo.exe"
42 |
43 | "$(OUTDIR)" :
44 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
45 |
46 | CPP=cl.exe
47 | CPP_PROJ=/nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\echo.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
48 |
49 | .c{$(INTDIR)}.obj::
50 | $(CPP) @<<
51 | $(CPP_PROJ) $<
52 | <<
53 |
54 | .cpp{$(INTDIR)}.obj::
55 | $(CPP) @<<
56 | $(CPP_PROJ) $<
57 | <<
58 |
59 | .cxx{$(INTDIR)}.obj::
60 | $(CPP) @<<
61 | $(CPP_PROJ) $<
62 | <<
63 |
64 | .c{$(INTDIR)}.sbr::
65 | $(CPP) @<<
66 | $(CPP_PROJ) $<
67 | <<
68 |
69 | .cpp{$(INTDIR)}.sbr::
70 | $(CPP) @<<
71 | $(CPP_PROJ) $<
72 | <<
73 |
74 | .cxx{$(INTDIR)}.sbr::
75 | $(CPP) @<<
76 | $(CPP_PROJ) $<
77 | <<
78 |
79 | MTL=midl.exe
80 | MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
81 | RSC=rc.exe
82 | BSC32=bscmake.exe
83 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\echo.bsc"
84 | BSC32_SBRS= \
85 |
86 | LINK32=link.exe
87 | LINK32_FLAGS=libfcgi.lib /nologo /pdb:none /out:"$(OUTDIR)\echo.exe" /libpath:"..\libfcgi\Release"
88 | LINK32_OBJS= \
89 | "$(INTDIR)\echo.obj" \
90 | "..\libfcgi\Release\libfcgi.lib"
91 |
92 | "$(OUTDIR)\echo.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
93 | $(LINK32) @<<
94 | $(LINK32_FLAGS) $(LINK32_OBJS)
95 | <<
96 |
97 | !ELSEIF "$(CFG)" == "debug"
98 |
99 | OUTDIR=.\../examples/echo\Debug
100 | INTDIR=.\../examples/echo\Debug
101 | # Begin Custom Macros
102 | OutDir=.\../examples/echo\Debug
103 | # End Custom Macros
104 |
105 | ALL : "$(OUTDIR)\echo.exe" "$(OUTDIR)\echo.bsc"
106 |
107 | CLEAN :
108 | -@erase "$(INTDIR)\echo.obj"
109 | -@erase "$(INTDIR)\echo.sbr"
110 | -@erase "$(INTDIR)\vc60.idb"
111 | -@erase "$(INTDIR)\vc60.pdb"
112 | -@erase "$(OUTDIR)\echo.bsc"
113 | -@erase "$(OUTDIR)\echo.exe"
114 | -@erase "$(OUTDIR)\echo.map"
115 |
116 | "$(OUTDIR)" :
117 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
118 |
119 | CPP=cl.exe
120 | CPP_PROJ=/nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\echo.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
121 |
122 | .c{$(INTDIR)}.obj::
123 | $(CPP) @<<
124 | $(CPP_PROJ) $<
125 | <<
126 |
127 | .cpp{$(INTDIR)}.obj::
128 | $(CPP) @<<
129 | $(CPP_PROJ) $<
130 | <<
131 |
132 | .cxx{$(INTDIR)}.obj::
133 | $(CPP) @<<
134 | $(CPP_PROJ) $<
135 | <<
136 |
137 | .c{$(INTDIR)}.sbr::
138 | $(CPP) @<<
139 | $(CPP_PROJ) $<
140 | <<
141 |
142 | .cpp{$(INTDIR)}.sbr::
143 | $(CPP) @<<
144 | $(CPP_PROJ) $<
145 | <<
146 |
147 | .cxx{$(INTDIR)}.sbr::
148 | $(CPP) @<<
149 | $(CPP_PROJ) $<
150 | <<
151 |
152 | MTL=midl.exe
153 | MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
154 | RSC=rc.exe
155 | BSC32=bscmake.exe
156 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\echo.bsc"
157 | BSC32_SBRS= \
158 | "$(INTDIR)\echo.sbr"
159 |
160 | "$(OUTDIR)\echo.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
161 | $(BSC32) @<<
162 | $(BSC32_FLAGS) $(BSC32_SBRS)
163 | <<
164 |
165 | LINK32=link.exe
166 | LINK32_FLAGS=libfcgi.lib /nologo /profile /map:"$(INTDIR)\echo.map" /debug /out:"$(OUTDIR)\echo.exe" /libpath:"..\libfcgi\Debug"
167 | LINK32_OBJS= \
168 | "$(INTDIR)\echo.obj" \
169 | "..\libfcgi\Debug\libfcgi.lib"
170 |
171 | "$(OUTDIR)\echo.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
172 | $(LINK32) @<<
173 | $(LINK32_FLAGS) $(LINK32_OBJS)
174 | <<
175 |
176 | !ENDIF
177 |
178 |
179 | ..\examples\echo.c : \
180 | "..\include\fcgi_config.h"\
181 | "..\include\fcgi_stdio.h"\
182 | "..\include\fcgiapp.h"\
183 |
184 |
185 | !IF "$(CFG)" == "release" || "$(CFG)" == "debug"
186 | SOURCE=..\examples\echo.c
187 |
188 | !IF "$(CFG)" == "release"
189 |
190 |
191 | "$(INTDIR)\echo.obj" : $(SOURCE) "$(INTDIR)"
192 | $(CPP) $(CPP_PROJ) $(SOURCE)
193 |
194 |
195 | !ELSEIF "$(CFG)" == "debug"
196 |
197 |
198 | "$(INTDIR)\echo.obj" "$(INTDIR)\echo.sbr" : $(SOURCE) "$(INTDIR)"
199 | $(CPP) $(CPP_PROJ) $(SOURCE)
200 |
201 |
202 | !ENDIF
203 |
204 | !ENDIF
205 |
206 |
--------------------------------------------------------------------------------
/cgi-fcgi/cgi-fcgi.mak:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Generated NMAKE File, Based on cgifcgi.dsp
2 |
3 | !IF "$(CFG)" == ""
4 | CFG=release
5 | !ENDIF
6 |
7 | !IF "$(CFG)" != "release" && "$(CFG)" != "debug"
8 | !MESSAGE Invalid configuration "$(CFG)" specified.
9 | !MESSAGE You can specify a configuration when running NMAKE
10 | !MESSAGE by defining the macro CFG on the command line. For example:
11 | !MESSAGE
12 | !MESSAGE NMAKE /f "cgifcgi.mak" CFG="debug"
13 | !MESSAGE
14 | !MESSAGE Possible choices for configuration are:
15 | !MESSAGE
16 | !MESSAGE "release" (based on "Win32 (x86) Dynamic-Link Library")
17 | !MESSAGE "debug" (based on "Win32 (x86) Dynamic-Link Library")
18 | !MESSAGE
19 | !ERROR An invalid configuration is specified.
20 | !ENDIF
21 |
22 | !IF "$(OS)" == "Windows_NT"
23 | NULL=
24 | !ELSE
25 | NULL=nul
26 | !ENDIF
27 |
28 | !IF "$(CFG)" == "release"
29 |
30 | OUTDIR=.\..\cgi-fcgi\Release
31 | INTDIR=.\..\cgi-fcgi\Release
32 | # Begin Custom Macros
33 | OutDir=.\..\cgi-fcgi\Release
34 | # End Custom Macros
35 |
36 | ALL : "$(OUTDIR)\cgi-fcgi.exe"
37 |
38 | CLEAN :
39 | -@erase "$(INTDIR)\cgi-fcgi.obj"
40 | -@erase "$(INTDIR)\vc60.idb"
41 | -@erase "$(OUTDIR)\cgi-fcgi.exe"
42 |
43 | "$(OUTDIR)" :
44 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
45 |
46 | CPP=cl.exe
47 | CPP_PROJ=/nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\cgifcgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
48 |
49 | .c{$(INTDIR)}.obj::
50 | $(CPP) @<<
51 | $(CPP_PROJ) $<
52 | <<
53 |
54 | .cpp{$(INTDIR)}.obj::
55 | $(CPP) @<<
56 | $(CPP_PROJ) $<
57 | <<
58 |
59 | .cxx{$(INTDIR)}.obj::
60 | $(CPP) @<<
61 | $(CPP_PROJ) $<
62 | <<
63 |
64 | .c{$(INTDIR)}.sbr::
65 | $(CPP) @<<
66 | $(CPP_PROJ) $<
67 | <<
68 |
69 | .cpp{$(INTDIR)}.sbr::
70 | $(CPP) @<<
71 | $(CPP_PROJ) $<
72 | <<
73 |
74 | .cxx{$(INTDIR)}.sbr::
75 | $(CPP) @<<
76 | $(CPP_PROJ) $<
77 | <<
78 |
79 | MTL=midl.exe
80 | MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
81 | RSC=rc.exe
82 | BSC32=bscmake.exe
83 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\cgifcgi.bsc"
84 | BSC32_SBRS= \
85 |
86 | LINK32=link.exe
87 | LINK32_FLAGS=libfcgi.lib /nologo /pdb:none /out:"$(OUTDIR)\cgi-fcgi.exe" /libpath:"..\libfcgi\Release"
88 | LINK32_OBJS= \
89 | "$(INTDIR)\cgi-fcgi.obj" \
90 | "..\libfcgi\Release\libfcgi.lib"
91 |
92 | "$(OUTDIR)\cgi-fcgi.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
93 | $(LINK32) @<<
94 | $(LINK32_FLAGS) $(LINK32_OBJS)
95 | <<
96 |
97 | !ELSEIF "$(CFG)" == "debug"
98 |
99 | OUTDIR=.\../cgi-fcgi/Debug
100 | INTDIR=.\../cgi-fcgi/Debug
101 | # Begin Custom Macros
102 | OutDir=.\../cgi-fcgi/Debug
103 | # End Custom Macros
104 |
105 | ALL : "$(OUTDIR)\cgi-fcgi.exe" "$(OUTDIR)\cgifcgi.bsc"
106 |
107 | CLEAN :
108 | -@erase "$(INTDIR)\cgi-fcgi.obj"
109 | -@erase "$(INTDIR)\cgi-fcgi.sbr"
110 | -@erase "$(INTDIR)\vc60.idb"
111 | -@erase "$(INTDIR)\vc60.pdb"
112 | -@erase "$(OUTDIR)\cgi-fcgi.exe"
113 | -@erase "$(OUTDIR)\cgifcgi.bsc"
114 |
115 | "$(OUTDIR)" :
116 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
117 |
118 | CPP=cl.exe
119 | CPP_PROJ=/nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\cgifcgi.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
120 |
121 | .c{$(INTDIR)}.obj::
122 | $(CPP) @<<
123 | $(CPP_PROJ) $<
124 | <<
125 |
126 | .cpp{$(INTDIR)}.obj::
127 | $(CPP) @<<
128 | $(CPP_PROJ) $<
129 | <<
130 |
131 | .cxx{$(INTDIR)}.obj::
132 | $(CPP) @<<
133 | $(CPP_PROJ) $<
134 | <<
135 |
136 | .c{$(INTDIR)}.sbr::
137 | $(CPP) @<<
138 | $(CPP_PROJ) $<
139 | <<
140 |
141 | .cpp{$(INTDIR)}.sbr::
142 | $(CPP) @<<
143 | $(CPP_PROJ) $<
144 | <<
145 |
146 | .cxx{$(INTDIR)}.sbr::
147 | $(CPP) @<<
148 | $(CPP_PROJ) $<
149 | <<
150 |
151 | MTL=midl.exe
152 | MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
153 | RSC=rc.exe
154 | BSC32=bscmake.exe
155 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\cgifcgi.bsc"
156 | BSC32_SBRS= \
157 | "$(INTDIR)\cgi-fcgi.sbr"
158 |
159 | "$(OUTDIR)\cgifcgi.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
160 | $(BSC32) @<<
161 | $(BSC32_FLAGS) $(BSC32_SBRS)
162 | <<
163 |
164 | LINK32=link.exe
165 | LINK32_FLAGS=libfcgi.lib /nologo /profile /debug /out:"$(OUTDIR)\cgi-fcgi.exe" /libpath:"..\libfcgi\Debug"
166 | LINK32_OBJS= \
167 | "$(INTDIR)\cgi-fcgi.obj" \
168 | "..\libfcgi\Debug\libfcgi.lib"
169 |
170 | "$(OUTDIR)\cgi-fcgi.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
171 | $(LINK32) @<<
172 | $(LINK32_FLAGS) $(LINK32_OBJS)
173 | <<
174 |
175 | !ENDIF
176 |
177 |
178 | "..\cgi-fcgi\cgi-fcgi.c" : \
179 | "..\include\fastcgi.h"\
180 | "..\include\fcgi_config.h"\
181 | "..\include\fcgiapp.h"\
182 | "..\include\fcgimisc.h"\
183 | "..\include\fcgios.h"\
184 |
185 |
186 | !IF "$(CFG)" == "release" || "$(CFG)" == "debug"
187 | SOURCE="..\cgi-fcgi\cgi-fcgi.c"
188 |
189 | !IF "$(CFG)" == "release"
190 |
191 |
192 | "$(INTDIR)\cgi-fcgi.obj" : $(SOURCE) "$(INTDIR)"
193 | $(CPP) $(CPP_PROJ) $(SOURCE)
194 |
195 |
196 | !ELSEIF "$(CFG)" == "debug"
197 |
198 |
199 | "$(INTDIR)\cgi-fcgi.obj" "$(INTDIR)\cgi-fcgi.sbr" : $(SOURCE) "$(INTDIR)"
200 | $(CPP) $(CPP_PROJ) $(SOURCE)
201 |
202 |
203 | !ENDIF
204 |
205 | !ENDIF
206 |
207 |
--------------------------------------------------------------------------------
/examples/authorizer.mak:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Generated NMAKE File, Based on authorizer.dsp
2 |
3 | !IF "$(CFG)" == ""
4 | CFG=release
5 | !ENDIF
6 |
7 | !IF "$(CFG)" != "release" && "$(CFG)" != "debug"
8 | !MESSAGE Invalid configuration "$(CFG)" specified.
9 | !MESSAGE You can specify a configuration when running NMAKE
10 | !MESSAGE by defining the macro CFG on the command line. For example:
11 | !MESSAGE
12 | !MESSAGE NMAKE /f "authorizer.mak" CFG="debug"
13 | !MESSAGE
14 | !MESSAGE Possible choices for configuration are:
15 | !MESSAGE
16 | !MESSAGE "release" (based on "Win32 (x86) Dynamic-Link Library")
17 | !MESSAGE "debug" (based on "Win32 (x86) Dynamic-Link Library")
18 | !MESSAGE
19 | !ERROR An invalid configuration is specified.
20 | !ENDIF
21 |
22 | !IF "$(OS)" == "Windows_NT"
23 | NULL=
24 | !ELSE
25 | NULL=nul
26 | !ENDIF
27 |
28 | !IF "$(CFG)" == "release"
29 |
30 | OUTDIR=.\..\examples\authorizer\Release
31 | INTDIR=.\..\examples\authorizer\Release
32 | # Begin Custom Macros
33 | OutDir=.\..\examples\authorizer\Release
34 | # End Custom Macros
35 |
36 | ALL : "$(OUTDIR)\authorizer.exe"
37 |
38 | CLEAN :
39 | -@erase "$(INTDIR)\authorizer.obj"
40 | -@erase "$(INTDIR)\vc60.idb"
41 | -@erase "$(OUTDIR)\authorizer.exe"
42 |
43 | "$(OUTDIR)" :
44 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
45 |
46 | CPP=cl.exe
47 | CPP_PROJ=/nologo /MD /W3 /Gi /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\authorizer.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
48 |
49 | .c{$(INTDIR)}.obj::
50 | $(CPP) @<<
51 | $(CPP_PROJ) $<
52 | <<
53 |
54 | .cpp{$(INTDIR)}.obj::
55 | $(CPP) @<<
56 | $(CPP_PROJ) $<
57 | <<
58 |
59 | .cxx{$(INTDIR)}.obj::
60 | $(CPP) @<<
61 | $(CPP_PROJ) $<
62 | <<
63 |
64 | .c{$(INTDIR)}.sbr::
65 | $(CPP) @<<
66 | $(CPP_PROJ) $<
67 | <<
68 |
69 | .cpp{$(INTDIR)}.sbr::
70 | $(CPP) @<<
71 | $(CPP_PROJ) $<
72 | <<
73 |
74 | .cxx{$(INTDIR)}.sbr::
75 | $(CPP) @<<
76 | $(CPP_PROJ) $<
77 | <<
78 |
79 | MTL=midl.exe
80 | MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
81 | RSC=rc.exe
82 | BSC32=bscmake.exe
83 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\authorizer.bsc"
84 | BSC32_SBRS= \
85 |
86 | LINK32=link.exe
87 | LINK32_FLAGS=libfcgi.lib /nologo /pdb:none /out:"$(OUTDIR)\authorizer.exe" /libpath:"..\libfcgi\Release"
88 | LINK32_OBJS= \
89 | "$(INTDIR)\authorizer.obj" \
90 | "..\libfcgi\Release\libfcgi.lib"
91 |
92 | "$(OUTDIR)\authorizer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
93 | $(LINK32) @<<
94 | $(LINK32_FLAGS) $(LINK32_OBJS)
95 | <<
96 |
97 | !ELSEIF "$(CFG)" == "debug"
98 |
99 | OUTDIR=.\..\examples/authorizer/Debug
100 | INTDIR=.\..\examples/authorizer/Debug
101 | # Begin Custom Macros
102 | OutDir=.\..\examples/authorizer/Debug
103 | # End Custom Macros
104 |
105 | ALL : "$(OUTDIR)\authorizer.exe" "$(OUTDIR)\authorizer.bsc"
106 |
107 | CLEAN :
108 | -@erase "$(INTDIR)\authorizer.obj"
109 | -@erase "$(INTDIR)\authorizer.sbr"
110 | -@erase "$(INTDIR)\vc60.idb"
111 | -@erase "$(INTDIR)\vc60.pdb"
112 | -@erase "$(OUTDIR)\authorizer.bsc"
113 | -@erase "$(OUTDIR)\authorizer.exe"
114 |
115 | "$(OUTDIR)" :
116 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
117 |
118 | CPP=cl.exe
119 | CPP_PROJ=/nologo /MDd /W4 /Gm /Gi /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\authorizer.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
120 |
121 | .c{$(INTDIR)}.obj::
122 | $(CPP) @<<
123 | $(CPP_PROJ) $<
124 | <<
125 |
126 | .cpp{$(INTDIR)}.obj::
127 | $(CPP) @<<
128 | $(CPP_PROJ) $<
129 | <<
130 |
131 | .cxx{$(INTDIR)}.obj::
132 | $(CPP) @<<
133 | $(CPP_PROJ) $<
134 | <<
135 |
136 | .c{$(INTDIR)}.sbr::
137 | $(CPP) @<<
138 | $(CPP_PROJ) $<
139 | <<
140 |
141 | .cpp{$(INTDIR)}.sbr::
142 | $(CPP) @<<
143 | $(CPP_PROJ) $<
144 | <<
145 |
146 | .cxx{$(INTDIR)}.sbr::
147 | $(CPP) @<<
148 | $(CPP_PROJ) $<
149 | <<
150 |
151 | MTL=midl.exe
152 | MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
153 | RSC=rc.exe
154 | BSC32=bscmake.exe
155 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\authorizer.bsc"
156 | BSC32_SBRS= \
157 | "$(INTDIR)\authorizer.sbr"
158 |
159 | "$(OUTDIR)\authorizer.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
160 | $(BSC32) @<<
161 | $(BSC32_FLAGS) $(BSC32_SBRS)
162 | <<
163 |
164 | LINK32=link.exe
165 | LINK32_FLAGS=libfcgi.lib /nologo /profile /debug /out:"$(OUTDIR)\authorizer.exe" /libpath:"..\libfcgi\Debug"
166 | LINK32_OBJS= \
167 | "$(INTDIR)\authorizer.obj" \
168 | "..\libfcgi\Debug\libfcgi.lib"
169 |
170 | "$(OUTDIR)\authorizer.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
171 | $(LINK32) @<<
172 | $(LINK32_FLAGS) $(LINK32_OBJS)
173 | <<
174 |
175 | !ENDIF
176 |
177 |
178 | ..\examples\authorizer.c : \
179 | "..\include\fcgi_stdio.h"\
180 | "..\include\fcgiapp.h"\
181 |
182 |
183 | !IF "$(CFG)" == "release" || "$(CFG)" == "debug"
184 | SOURCE=..\examples\authorizer.c
185 |
186 | !IF "$(CFG)" == "release"
187 |
188 |
189 | "$(INTDIR)\authorizer.obj" : $(SOURCE) "$(INTDIR)"
190 | $(CPP) $(CPP_PROJ) $(SOURCE)
191 |
192 |
193 | !ELSEIF "$(CFG)" == "debug"
194 |
195 |
196 | "$(INTDIR)\authorizer.obj" "$(INTDIR)\authorizer.sbr" : $(SOURCE) "$(INTDIR)"
197 | $(CPP) $(CPP_PROJ) $(SOURCE)
198 |
199 |
200 | !ENDIF
201 |
202 | !ENDIF
203 |
204 |
--------------------------------------------------------------------------------
/examples/echo-cpp.mak:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Generated NMAKE File, Based on echo-cpp.dsp
2 | !IF "$(CFG)" == ""
3 | CFG=release
4 | !ENDIF
5 |
6 | !IF "$(CFG)" != "release" && "$(CFG)" != "debug"
7 | !MESSAGE Invalid configuration "$(CFG)" specified.
8 | !MESSAGE You can specify a configuration when running NMAKE
9 | !MESSAGE by defining the macro CFG on the command line. For example:
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "echo-cpp.mak" CFG="debug"
12 | !MESSAGE
13 | !MESSAGE Possible choices for configuration are:
14 | !MESSAGE
15 | !MESSAGE "release" (based on "Win32 (x86) Dynamic-Link Library")
16 | !MESSAGE "debug" (based on "Win32 (x86) Dynamic-Link Library")
17 | !MESSAGE
18 | !ERROR An invalid configuration is specified.
19 | !ENDIF
20 |
21 | !IF "$(OS)" == "Windows_NT"
22 | NULL=
23 | !ELSE
24 | NULL=nul
25 | !ENDIF
26 |
27 | !IF "$(CFG)" == "release"
28 |
29 | OUTDIR=.\..\examples\echo-cpp\Release
30 | INTDIR=.\..\examples\echo-cpp\Release
31 | # Begin Custom Macros
32 | OutDir=.\..\examples\echo-cpp\Release
33 | # End Custom Macros
34 |
35 | ALL : "$(OUTDIR)\echo-cpp.exe"
36 |
37 |
38 | CLEAN :
39 | -@erase "$(INTDIR)\echo-cpp.obj"
40 | -@erase "$(INTDIR)\vc60.idb"
41 | -@erase "$(OUTDIR)\echo-cpp.exe"
42 |
43 | "$(OUTDIR)" :
44 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
45 |
46 | CPP=cl.exe
47 | CPP_PROJ=/nologo /MD /W3 /Gi /GX /O2 /Ob2 /I "..\include" /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /Fp"$(INTDIR)\echo-cpp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /c
48 |
49 | .c{$(INTDIR)}.obj::
50 | $(CPP) @<<
51 | $(CPP_PROJ) $<
52 | <<
53 |
54 | .cpp{$(INTDIR)}.obj::
55 | $(CPP) @<<
56 | $(CPP_PROJ) $<
57 | <<
58 |
59 | .cxx{$(INTDIR)}.obj::
60 | $(CPP) @<<
61 | $(CPP_PROJ) $<
62 | <<
63 |
64 | .c{$(INTDIR)}.sbr::
65 | $(CPP) @<<
66 | $(CPP_PROJ) $<
67 | <<
68 |
69 | .cpp{$(INTDIR)}.sbr::
70 | $(CPP) @<<
71 | $(CPP_PROJ) $<
72 | <<
73 |
74 | .cxx{$(INTDIR)}.sbr::
75 | $(CPP) @<<
76 | $(CPP_PROJ) $<
77 | <<
78 |
79 | MTL=midl.exe
80 | MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
81 | RSC=rc.exe
82 | BSC32=bscmake.exe
83 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\echo-cpp.bsc"
84 | BSC32_SBRS= \
85 |
86 | LINK32=link.exe
87 | LINK32_FLAGS=libfcgi.lib /nologo /pdb:none /out:"$(OUTDIR)\echo-cpp.exe" /libpath:"..\libfcgi\Release"
88 | LINK32_OBJS= \
89 | "$(INTDIR)\echo-cpp.obj"
90 |
91 | "$(OUTDIR)\echo-cpp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
92 | $(LINK32) @<<
93 | $(LINK32_FLAGS) $(LINK32_OBJS)
94 | <<
95 |
96 | !ELSEIF "$(CFG)" == "debug"
97 |
98 | OUTDIR=.\../examples/echo-cpp\Debug
99 | INTDIR=.\../examples/echo-cpp\Debug
100 | # Begin Custom Macros
101 | OutDir=.\../examples/echo-cpp\Debug
102 | # End Custom Macros
103 |
104 | ALL : "$(OUTDIR)\echo-cpp.exe" "$(OUTDIR)\echo-cpp.bsc"
105 |
106 |
107 | CLEAN :
108 | -@erase "$(INTDIR)\echo-cpp.obj"
109 | -@erase "$(INTDIR)\echo-cpp.sbr"
110 | -@erase "$(INTDIR)\vc60.idb"
111 | -@erase "$(INTDIR)\vc60.pdb"
112 | -@erase "$(OUTDIR)\echo-cpp.bsc"
113 | -@erase "$(OUTDIR)\echo-cpp.exe"
114 |
115 | "$(OUTDIR)" :
116 | if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
117 |
118 | CPP=cl.exe
119 | CPP_PROJ=/nologo /MDd /W3 /Gm /Gi /GX /ZI /Od /I "..\include" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /FR"$(INTDIR)\\" /Fp"$(INTDIR)\echo-cpp.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\" /FD /GZ /c
120 |
121 | .c{$(INTDIR)}.obj::
122 | $(CPP) @<<
123 | $(CPP_PROJ) $<
124 | <<
125 |
126 | .cpp{$(INTDIR)}.obj::
127 | $(CPP) @<<
128 | $(CPP_PROJ) $<
129 | <<
130 |
131 | .cxx{$(INTDIR)}.obj::
132 | $(CPP) @<<
133 | $(CPP_PROJ) $<
134 | <<
135 |
136 | .c{$(INTDIR)}.sbr::
137 | $(CPP) @<<
138 | $(CPP_PROJ) $<
139 | <<
140 |
141 | .cpp{$(INTDIR)}.sbr::
142 | $(CPP) @<<
143 | $(CPP_PROJ) $<
144 | <<
145 |
146 | .cxx{$(INTDIR)}.sbr::
147 | $(CPP) @<<
148 | $(CPP_PROJ) $<
149 | <<
150 |
151 | MTL=midl.exe
152 | MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
153 | RSC=rc.exe
154 | BSC32=bscmake.exe
155 | BSC32_FLAGS=/nologo /o"$(OUTDIR)\echo-cpp.bsc"
156 | BSC32_SBRS= \
157 | "$(INTDIR)\echo-cpp.sbr"
158 |
159 | "$(OUTDIR)\echo-cpp.bsc" : "$(OUTDIR)" $(BSC32_SBRS)
160 | $(BSC32) @<<
161 | $(BSC32_FLAGS) $(BSC32_SBRS)
162 | <<
163 |
164 | LINK32=link.exe
165 | LINK32_FLAGS=libfcgi.lib /nologo /profile /debug /out:"$(OUTDIR)\echo-cpp.exe" /libpath:"..\libfcgi\Debug"
166 | LINK32_OBJS= \
167 | "$(INTDIR)\echo-cpp.obj"
168 |
169 | "$(OUTDIR)\echo-cpp.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
170 | $(LINK32) @<<
171 | $(LINK32_FLAGS) $(LINK32_OBJS)
172 | <<
173 |
174 | !ENDIF
175 |
176 |
177 | "..\examples\echo-cpp.cpp" : \
178 | "..\include\fcgiapp.h"\
179 | "..\include\fcgio.h"\
180 |
181 |
182 | !IF "$(CFG)" == "release" || "$(CFG)" == "debug"
183 | SOURCE="..\examples\echo-cpp.cpp"
184 |
185 | !IF "$(CFG)" == "release"
186 |
187 |
188 | "$(INTDIR)\echo-cpp.obj" : $(SOURCE) "$(INTDIR)"
189 | $(CPP) $(CPP_PROJ) $(SOURCE)
190 |
191 |
192 | !ELSEIF "$(CFG)" == "debug"
193 |
194 |
195 | "$(INTDIR)\echo-cpp.obj" "$(INTDIR)\echo-cpp.sbr" : $(SOURCE) "$(INTDIR)"
196 | $(CPP) $(CPP_PROJ) $(SOURCE)
197 |
198 |
199 | !ENDIF
200 |
201 |
202 | !ENDIF
203 |
204 |
--------------------------------------------------------------------------------
/doc/fastcgi-prog-guide/ch3perl.htm:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | FastCGI Programmer's Guide - Chapter 3, Developing FastCGI Applications in Perl
6 |
7 |
14 |
15 |
16 | [Top] [Prev] [Next] [Bottom]
18 |
19 |
20 |
21 |
22 |
23 | 3 Developing FastCGI
24 | Applications in Perl
25 |
26 |
27 |
28 |
29 | This chapter explains how to code FastCGI applications in Perl. Before you can build FastCGI applications in
30 | Perl, you must have a FastCGI-savvy version of the Perl interpreter. Open Market develops such Perl binaries
31 | for popular platforms and makes them available with our developer's kit.
32 |
33 |
34 | The FastCGI-savvy binaries are extensions of standard Perl, and are intended to replace
35 | your existing Perl installation. There is no need to maintain two versions of Perl: the version that we supply
36 | will work fine when invoked from a shell or a CGI program. There are also directions in the developer's
37 | kit for how to make your own FastCGI-savvy Perl, if you need a version for some platform that we don't
38 | supply.
39 |
40 |
41 | FastCGI is ideal for applications written in Perl, because it provides a huge performance
42 | gain. When you run a Perl script, the Perl interpreter analyzes the entire script before executing any of it.
43 | With FastCGI, you can factor out this initialization cost and pay it only once, making execution of the actual
44 | script much faster in response to client calls.
45 |
46 |
47 |
48 |
49 | Getting Started
50 |
51 |
52 |
53 | The first line of any Perl script typically specifies the pathname of the Perl interpreter itself. You must
54 | specify the pathname of a FastCGI-savvy Perl.
55 |
56 |
57 | Next, you must tell Perl to load the FastCGI extension. To do so, place the following line
58 | near the beginning of every FastCGI script:
59 |
60 |
61 |
62 |
63 | use FCGI;
64 |
65 |
66 |
67 |
68 | Then, you have to divide FastCGI scripts into the following two sections:
69 |
70 |
71 |
72 |
73 | -
74 |
75 |
76 | -
77 | Initialization section, which is executed only once.
78 |
79 | -
80 | Response loop section, which gets executed every time the FastCGI script gets called.
81 |
82 |
83 |
84 |
85 | A response loop typically has the following format:
86 |
87 |
88 |
89 |
90 | while (FCGI::accept >= 0) {
91 |
92 | # body of response loop
93 |
94 | }
95 |
96 |
97 |
98 |
99 | The accept call returns 0 whenever a client requests the FastCGI script. Otherwise, the
100 | accept call returns -1.
101 |
102 |
103 |
104 |
105 | Example: TinyFastCGI
106 |
107 |
108 |
109 | Here is a simple example of a FastCGI application written in Perl:
110 |
111 |
112 |
113 |
114 |
115 | #!fcgi-savvy-perl
116 |
117 | use FCGI; # Imports the library; required line
118 |
119 | # Initialization code
120 |
121 | $cnt = 0;
122 |
123 | # Response loop
124 |
125 | while (FCGI::accept >= 0) {
126 | print "Content-type: text/html\r\n\r\n";
127 | print "<head>\n<title>FastCGI Demo Page (perl)</title>\n</head>\n";
128 | print "<h1>FastCGI Demo Page (perl)</h1>\n";
129 | print "This is coming from a FastCGI server.\n<BR>\n";
130 | print "Running on <EM>$ENV{SERVER_NAME}</EM> to <EM>$ENV{REMOTE_HOST}</EM>\n<BR>\n";
131 | $cnt++;
132 | print "This is connection number $cnt\n";
133 | }
134 |
135 |
136 |
137 |
138 |
139 | [Top] [Prev] [Next] [Bottom]
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
--------------------------------------------------------------------------------
/doc/FCGI_Accept.3:
--------------------------------------------------------------------------------
1 | NAME
2 | FCGI_Accept, FCGI_ToFILE, FCGI_ToFcgiStream
3 | - fcgi_stdio compatibility library
4 |
5 | SYNOPSIS
6 | #include "fcgi_stdio.h"
7 |
8 | int
9 | FCGI_Accept(void);
10 |
11 | FILE *
12 | FCGI_ToFILE(FCGI_FILE *);
13 |
14 | FCGI_Stream *
15 | FCGI_ToFcgiStream(FCGI_FILE *);
16 |
17 |
18 | DESCRIPTION
19 | The FCGI_Accept function accepts a new request from the HTTP server
20 | and creates a CGI-compatible execution environment for the request.
21 |
22 | If the application was invoked as a CGI program, the first
23 | call to FCGI_Accept is essentially a no-op and the second
24 | call returns -1. This causes a correctly coded FastCGI Responder
25 | application to run a single request and exit, giving CGI
26 | behavior.
27 |
28 | If the application was invoked as a FastCGI server, the first
29 | call to FCGI_Accept indicates that the application has completed
30 | its initialization and is ready to accept its first request.
31 | Subsequent calls to FCGI_Accept indicate that the application has
32 | completed processing its current request and is ready to accept a
33 | new request. An application can complete the current request
34 | without accepting a new one by calling FCGI_Finish(3); later, when
35 | ready to accept a new request, the application calls FCGI_Accept.
36 |
37 | In completing the current request, FCGI_Accept may detect
38 | errors, e.g. a broken pipe to a client who has disconnected
39 | early. FCGI_Accept ignores such errors. An application
40 | that wishes to handle such errors should explicitly call
41 | fclose(stderr), then fclose(stdout); an EOF return from
42 | either one indicates an error.
43 |
44 | If the environment variable FCGI_WEB_SERVER_ADDRS is set when
45 | FCGI_Accept is called, it should contain a comma-separated list
46 | of IP addresses. Each IP address is written as four decimal
47 | numbers in the range [0..255] separated by decimal points.
48 | (nslookup(8) translates the more familiar symbolic IP hostname
49 | into this form.) So one legal binding for this variable is
50 |
51 | FCGI_WEB_SERVER_ADDRS=199.170.183.28,199.170.183.71
52 |
53 | FCGI_Accept checks the peer IP address of each new connection for
54 | membership in the list. If the check fails (including the
55 | possibility that the connection didn't use TCP/IP transport),
56 | FCGI_Accept closes the connection and accepts another one
57 | (without returning in between).
58 |
59 | After accepting a new request, FCGI_Accept assigns new values
60 | to the global variables stdin, stdout, stderr, and environ.
61 | After FCGI_Accept returns, these variables have the same
62 | interpretation as on entry to a CGI program.
63 |
64 | FCGI_Accept frees any storage allocated by the previous call
65 | to FCGI_Accept. This has important consequences:
66 |
67 | DO NOT retain pointers to the environ array or any strings
68 | contained in it (e.g. to the result of calling getenv(3)),
69 | since these will be freed by the next call to FCGI_Finish or
70 | FCGI_Accept.
71 |
72 | DO NOT use setenv(3) or putenv(3) to modify the environ array
73 | created by FCGI_Accept, since this will either leak storage
74 | or cause the next call to FCGI_Finish or FCGI_Accept to free
75 | storage that should not be freed.
76 |
77 | If your application needs to use setenv or putenv to modify
78 | the environ array, it should follow this coding pattern:
79 |
80 | char **savedEnviron, **requestEnviron;
81 | int acceptStatus;
82 |
83 | savedEnviron = environ;
84 | acceptStatus = FCGI_Accept();
85 | requestEnviron = environ;
86 | environ = savedEnviron;
87 | if(acceptStatus >= 0 && !FCGX_IsCGI()) {
88 | /*
89 | * requestEnviron points to name-value pairs in
90 | * storage allocated by FCGI_Accept. OK to read,
91 | * not OK to retain pointers -- make copies instead.
92 | */
93 | }
94 | /*
95 | * OK to do setenv or putenv, but beware of storage leaks!
96 | */
97 |
98 | In addition to the standard CGI environment variables, the
99 | environment variable FCGI_ROLE is always set to the role
100 | of the current request. The roles currently defined are
101 | RESPONDER, AUTHORIZER, and FILTER.
102 |
103 | In the FILTER role, the additional variables FCGI_DATA_LENGTH
104 | and FCGI_DATA_LAST_MOD are also defined. See the manpage
105 | FCGI_StartFilterData(3) for complete information.
106 |
107 | The macros FCGI_ToFILE and FCGI_ToFcgiStream are provided
108 | to allow escape to native functions that use the types FILE or
109 | FCGI_Stream. In the case of FILE, functions would have to
110 | be separately compiled, since fcgi_stdio.h replaces the standard
111 | FILE with FCGI_FILE.
112 |
113 |
114 | RETURN VALUES
115 | 0 for successful call, -1 for error (application should exit).
116 |
117 | SEE ALSO
118 | FCGI_Finish(3)
119 | FCGI_StartFilterData(3)
120 | FCGI_SetExitStatus(3)
121 | cgi-fcgi(1)
122 | nslookup(8)
123 |
124 | HISTORY
125 | Copyright (c) 1996 Open Market, Inc.
126 | See the file "LICENSE" for information on usage and redistribution
127 | of this file, and for a DISCLAIMER OF ALL WARRANTIES.
128 | $Id: FCGI_Accept.3,v 1.1.1.1 1997/09/16 15:36:25 stanleyg Exp $
129 |
--------------------------------------------------------------------------------
/Win32/libfcgi.dsp:
--------------------------------------------------------------------------------
1 | # Microsoft Developer Studio Project File - Name="libfcgi" - Package Owner=<4>
2 | # Microsoft Developer Studio Generated Build File, Format Version 6.00
3 | # ** DO NOT EDIT **
4 |
5 | # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
6 |
7 | CFG=libfcgi - Win32 Debug
8 | !MESSAGE This is not a valid makefile. To build this project using NMAKE,
9 | !MESSAGE use the Export Makefile command and run
10 | !MESSAGE
11 | !MESSAGE NMAKE /f "libfcgi.mak".
12 | !MESSAGE
13 | !MESSAGE You can specify a configuration when running NMAKE
14 | !MESSAGE by defining the macro CFG on the command line. For example:
15 | !MESSAGE
16 | !MESSAGE NMAKE /f "libfcgi.mak" CFG="libfcgi - Win32 Debug"
17 | !MESSAGE
18 | !MESSAGE Possible choices for configuration are:
19 | !MESSAGE
20 | !MESSAGE "libfcgi - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
21 | !MESSAGE "libfcgi - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
22 | !MESSAGE
23 |
24 | # Begin Project
25 | # PROP AllowPerConfigDependencies 0
26 | # PROP Scc_ProjName "libfcgi"
27 | # PROP Scc_LocalPath ".."
28 | CPP=cl.exe
29 | MTL=midl.exe
30 | RSC=rc.exe
31 |
32 | !IF "$(CFG)" == "libfcgi - Win32 Release"
33 |
34 | # PROP BASE Use_MFC 0
35 | # PROP BASE Use_Debug_Libraries 0
36 | # PROP BASE Output_Dir "Release"
37 | # PROP BASE Intermediate_Dir "Release"
38 | # PROP BASE Target_Dir ""
39 | # PROP Use_MFC 0
40 | # PROP Use_Debug_Libraries 0
41 | # PROP Output_Dir "..\libfcgi\Release"
42 | # PROP Intermediate_Dir "..\libfcgi\Release"
43 | # PROP Ignore_Export_Lib 0
44 | # PROP Target_Dir ""
45 | # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /c
46 | # ADD CPP /nologo /MD /W3 /O2 /Ob2 /I "..\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /Fr /YX /FD /c
47 | # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
48 | # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
49 | # ADD BASE RSC /l 0x409 /d "NDEBUG"
50 | # ADD RSC /l 0x409 /d "NDEBUG"
51 | BSC32=bscmake.exe
52 | # ADD BASE BSC32 /nologo
53 | # ADD BSC32 /nologo
54 | LINK32=link.exe
55 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
56 | # ADD LINK32 Ws2_32.lib /nologo /dll /pdb:none /machine:I386
57 | # SUBTRACT LINK32 /verbose /nodefaultlib
58 |
59 | !ELSEIF "$(CFG)" == "libfcgi - Win32 Debug"
60 |
61 | # PROP BASE Use_MFC 0
62 | # PROP BASE Use_Debug_Libraries 1
63 | # PROP BASE Output_Dir "Debug"
64 | # PROP BASE Intermediate_Dir "Debug"
65 | # PROP BASE Target_Dir ""
66 | # PROP Use_MFC 0
67 | # PROP Use_Debug_Libraries 1
68 | # PROP Output_Dir "..\libfcgi\Debug"
69 | # PROP Intermediate_Dir "..\libfcgi\Debug"
70 | # PROP Ignore_Export_Lib 0
71 | # PROP Target_Dir ""
72 | # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LIB_EXPORTS" /YX /FD /GZ /c
73 | # ADD CPP /nologo /MDd /W4 /Gm /Gi /GX /ZI /Od /I "..\include" /D "_DEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /FR /YX /FD /GZ /c
74 | # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
75 | # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
76 | # ADD BASE RSC /l 0x409 /d "_DEBUG"
77 | # ADD RSC /l 0x409 /d "_DEBUG"
78 | BSC32=bscmake.exe
79 | # ADD BASE BSC32 /nologo
80 | # ADD BSC32 /nologo
81 | LINK32=link.exe
82 | # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
83 | # ADD LINK32 Ws2_32.lib /nologo /dll /profile /map /debug /machine:I386
84 | # SUBTRACT LINK32 /verbose /nodefaultlib
85 |
86 | !ENDIF
87 |
88 | # Begin Target
89 |
90 | # Name "libfcgi - Win32 Release"
91 | # Name "libfcgi - Win32 Debug"
92 | # Begin Group "Source Files"
93 |
94 | # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
95 | # Begin Source File
96 |
97 | SOURCE=..\libfcgi\fcgi_stdio.c
98 | # End Source File
99 | # Begin Source File
100 |
101 | SOURCE=..\libfcgi\fcgiapp.c
102 | # End Source File
103 | # Begin Source File
104 |
105 | SOURCE=..\libfcgi\fcgio.cpp
106 |
107 | !IF "$(CFG)" == "libfcgi - Win32 Release"
108 |
109 | # ADD CPP /GX
110 |
111 | !ELSEIF "$(CFG)" == "libfcgi - Win32 Debug"
112 |
113 | # ADD CPP /W3 /GX
114 |
115 | !ENDIF
116 |
117 | # End Source File
118 | # Begin Source File
119 |
120 | SOURCE=..\libfcgi\os_unix.c
121 | # PROP Exclude_From_Build 1
122 | # End Source File
123 | # Begin Source File
124 |
125 | SOURCE=..\libfcgi\os_win32.c
126 | # End Source File
127 | # Begin Source File
128 |
129 | SOURCE=..\libfcgi\strerror.c
130 | # PROP Exclude_From_Build 1
131 | # End Source File
132 | # End Group
133 | # Begin Group "Header Files"
134 |
135 | # PROP Default_Filter "h;hpp;hxx;hm;inl"
136 | # Begin Source File
137 |
138 | SOURCE=..\include\fastcgi.h
139 | # End Source File
140 | # Begin Source File
141 |
142 | SOURCE=..\include\fcgi_config.h
143 | # End Source File
144 | # Begin Source File
145 |
146 | SOURCE=..\include\fcgi_config_x86.h
147 | # End Source File
148 | # Begin Source File
149 |
150 | SOURCE=..\include\fcgi_stdio.h
151 | # End Source File
152 | # Begin Source File
153 |
154 | SOURCE=..\include\fcgiapp.h
155 | # End Source File
156 | # Begin Source File
157 |
158 | SOURCE=..\include\fcgimisc.h
159 | # End Source File
160 | # Begin Source File
161 |
162 | SOURCE=..\include\fcgio.h
163 | # End Source File
164 | # Begin Source File
165 |
166 | SOURCE=..\include\fcgios.h
167 | # End Source File
168 | # End Group
169 | # Begin Group "Resource Files"
170 |
171 | # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
172 | # End Group
173 | # Begin Source File
174 |
175 | SOURCE=..\README
176 | # End Source File
177 | # End Target
178 | # End Project
179 |
--------------------------------------------------------------------------------
/doc/overview.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | FastCGI Developer's Kit Index Page
6 |
7 |
10 |
11 |
12 |
13 |
14 | FastCGI Developer's Kit
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | -
23 | doc
24 |
25 | -
26 | FastCGI Technical White Paper Motivates FastCGI, then
27 | explains the FastCGI interface, FastCGI application roles, the FastCGI application library, server
28 | support for FastCGI, and FastCGI performance.
29 |
30 | -
31 | Understanding FastCGI Application Performance Why FastCGI applications
32 | often run faster than applications coded directly to Web server APIs.
33 |
34 | -
35 | FastCGI Developer's Kit
36 |
37 |
38 | -
39 | How to configure and build the kit for your development platform.
40 |
41 | -
42 | How to write applications using the libraries in the kit.
43 |
44 | -
45 | Documents cgi-fcgi, a tool in the kit that allows you to develop and test FastCGI
46 | applications using a Web server that lacks FastCGI support.
47 |
48 |
49 |
50 | -
51 | Open Market FastCGI 1.0 Programmer's Guide
52 | Programmer-oriented documentation for developers of applications that run on the Open Market's
53 | Secure WebServer 2.0. The content overlaps considerably with Section 3 of the Developer's Kit
54 | document.
55 |
56 | -
57 | FCGI_Accept.3,
58 | FCGI_Finish.3,
59 | FCGI_SetExitStatus.3,
60 | FCGI_StartFilterData.3, and
61 | cgi-fcgi.1
62 | manpages.
63 |
64 | -
65 | Integrating FastCGI with Perl How to build FastCGI support into the Perl
66 | interpreter and how to write FastCGI applications in Perl.
67 |
68 | -
69 | Integrating FastCGI with Tcl How to build FastCGI support into the Tcl
70 | interpreter and how to write FastCGI applications in Tcl.
71 |
72 | -
73 | Integrating FastCGI with Java How to build Web server applications in
74 | Java using FastCGI.
75 |
76 | -
77 | FastCGI: A High-Performance Gateway Interface Position paper
78 | presented at the workshop "Programming the Web -- a search for APIs", Fifth International
79 | World Wide Web Conference, 6 May 1996, Paris, France. A short paper, addressed to an audience of
80 | technical specialists.
81 |
82 | -
83 | FastCGI Specification document.
84 | Defines the interface between a FastCGI application and a Web server that supports FastCGI. This is
85 | dry stuff, not needed for writing applications!
86 |
87 |
88 |
89 | -
90 | include .h files for the FastCGI libraries.
91 |
92 | -
93 | libfcgi .c files for the FastCGI libraries.
94 |
95 | -
96 | examples Several example FastCGI programs.
97 |
98 | -
99 | perl The FastCGI Perl module, FCGI.pm.
100 |
101 | -
102 | java The FastCGI Java library.
103 |
104 | -
105 | cgi-fcgi The CGI-to-FastCGI bridge source code.
106 |
107 |
108 |
109 |
110 | © 1996, Open Market, Inc.
111 |
112 |
113 |
114 |
115 |
--------------------------------------------------------------------------------
/perl/Makefile.PL:
--------------------------------------------------------------------------------
1 | # $Id: Makefile.PL,v 1.33 2002/12/15 19:40:19 skimo Exp $
2 |
3 | use 5.006;
4 | use ExtUtils::MakeMaker;
5 | use IO::File;
6 | use Config;
7 | use Cwd 'cwd';
8 | use Getopt::Long;
9 | use File::Copy qw(copy);
10 |
11 | @h1 = qw(fastcgi.h fcgiapp.h fcgimisc.h fcgios.h);
12 | @h = (@h1, 'fcgi_config.h');
13 | @o = qw(FCGI.o);
14 | @dist1 = qw(LICENSE);
15 | @dist2 = qw(fcgiapp.c os_unix.c os_win32.c);
16 | @dist3 = (@h1, qw(fcgi_config_x86.h));
17 |
18 | GetOptions ("use-installed:s" => \$useinstalled);
19 |
20 | $libfound = 0;
21 | @libs = ();
22 |
23 | my $cwd = cwd();
24 | my $devkit = "$cwd/..";
25 |
26 | if (defined $useinstalled) {
27 | require ExtUtils::Liblist;
28 | my $libspec = $useinstalled ? "-L$useinstalled/lib " : "";
29 | $libspec .= "-lfcgi";
30 | my @l = MM->ext($libspec);
31 | if ($l[0] || $l[1] || $l[2]) {
32 | $prefix = "$useinstalled/include" if $useinstalled;
33 | $libfound = 1;
34 | push @libs, $libspec;
35 | }
36 | }
37 | if (!$libfound && -d "$devkit/libfcgi" && -d "$devkit/include") {
38 | # devkit
39 | if (grep { ! -f "$devkit/include/$_" } @dist3
40 | or grep { ! -f "$devkit/libfcgi/$_" } @dist2)
41 | {
42 | warn "This appears to be a FastCGI devkit distribution, " .
43 | "but one or more FastCGI library files are missing. \n" .
44 | "Please check the integrity of the distribution.\n";
45 | exit -1;
46 | }
47 |
48 | my $extrarules = join "\n",
49 | map { $b = $_; $b =~ s/\.c$//; my $s="$devkit/libfcgi/$b.c";
50 | "$b\$(OBJ_EXT): $s\n\t".
51 | '$(CCCMD) $(CCCDLFLAGS) -I$(PERL_INC) $(DEFINE) '."$s\n"; }
52 | @dist2;
53 | eval 'package MY; sub postamble { $extrarules; }';
54 | $prefix = $devkit;
55 | }
56 |
57 |
58 | $sys = $^O eq 'MSWin32' ? 'win32' : 'unix';
59 | push @o, "fcgiapp.o", "os_$sys.o" unless $libfound;
60 | $inc = '-I.' unless $libfound;
61 | $inc .= " -I$prefix/include" if $prefix;
62 |
63 | push(@extras, CAPI => 'TRUE')
64 | if ($] >= 5.005 and $^O eq 'MSWin32'
65 | and $Config{archname} =~ /-object\b/i);
66 |
67 | push(@extras,
68 | ABSTRACT => 'Fast CGI module',
69 | AUTHOR => 'Sven Verdoolaege (skimo@kotnet.org)'
70 | ) if ($ExtUtils::MakeMaker::VERSION >= 5.4301);
71 |
72 | push @extras, META_MERGE => {
73 | 'meta-spec' => { version => 2 },
74 | dynamic_config => 0,
75 | resources => {
76 | repository => {
77 | # this is the real repository
78 | # r/w: catagits@git.shadowcat.co.uk:fcgi2.git
79 | # r/o: git://git.shadowcat.co.uk/catagits/fcgi2.git
80 | # web: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits/fcgi2.git
81 | # this is a mirror, but can receive pull requests
82 | url => 'https://github.com/perl-catalyst/FCGI.git',
83 | web => 'https://github.com/perl-catalyst/FCGI',
84 | type => 'git',
85 | },
86 | bugtracker => {
87 | mailto => 'bug-FCGI@rt.cpan.org',
88 | web => 'https://rt.cpan.org/Public/Dist/Display.html?Name=FCGI',
89 | },
90 | },
91 | } if $ExtUtils::MakeMaker::VERSION >= 6.46;
92 |
93 | push(@extras,
94 | MIN_PERL_VERSION => '5.006',
95 | ) if $ExtUtils::MakeMaker::VERSION >= 6.48;
96 |
97 | # not strictly necessary as everything is in core...
98 | #push(@extras,
99 | # CONFIGURE_REQUIRES => {
100 | # ...
101 | # },
102 | #) if $ExtUtils::MakeMaker::VERSION >= 6.51_03;
103 |
104 | if ("$sys" eq "win32") {
105 | push @libs, ":nosearch -lws2_32";
106 | push @extras, 'DEFINE' => '-DDLLAPI=__declspec(dllexport)';
107 | }
108 |
109 | push @extras,
110 | 'LIBS' => [ "@libs" ],
111 | 'OBJECT' => "@o",
112 | 'INC' => $inc;
113 |
114 | # See lib/ExtUtils/MakeMaker.pm for details of how to influence
115 | # the contents of the Makefile that is written.
116 |
117 | # Work around bug in previous versions of MakeMaker
118 | WriteMakefile(
119 | 'NAME' => 'FCGI',
120 | 'VERSION_FROM' => 'FCGI.pm',
121 | 'dist' => {
122 | 'COMPRESS' => 'gzip -9f',
123 | 'SUFFIX' => 'gz',
124 | 'PREOP' => '$(CP) '.join(' ',
125 | map {"../$_"} @dist1,
126 | (map {"libfcgi/$_"} @dist2),
127 | map {"include/$_"} @dist3).' $(DISTVNAME);'.
128 | '$(CP) MANIFEST MANIFEST.old;'.
129 | '$(ECHO) '. join('\\\n',@dist1,@dist2,@dist3) .
130 | '>> $(DISTVNAME)/MANIFEST',
131 | 'POSTOP' =>
132 | '$(MV) MANIFEST.old MANIFEST',
133 | },
134 | 'clean' => { FILES => 'config.cache fcgi_config.h fcgi_config.h.in fcgi_config.h.in~' .
135 | ' FCGI.c aclocal.m4 autom4te.cache config.log config.status' .
136 | ' FCGI.cfg' },
137 | 'realclean' => { FILES => 'FCGI-*.tar.gz configure configure~ MANIFEST.SKIP.bak MANIFEST.bak Makefile.old' },
138 | PM => {'FCGI.pm' => '$(INST_ARCHLIBDIR)/FCGI.pm'},
139 | PREREQ_PM => {'XSLoader' => '0'},
140 | TEST_REQUIRES => {
141 | 'Config' => 0,
142 | 'FCGI::Client' => 0.09,
143 | 'File::Temp' => 0,
144 | 'IO::Socket' => 0,
145 | 'Test::More' => 0,
146 | },
147 | @extras,
148 | );
149 |
150 | exit if -f 'fcgi_config.h' or $libfound;
151 |
152 | # CPAN and no installed lib found
153 | if ($sys eq "win32") {
154 | # configure will almost certainly not run on a normal NT install,
155 | # use the pregenerated configuration file
156 |
157 | print "Using prebuilt fcgi_config.h file for Windows\n";
158 | unlink("fcgi_config.h");
159 | my $confdir = $prefix ? "$prefix/include/" : '';
160 | die $! unless copy("${confdir}fcgi_config_x86.h","fcgi_config.h");
161 | } else {
162 | print "Running ./configure for you\n";
163 | print "Please read configure.readme for information on how to run it yourself\n";
164 |
165 | $ENV{'CC'} = $Config{'cc'};
166 | if ( $^O eq 'android' && !$ENV{'TMPDIR'} ) {
167 | # See http://stackoverflow.com/a/15417261
168 | require File::Spec;
169 | $ENV{'TMPDIR'} = File::Spec->tmpdir();
170 | }
171 | system("$Config{sh} configure");
172 | }
173 |
174 |
--------------------------------------------------------------------------------
/examples/echo-cpp.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * A simple FastCGI application example in C++.
3 | *
4 | * $Id: echo-cpp.cpp,v 1.10 2002/02/25 00:46:17 robs Exp $
5 | *
6 | * Copyright (c) 2001 Rob Saccoccio and Chelsea Networks
7 | * All rights reserved.
8 | *
9 | * Redistribution and use in source and binary forms, with or without
10 | * modification, are permitted provided that the following conditions
11 | * are met:
12 | *
13 | * 1. Redistributions of source code must retain the above copyright
14 | * notice, this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright
16 | * notice, this list of conditions and the following disclaimer in the
17 | * documentation and/or other materials provided with the distribution.
18 | * 3. The name of the author may not be used to endorse or promote products
19 | * derived from this software without specific prior written permission.
20 | *
21 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
22 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
23 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
24 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
26 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | #include
34 | #ifdef _WIN32
35 | #include
36 | #else
37 | #include
38 | extern char ** environ;
39 | #endif
40 | #include "fcgio.h"
41 | #include "fcgi_config.h" // HAVE_IOSTREAM_WITHASSIGN_STREAMBUF
42 |
43 | using namespace std;
44 |
45 | // Maximum number of bytes allowed to be read from stdin
46 | static const unsigned long STDIN_MAX = 1000000;
47 |
48 | static void penv(const char * const * envp)
49 | {
50 | cout << "\n";
51 | for ( ; *envp; ++envp)
52 | {
53 | cout << *envp << "\n";
54 | }
55 | cout << "\n";
56 | }
57 |
58 | static long gstdin(FCGX_Request * request, char ** content)
59 | {
60 | char * clenstr = FCGX_GetParam("CONTENT_LENGTH", request->envp);
61 | unsigned long clen = STDIN_MAX;
62 |
63 | if (clenstr)
64 | {
65 | clen = strtol(clenstr, &clenstr, 10);
66 | if (*clenstr)
67 | {
68 | cerr << "can't parse \"CONTENT_LENGTH="
69 | << FCGX_GetParam("CONTENT_LENGTH", request->envp)
70 | << "\"\n";
71 | clen = STDIN_MAX;
72 | }
73 |
74 | // *always* put a cap on the amount of data that will be read
75 | if (clen > STDIN_MAX) clen = STDIN_MAX;
76 |
77 | *content = new char[clen];
78 |
79 | cin.read(*content, clen);
80 | clen = cin.gcount();
81 | }
82 | else
83 | {
84 | // *never* read stdin when CONTENT_LENGTH is missing or unparsable
85 | *content = 0;
86 | clen = 0;
87 | }
88 |
89 | // Chew up any remaining stdin - this shouldn't be necessary
90 | // but is because mod_fastcgi doesn't handle it correctly.
91 |
92 | // ignore() doesn't set the eof bit in some versions of glibc++
93 | // so use gcount() instead of eof()...
94 | do cin.ignore(1024); while (cin.gcount() == 1024);
95 |
96 | return clen;
97 | }
98 |
99 | int main (void)
100 | {
101 | int count = 0;
102 | long pid = getpid();
103 |
104 | streambuf * cin_streambuf = cin.rdbuf();
105 | streambuf * cout_streambuf = cout.rdbuf();
106 | streambuf * cerr_streambuf = cerr.rdbuf();
107 |
108 | FCGX_Request request;
109 |
110 | FCGX_Init();
111 | FCGX_InitRequest(&request, 0, 0);
112 |
113 | while (FCGX_Accept_r(&request) == 0)
114 | {
115 | // Note that the default bufsize (0) will cause the use of iostream
116 | // methods that require positioning (such as peek(), seek(),
117 | // unget() and putback()) to fail (in favour of more efficient IO).
118 | fcgi_streambuf cin_fcgi_streambuf(request.in);
119 | fcgi_streambuf cout_fcgi_streambuf(request.out);
120 | fcgi_streambuf cerr_fcgi_streambuf(request.err);
121 |
122 | #if HAVE_IOSTREAM_WITHASSIGN_STREAMBUF
123 | cin = &cin_fcgi_streambuf;
124 | cout = &cout_fcgi_streambuf;
125 | cerr = &cerr_fcgi_streambuf;
126 | #else
127 | cin.rdbuf(&cin_fcgi_streambuf);
128 | cout.rdbuf(&cout_fcgi_streambuf);
129 | cerr.rdbuf(&cerr_fcgi_streambuf);
130 | #endif
131 |
132 | // Although FastCGI supports writing before reading,
133 | // many http clients (browsers) don't support it (so
134 | // the connection deadlocks until a timeout expires!).
135 | char * content;
136 | unsigned long clen = gstdin(&request, &content);
137 |
138 | cout << "Content-type: text/html\r\n"
139 | "\r\n"
140 | "echo-cpp\n"
141 | "echo-cpp
\n"
142 | "PID: " << pid << "
\n"
143 | "Request Number: " << ++count << "
\n";
144 |
145 | cout << "Request Environment
\n";
146 | penv(request.envp);
147 |
148 | cout << "Process/Initial Environment
\n";
149 | penv(environ);
150 |
151 | cout << "Standard Input - " << clen;
152 | if (clen == STDIN_MAX) cout << " (STDIN_MAX)";
153 | cout << " bytes
\n";
154 | if (clen) cout.write(content, clen);
155 |
156 | if (content) delete []content;
157 |
158 | // If the output streambufs had non-zero bufsizes and
159 | // were constructed outside of the accept loop (i.e.
160 | // their destructor won't be called here), they would
161 | // have to be flushed here.
162 | }
163 |
164 | #if HAVE_IOSTREAM_WITHASSIGN_STREAMBUF
165 | cin = cin_streambuf;
166 | cout = cout_streambuf;
167 | cerr = cerr_streambuf;
168 | #else
169 | cin.rdbuf(cin_streambuf);
170 | cout.rdbuf(cout_streambuf);
171 | cerr.rdbuf(cerr_streambuf);
172 | #endif
173 |
174 | return 0;
175 | }
176 |
--------------------------------------------------------------------------------
/include/fcgi_stdio.h:
--------------------------------------------------------------------------------
1 | /*
2 | * fcgi_stdio.h --
3 | *
4 | * FastCGI-stdio compatibility package
5 | *
6 | *
7 | * Copyright (c) 1996 Open Market, Inc.
8 | *
9 | * See the file "LICENSE" for information on usage and redistribution
10 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES.
11 | *
12 | * $Id: fcgi_stdio.h,v 1.5 2001/06/22 13:21:15 robs Exp $
13 | */
14 |
15 | #ifndef _FCGI_STDIO
16 | #define _FCGI_STDIO 1
17 |
18 | #include
19 | #include
20 | #include "fcgiapp.h"
21 |
22 | #if defined (c_plusplus) || defined (__cplusplus)
23 | extern "C" {
24 | #endif
25 |
26 | #ifndef DLLAPI
27 | #if defined (_WIN32) && defined (_MSC_VER)
28 | #define DLLAPI __declspec(dllimport)
29 | #else
30 | #define DLLAPI
31 | #endif
32 | #endif
33 |
34 | /*
35 | * Wrapper type for FILE
36 | */
37 |
38 | typedef struct {
39 | FILE *stdio_stream;
40 | FCGX_Stream *fcgx_stream;
41 | } FCGI_FILE;
42 |
43 | /*
44 | * The four new functions and two new macros
45 | */
46 |
47 | DLLAPI int FCGI_Accept(void);
48 | DLLAPI void FCGI_Finish(void);
49 | DLLAPI int FCGI_StartFilterData(void);
50 | DLLAPI void FCGI_SetExitStatus(int status);
51 |
52 | #define FCGI_ToFILE(fcgi_file) (fcgi_file->stdio_stream)
53 | #define FCGI_ToFcgiStream(fcgi_file) (fcgi_file->fcgx_stream)
54 |
55 | /*
56 | * Wrapper stdin, stdout, and stderr variables, set up by FCGI_Accept()
57 | */
58 |
59 | DLLAPI extern FCGI_FILE _fcgi_sF[];
60 | #define FCGI_stdin (&_fcgi_sF[0])
61 | #define FCGI_stdout (&_fcgi_sF[1])
62 | #define FCGI_stderr (&_fcgi_sF[2])
63 |
64 | /*
65 | * Wrapper function prototypes, grouped according to sections
66 | * of Harbison & Steele, "C: A Reference Manual," fourth edition,
67 | * Prentice-Hall, 1995.
68 | */
69 |
70 | DLLAPI void FCGI_perror(const char *str);
71 |
72 | DLLAPI FCGI_FILE *FCGI_fopen(const char *path, const char *mode);
73 | DLLAPI int FCGI_fclose(FCGI_FILE *fp);
74 | DLLAPI int FCGI_fflush(FCGI_FILE *fp);
75 | DLLAPI FCGI_FILE *FCGI_freopen(const char *path, const char *mode, FCGI_FILE *fp);
76 |
77 | DLLAPI int FCGI_setvbuf(FCGI_FILE *fp, char *buf, int bufmode, size_t size);
78 | DLLAPI void FCGI_setbuf(FCGI_FILE *fp, char *buf);
79 |
80 | DLLAPI int FCGI_fseek(FCGI_FILE *fp, long offset, int whence);
81 | DLLAPI int FCGI_ftell(FCGI_FILE *fp);
82 | DLLAPI void FCGI_rewind(FCGI_FILE *fp);
83 | #ifdef HAVE_FPOS
84 | DLLAPI int FCGI_fgetpos(FCGI_FILE *fp, fpos_t *pos);
85 | DLLAPI int FCGI_fsetpos(FCGI_FILE *fp, const fpos_t *pos);
86 | #endif
87 | DLLAPI int FCGI_fgetc(FCGI_FILE *fp);
88 | DLLAPI int FCGI_getchar(void);
89 | DLLAPI int FCGI_ungetc(int c, FCGI_FILE *fp);
90 |
91 | DLLAPI char *FCGI_fgets(char *str, int size, FCGI_FILE *fp);
92 | DLLAPI char *FCGI_gets(char *str);
93 |
94 | /*
95 | * Not yet implemented
96 | *
97 | * int FCGI_fscanf(FCGI_FILE *fp, const char *format, ...);
98 | * int FCGI_scanf(const char *format, ...);
99 | *
100 | */
101 |
102 | DLLAPI int FCGI_fputc(int c, FCGI_FILE *fp);
103 | DLLAPI int FCGI_putchar(int c);
104 |
105 | DLLAPI int FCGI_fputs(const char *str, FCGI_FILE *fp);
106 | DLLAPI int FCGI_puts(const char *str);
107 |
108 | DLLAPI int FCGI_fprintf(FCGI_FILE *fp, const char *format, ...);
109 | DLLAPI int FCGI_printf(const char *format, ...);
110 |
111 | DLLAPI int FCGI_vfprintf(FCGI_FILE *fp, const char *format, va_list ap);
112 | DLLAPI int FCGI_vprintf(const char *format, va_list ap);
113 |
114 | DLLAPI size_t FCGI_fread(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp);
115 | DLLAPI size_t FCGI_fwrite(void *ptr, size_t size, size_t nmemb, FCGI_FILE *fp);
116 |
117 | DLLAPI int FCGI_feof(FCGI_FILE *fp);
118 | DLLAPI int FCGI_ferror(FCGI_FILE *fp);
119 | DLLAPI void FCGI_clearerr(FCGI_FILE *fp);
120 |
121 | DLLAPI FCGI_FILE *FCGI_tmpfile(void);
122 |
123 | DLLAPI int FCGI_fileno(FCGI_FILE *fp);
124 | DLLAPI FCGI_FILE *FCGI_fdopen(int fd, const char *mode);
125 | DLLAPI FCGI_FILE *FCGI_popen(const char *cmd, const char *type);
126 | DLLAPI int FCGI_pclose(FCGI_FILE *);
127 |
128 | /*
129 | * The remaining definitions are for application programs,
130 | * not for fcgi_stdio.c
131 | */
132 |
133 | #ifndef NO_FCGI_DEFINES
134 |
135 | /*
136 | * Replace standard types, variables, and functions with FastCGI wrappers.
137 | * Use undef in case a macro is already defined.
138 | */
139 |
140 | #undef FILE
141 | #define FILE FCGI_FILE
142 |
143 | #undef stdin
144 | #define stdin FCGI_stdin
145 | #undef stdout
146 | #define stdout FCGI_stdout
147 | #undef stderr
148 | #define stderr FCGI_stderr
149 |
150 | #undef perror
151 | #define perror FCGI_perror
152 |
153 | #undef fopen
154 | #define fopen FCGI_fopen
155 | #undef fclose
156 | #define fclose FCGI_fclose
157 | #undef fflush
158 | #define fflush FCGI_fflush
159 | #undef freopen
160 | #define freopen FCGI_freopen
161 |
162 | #undef setvbuf
163 | #define setvbuf FCGI_setvbuf
164 | #undef setbuf
165 | #define setbuf FCGI_setbuf
166 |
167 | #undef fseek
168 | #define fseek FCGI_fseek
169 | #undef ftell
170 | #define ftell FCGI_ftell
171 | #undef rewind
172 | #define rewind FCGI_rewind
173 | #undef fgetpos
174 | #define fgetpos FCGI_fgetpos
175 | #undef fsetpos
176 | #define fsetpos FCGI_fsetpos
177 |
178 | #undef fgetc
179 | #define fgetc FCGI_fgetc
180 | #undef getc
181 | #define getc FCGI_fgetc
182 | #undef getchar
183 | #define getchar FCGI_getchar
184 | #undef ungetc
185 | #define ungetc FCGI_ungetc
186 |
187 | #undef fgets
188 | #define fgets FCGI_fgets
189 | #undef gets
190 | #define gets FCGI_gets
191 |
192 | #undef fputc
193 | #define fputc FCGI_fputc
194 | #undef putc
195 | #define putc FCGI_fputc
196 | #undef putchar
197 | #define putchar FCGI_putchar
198 |
199 | #undef fputs
200 | #define fputs FCGI_fputs
201 | #undef puts
202 | #define puts FCGI_puts
203 |
204 | #undef fprintf
205 | #define fprintf FCGI_fprintf
206 | #undef printf
207 | #define printf FCGI_printf
208 |
209 | #undef vfprintf
210 | #define vfprintf FCGI_vfprintf
211 | #undef vprintf
212 | #define vprintf FCGI_vprintf
213 |
214 | #undef fread
215 | #define fread FCGI_fread
216 | #undef fwrite
217 | #define fwrite FCGI_fwrite
218 |
219 | #undef feof
220 | #define feof FCGI_feof
221 | #undef ferror
222 | #define ferror FCGI_ferror
223 | #undef clearerr
224 | #define clearerr FCGI_clearerr
225 |
226 | #undef tmpfile
227 | #define tmpfile FCGI_tmpfile
228 |
229 | #undef fileno
230 | #define fileno FCGI_fileno
231 | #undef fdopen
232 | #define fdopen FCGI_fdopen
233 | #undef popen
234 | #define popen FCGI_popen
235 | #undef pclose
236 | #define pclose FCGI_pclose
237 |
238 | #endif /* NO_FCGI_DEFINES */
239 |
240 | #if defined (__cplusplus) || defined (c_plusplus)
241 | } /* terminate extern "C" { */
242 | #endif
243 |
244 | #endif /* _FCGI_STDIO */
245 |
246 |
--------------------------------------------------------------------------------