summaryrefslogtreecommitdiffabout
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am22
-rw-r--r--configure.ac25
-rw-r--r--include/Makefile.am3
-rw-r--r--include/kingate/plaincgi.h44
-rw-r--r--kingate-plaincgi.pc.in11
-rw-r--r--src/Makefile.am12
-rw-r--r--src/fastcgi.cc1
-rw-r--r--src/plaincgi.cc27
9 files changed, 121 insertions, 25 deletions
diff --git a/.gitignore b/.gitignore
index 02145e3..1997933 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,3 +21,4 @@ aclocal.m4
install-sh
NEWS
doxydox
+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
DISTCHECK_CONFIGURE_FLAGS=--with-pkgconfigdir=$${dc_install_base}/lib/pkgconfig
if HAVE_PKGCONFIG
pkgconfigdir=@PKGCONFIG_DIR@
-pkgconfig_DATA=kingate.pc kingate-fcgi.pc
+pkgconfig_DATA=kingate.pc kingate-plaincgi.pc
+if HAVE_FCGI
+pkgconfig_DATA += kingate-fcgi.pc
+endif
endif
-LOCAL_TARGETS=
+all-local: NEWS
if HAVE_DOXYGEN
-LOCAL_TARGETS+=doxygen
+clean-local:
+ rm -rf doxydox
endif
-all-local: NEWS $(addprefix all-lota-,${LOCAL_TARGETS})
-clean-local: $(addprefix clean-lota-,${LOCAL_TARGETS})
-
NEWS: NEWS.xsl NEWS.xml
${XSLTPROC} -o $@ NEWS.xsl NEWS.xml
-all-lota-doxygen: doxydox/built
-doxydox/built: $(wildcard ${top_srcdir}/include/kingate/*.h)
+if HAVE_DOXYGEN
+dox:
${DOXYGEN}
- touch $@
-
-clean-lota-doxygen:
- rm -rf doxydox
+endif
diff --git a/configure.ac b/configure.ac
index 109eddf..5ae7b27 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1,4 +1,4 @@
-AC_INIT([kingate], [0.0], [kingate-bugs@klever.net])
+AC_INIT([kingate], [0.0.1], [kingate-bugs@klever.net])
AC_CONFIG_SRCDIR([include/kingate/cgi_gateway.h])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE([dist-bzip2])
@@ -12,17 +12,22 @@ AC_PROG_LIBTOOL
AC_HEADER_STDC
AC_CHECK_HEADERS([sys/types.h sys/stat.h])
+HAVE_FCGI=false
AC_LANG_PUSH(C++)
-AC_CHECK_HEADERS([fcgio.h],,[
- exit 1
-])
-AC_CHECK_LIB(fcgi,FCGX_Init,,[
- exit 1
-])
-AC_CHECK_LIB([fcgi++],[main],,[
- exit 1
+AC_CHECK_HEADERS([fcgio.h],[
+ AC_CHECK_LIB(fcgi,FCGX_Init,[
+ LIBS="-lfcgi ${LIBS}"
+ AC_CHECK_LIB([fcgi++],[main],[
+ LIBS="-lfcgi++ ${LIBS}"
+ HAVE_FCGI=true
+ ])
+ ])
])
AC_LANG_POP(C++)
+if ! ${HAVE_FCGI} ; then
+ AC_MSG_NOTICE([no FastCGI development kit found. It is highly recommnded that you get one. Meanwhile we will proceed without FastCGI support])
+fi
+AM_CONDITIONAL([HAVE_FCGI],[${HAVE_FCGI}])
AC_C_CONST
@@ -54,7 +59,7 @@ fi
AC_CONFIG_FILES([
Makefile
- kingate.pc kingate-fcgi.pc
+ kingate.pc kingate-fcgi.pc kingate-plaincgi.pc
Doxyfile
include/Makefile
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 = \
kingate/cgi_interface.h \
kingate/fastcgi.h \
kingate/exception.h \
- kingate/util.h
+ kingate/util.h \
+ 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 @@
+#ifndef __KINGATE_PLAINCGI_H
+#define __KINGATE_PLAINCGI_H
+
+#include <iostream>
+#include "kingate/cgi_interface.h"
+
+/**
+ * @file
+ * @brief the "plain" cgi specific implementation.
+ */
+
+namespace kingate {
+
+ /**
+ * The implementation of the interface to the regular CGI.
+ */
+ class plaincgi_interface : public cgi_interface {
+ public:
+
+ /**
+ */
+ plaincgi_interface();
+ virtual ~plaincgi_interface();
+
+ /**
+ * @overload cgi_interface::in()
+ */
+ istream& in() { return cin; }
+ /**
+ * @overload cgi_interface::out()
+ */
+ ostream& out() { return cout; }
+ /**
+ * @overload cgi_interface::out()
+ */
+ ostream& err() { return cerr; }
+ };
+
+}
+
+#endif /* __KINGATE_PLAINCGI_H */
+/*
+ * vim:set ft=cpp:
+ */
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 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: kingate-plaincgi
+Description: plain cgi implementation of kingate interface
+Version: @VERSION@
+Requires: kingate = @VERSION@
+Libs: -L${libdir} -lkingate-plaincgi
+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 @@
-lib_LTLIBRARIES = libkingate.la libkingate-fcgi.la
+lib_LTLIBRARIES = libkingate.la libkingate-plaincgi.la
+
+if HAVE_FCGI
+lib_LTLIBRARIES += libkingate-fcgi.la
+endif
INCLUDES = -I${top_srcdir}/include
AM_CXXFLAGS = ${KONFORKA_CFLAGS}
@@ -13,3 +17,9 @@ libkingate_la_LDFLAGS = -version-info 1:0:0
libkingate_fcgi_la_SOURCES = \
fastcgi.cc
libkingate_fcgi_la_LDFLAGS = -version-info 1:0:0
+
+libkingate_plaincgi_la_SOURCES = \
+ plaincgi.cc
+libkingate_plaincgi_la_LDFLAGS = -version-info 1:0:0
+
+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 {
sbin.attach(request.in);
sbout.attach(request.out);
sberr.attach(request.err);
- metavars.clear(); // XXX: redundant.
for(char **p = request.envp; *p; p++) {
const char *e = strchr(*p,'=');
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 @@
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include "kingate/plaincgi.h"
+#include "kingate/exception.h"
+
+namespace kingate {
+
+ plaincgi_interface::plaincgi_interface() {
+ for(char **p = environ; *p; p++) {
+ const char *e = strchr(*p,'=');
+ if(!e){
+ // XXX: check if we have it already?
+ metavars[*p] = string(0);
+ }else{
+ int l = e-*p; e++;
+ // XXX: check if we have it already?
+ metavars[string(*p,l)]=e;
+ }
+ }
+ }
+ plaincgi_interface::~plaincgi_interface() {
+ cout.flush();
+ cerr.flush();
+ }
+
+}