-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile.am | 22 | ||||
-rw-r--r-- | configure.ac | 21 | ||||
-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, 119 insertions, 23 deletions
@@ -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(); + } + +} |