-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 22 | ||||
-rw-r--r-- | configure.ac | 25 | ||||
-rw-r--r-- | include/Makefile.am | 3 | ||||
-rw-r--r-- | include/kingate/plaincgi.h | 44 | ||||
-rw-r--r-- | kingate-plaincgi.pc.in | 11 | ||||
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/fastcgi.cc | 1 | ||||
-rw-r--r-- | src/plaincgi.cc | 27 |
9 files changed, 121 insertions, 25 deletions
@@ -21,3 +21,4 @@ aclocal.m4 | |||
21 | install-sh | 21 | install-sh |
22 | NEWS | 22 | NEWS |
23 | doxydox | 23 | doxydox |
24 | kingate-plaincgi.pc | ||
diff --git a/Makefile.am b/Makefile.am index 9833732..3e9f0f1 100644 --- a/Makefile.am +++ b/Makefile.am | |||
@@ -4,24 +4,22 @@ EXTRA_DIST= NEWS NEWS.xml NEWS.xsl | |||
4 | DISTCHECK_CONFIGURE_FLAGS=--with-pkgconfigdir=$${dc_install_base}/lib/pkgconfig | 4 | DISTCHECK_CONFIGURE_FLAGS=--with-pkgconfigdir=$${dc_install_base}/lib/pkgconfig |
5 | if HAVE_PKGCONFIG | 5 | if HAVE_PKGCONFIG |
6 | pkgconfigdir=@PKGCONFIG_DIR@ | 6 | pkgconfigdir=@PKGCONFIG_DIR@ |
7 | pkgconfig_DATA=kingate.pc kingate-fcgi.pc | 7 | pkgconfig_DATA=kingate.pc kingate-plaincgi.pc |
8 | if HAVE_FCGI | ||
9 | pkgconfig_DATA += kingate-fcgi.pc | ||
10 | endif | ||
8 | endif | 11 | endif |
9 | 12 | ||
10 | LOCAL_TARGETS= | 13 | all-local: NEWS |
11 | if HAVE_DOXYGEN | 14 | if HAVE_DOXYGEN |
12 | LOCAL_TARGETS+=doxygen | 15 | clean-local: |
16 | rm -rf doxydox | ||
13 | endif | 17 | endif |
14 | 18 | ||
15 | all-local: NEWS $(addprefix all-lota-,${LOCAL_TARGETS}) | ||
16 | clean-local: $(addprefix clean-lota-,${LOCAL_TARGETS}) | ||
17 | |||
18 | NEWS: NEWS.xsl NEWS.xml | 19 | NEWS: NEWS.xsl NEWS.xml |
19 | ${XSLTPROC} -o $@ NEWS.xsl NEWS.xml | 20 | ${XSLTPROC} -o $@ NEWS.xsl NEWS.xml |
20 | 21 | ||
21 | all-lota-doxygen: doxydox/built | 22 | if HAVE_DOXYGEN |
22 | doxydox/built: $(wildcard ${top_srcdir}/include/kingate/*.h) | 23 | dox: |
23 | ${DOXYGEN} | 24 | ${DOXYGEN} |
24 | touch $@ | 25 | endif |
25 | |||
26 | clean-lota-doxygen: | ||
27 | rm -rf doxydox | ||
diff --git a/configure.ac b/configure.ac index 109eddf..5ae7b27 100644 --- a/configure.ac +++ b/configure.ac | |||
@@ -1,4 +1,4 @@ | |||
1 | AC_INIT([kingate], [0.0], [kingate-bugs@klever.net]) | 1 | AC_INIT([kingate], [0.0.1], [kingate-bugs@klever.net]) |
2 | AC_CONFIG_SRCDIR([include/kingate/cgi_gateway.h]) | 2 | AC_CONFIG_SRCDIR([include/kingate/cgi_gateway.h]) |
3 | AC_CONFIG_HEADER([config.h]) | 3 | AC_CONFIG_HEADER([config.h]) |
4 | AM_INIT_AUTOMAKE([dist-bzip2]) | 4 | AM_INIT_AUTOMAKE([dist-bzip2]) |
@@ -12,17 +12,22 @@ AC_PROG_LIBTOOL | |||
12 | AC_HEADER_STDC | 12 | AC_HEADER_STDC |
13 | AC_CHECK_HEADERS([sys/types.h sys/stat.h]) | 13 | AC_CHECK_HEADERS([sys/types.h sys/stat.h]) |
14 | 14 | ||
15 | HAVE_FCGI=false | ||
15 | AC_LANG_PUSH(C++) | 16 | AC_LANG_PUSH(C++) |
16 | AC_CHECK_HEADERS([fcgio.h],,[ | 17 | AC_CHECK_HEADERS([fcgio.h],[ |
17 | exit 1 | 18 | AC_CHECK_LIB(fcgi,FCGX_Init,[ |
18 | ]) | 19 | LIBS="-lfcgi ${LIBS}" |
19 | AC_CHECK_LIB(fcgi,FCGX_Init,,[ | 20 | AC_CHECK_LIB([fcgi++],[main],[ |
20 | exit 1 | 21 | LIBS="-lfcgi++ ${LIBS}" |
21 | ]) | 22 | HAVE_FCGI=true |
22 | AC_CHECK_LIB([fcgi++],[main],,[ | 23 | ]) |
23 | exit 1 | 24 | ]) |
24 | ]) | 25 | ]) |
25 | AC_LANG_POP(C++) | 26 | AC_LANG_POP(C++) |
27 | if ! ${HAVE_FCGI} ; then | ||
28 | AC_MSG_NOTICE([no FastCGI development kit found. It is highly recommnded that you get one. Meanwhile we will proceed without FastCGI support]) | ||
29 | fi | ||
30 | AM_CONDITIONAL([HAVE_FCGI],[${HAVE_FCGI}]) | ||
26 | 31 | ||
27 | AC_C_CONST | 32 | AC_C_CONST |
28 | 33 | ||
@@ -54,7 +59,7 @@ fi | |||
54 | 59 | ||
55 | AC_CONFIG_FILES([ | 60 | AC_CONFIG_FILES([ |
56 | Makefile | 61 | Makefile |
57 | kingate.pc kingate-fcgi.pc | 62 | kingate.pc kingate-fcgi.pc kingate-plaincgi.pc |
58 | Doxyfile | 63 | Doxyfile |
59 | include/Makefile | 64 | include/Makefile |
60 | src/Makefile | 65 | src/Makefile |
diff --git a/include/Makefile.am b/include/Makefile.am index c1ec36e..e0b778b 100644 --- a/include/Makefile.am +++ b/include/Makefile.am | |||
@@ -3,4 +3,5 @@ nobase_include_HEADERS = \ | |||
3 | kingate/cgi_interface.h \ | 3 | kingate/cgi_interface.h \ |
4 | kingate/fastcgi.h \ | 4 | kingate/fastcgi.h \ |
5 | kingate/exception.h \ | 5 | kingate/exception.h \ |
6 | kingate/util.h | 6 | kingate/util.h \ |
7 | kingate/plaincgi.h | ||
diff --git a/include/kingate/plaincgi.h b/include/kingate/plaincgi.h new file mode 100644 index 0000000..745839e --- a/dev/null +++ b/include/kingate/plaincgi.h | |||
@@ -0,0 +1,44 @@ | |||
1 | #ifndef __KINGATE_PLAINCGI_H | ||
2 | #define __KINGATE_PLAINCGI_H | ||
3 | |||
4 | #include <iostream> | ||
5 | #include "kingate/cgi_interface.h" | ||
6 | |||
7 | /** | ||
8 | * @file | ||
9 | * @brief the "plain" cgi specific implementation. | ||
10 | */ | ||
11 | |||
12 | namespace kingate { | ||
13 | |||
14 | /** | ||
15 | * The implementation of the interface to the regular CGI. | ||
16 | */ | ||
17 | class plaincgi_interface : public cgi_interface { | ||
18 | public: | ||
19 | |||
20 | /** | ||
21 | */ | ||
22 | plaincgi_interface(); | ||
23 | virtual ~plaincgi_interface(); | ||
24 | |||
25 | /** | ||
26 | * @overload cgi_interface::in() | ||
27 | */ | ||
28 | istream& in() { return cin; } | ||
29 | /** | ||
30 | * @overload cgi_interface::out() | ||
31 | */ | ||
32 | ostream& out() { return cout; } | ||
33 | /** | ||
34 | * @overload cgi_interface::out() | ||
35 | */ | ||
36 | ostream& err() { return cerr; } | ||
37 | }; | ||
38 | |||
39 | } | ||
40 | |||
41 | #endif /* __KINGATE_PLAINCGI_H */ | ||
42 | /* | ||
43 | * vim:set ft=cpp: | ||
44 | */ | ||
diff --git a/kingate-plaincgi.pc.in b/kingate-plaincgi.pc.in new file mode 100644 index 0000000..deb8e9d --- a/dev/null +++ b/kingate-plaincgi.pc.in | |||
@@ -0,0 +1,11 @@ | |||
1 | prefix=@prefix@ | ||
2 | exec_prefix=@exec_prefix@ | ||
3 | libdir=@libdir@ | ||
4 | includedir=@includedir@ | ||
5 | |||
6 | Name: kingate-plaincgi | ||
7 | Description: plain cgi implementation of kingate interface | ||
8 | Version: @VERSION@ | ||
9 | Requires: kingate = @VERSION@ | ||
10 | Libs: -L${libdir} -lkingate-plaincgi | ||
11 | Cflags: -I${includedir} | ||
diff --git a/src/Makefile.am b/src/Makefile.am index 8a5447b..e5c6778 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -1,4 +1,8 @@ | |||
1 | lib_LTLIBRARIES = libkingate.la libkingate-fcgi.la | 1 | lib_LTLIBRARIES = libkingate.la libkingate-plaincgi.la |
2 | |||
3 | if HAVE_FCGI | ||
4 | lib_LTLIBRARIES += libkingate-fcgi.la | ||
5 | endif | ||
2 | 6 | ||
3 | INCLUDES = -I${top_srcdir}/include | 7 | INCLUDES = -I${top_srcdir}/include |
4 | AM_CXXFLAGS = ${KONFORKA_CFLAGS} | 8 | AM_CXXFLAGS = ${KONFORKA_CFLAGS} |
@@ -13,3 +17,9 @@ libkingate_la_LDFLAGS = -version-info 1:0:0 | |||
13 | libkingate_fcgi_la_SOURCES = \ | 17 | libkingate_fcgi_la_SOURCES = \ |
14 | fastcgi.cc | 18 | fastcgi.cc |
15 | libkingate_fcgi_la_LDFLAGS = -version-info 1:0:0 | 19 | libkingate_fcgi_la_LDFLAGS = -version-info 1:0:0 |
20 | |||
21 | libkingate_plaincgi_la_SOURCES = \ | ||
22 | plaincgi.cc | ||
23 | libkingate_plaincgi_la_LDFLAGS = -version-info 1:0:0 | ||
24 | |||
25 | EXTRA_DIST = ${libkingate_fcgi_la_SOURCES} | ||
diff --git a/src/fastcgi.cc b/src/fastcgi.cc index 7484449..6285370 100644 --- a/src/fastcgi.cc +++ b/src/fastcgi.cc | |||
@@ -45,7 +45,6 @@ namespace kingate { | |||
45 | sbin.attach(request.in); | 45 | sbin.attach(request.in); |
46 | sbout.attach(request.out); | 46 | sbout.attach(request.out); |
47 | sberr.attach(request.err); | 47 | sberr.attach(request.err); |
48 | metavars.clear(); // XXX: redundant. | ||
49 | for(char **p = request.envp; *p; p++) { | 48 | for(char **p = request.envp; *p; p++) { |
50 | const char *e = strchr(*p,'='); | 49 | const char *e = strchr(*p,'='); |
51 | if(!e){ | 50 | if(!e){ |
diff --git a/src/plaincgi.cc b/src/plaincgi.cc new file mode 100644 index 0000000..6934748 --- a/dev/null +++ b/src/plaincgi.cc | |||
@@ -0,0 +1,27 @@ | |||
1 | #include <unistd.h> | ||
2 | #include <sys/types.h> | ||
3 | #include <sys/stat.h> | ||
4 | #include "kingate/plaincgi.h" | ||
5 | #include "kingate/exception.h" | ||
6 | |||
7 | namespace kingate { | ||
8 | |||
9 | plaincgi_interface::plaincgi_interface() { | ||
10 | for(char **p = environ; *p; p++) { | ||
11 | const char *e = strchr(*p,'='); | ||
12 | if(!e){ | ||
13 | // XXX: check if we have it already? | ||
14 | metavars[*p] = string(0); | ||
15 | }else{ | ||
16 | int l = e-*p; e++; | ||
17 | // XXX: check if we have it already? | ||
18 | metavars[string(*p,l)]=e; | ||
19 | } | ||
20 | } | ||
21 | } | ||
22 | plaincgi_interface::~plaincgi_interface() { | ||
23 | cout.flush(); | ||
24 | cerr.flush(); | ||
25 | } | ||
26 | |||
27 | } | ||