summaryrefslogtreecommitdiffabout
authorMichael Krelin <hacker@klever.net>2005-02-13 14:02:29 (UTC)
committer Michael Krelin <hacker@klever.net>2005-02-13 14:02:29 (UTC)
commit4fa4a0071ef9a04c02f8934b2e1d3b7628a65c80 (patch) (side-by-side diff)
tree47f2e6866ab812985ae9e6adbcea8bb785fa0403
parentff4b919683537625f693eedf53006364d0f8444d (diff)
downloadkingate-4fa4a0071ef9a04c02f8934b2e1d3b7628a65c80.zip
kingate-4fa4a0071ef9a04c02f8934b2e1d3b7628a65c80.tar.gz
kingate-4fa4a0071ef9a04c02f8934b2e1d3b7628a65c80.tar.bz2
1. Support for 'plain' CGI
2. Made fastcgi support optional 3. bumped version to 0.0.1 4. doxygen documentation target 'dox' is not built for 'all' now
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--.gitignore1
-rw-r--r--Makefile.am22
-rw-r--r--configure.ac21
-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, 119 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index 02145e3..1997933 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23 +23,2 @@ NEWS
doxydox
+kingate-plaincgi.pc
diff --git a/Makefile.am b/Makefile.am
index 9833732..3e9f0f1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -6,13 +6,14 @@ 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
@@ -20,8 +21,5 @@ NEWS: 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,2 +1,2 @@
-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])
@@ -14,13 +14,18 @@ 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_HEADERS([fcgio.h],[
+ AC_CHECK_LIB(fcgi,FCGX_Init,[
+ LIBS="-lfcgi ${LIBS}"
+ AC_CHECK_LIB([fcgi++],[main],[
+ LIBS="-lfcgi++ ${LIBS}"
+ HAVE_FCGI=true
])
-AC_CHECK_LIB(fcgi,FCGX_Init,,[
- exit 1
])
-AC_CHECK_LIB([fcgi++],[main],,[
- exit 1
])
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}])
@@ -56,3 +61,3 @@ AC_CONFIG_FILES([
Makefile
- kingate.pc kingate-fcgi.pc
+ kingate.pc kingate-fcgi.pc kingate-plaincgi.pc
Doxyfile
diff --git a/include/Makefile.am b/include/Makefile.am
index c1ec36e..e0b778b 100644
--- a/include/Makefile.am
+++ b/include/Makefile.am
@@ -5,2 +5,3 @@ nobase_include_HEADERS = \
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,2 +1,6 @@
-lib_LTLIBRARIES = libkingate.la libkingate-fcgi.la
+lib_LTLIBRARIES = libkingate.la libkingate-plaincgi.la
+
+if HAVE_FCGI
+lib_LTLIBRARIES += libkingate-fcgi.la
+endif
@@ -15 +19,7 @@ libkingate_fcgi_la_SOURCES = \
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
@@ -47,3 +47,2 @@ namespace kingate {
sberr.attach(request.err);
- metavars.clear(); // XXX: redundant.
for(char **p = request.envp; *p; p++) {
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();
+ }
+
+}