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) (unidiff)
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) (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
21install-sh 21install-sh
22NEWS 22NEWS
23doxydox 23doxydox
24kingate-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
4DISTCHECK_CONFIGURE_FLAGS=--with-pkgconfigdir=$${dc_install_base}/lib/pkgconfig 4DISTCHECK_CONFIGURE_FLAGS=--with-pkgconfigdir=$${dc_install_base}/lib/pkgconfig
5if HAVE_PKGCONFIG 5if HAVE_PKGCONFIG
6pkgconfigdir=@PKGCONFIG_DIR@ 6pkgconfigdir=@PKGCONFIG_DIR@
7pkgconfig_DATA=kingate.pc kingate-fcgi.pc 7pkgconfig_DATA=kingate.pc kingate-plaincgi.pc
8if HAVE_FCGI
9pkgconfig_DATA += kingate-fcgi.pc
10endif
8endif 11endif
9 12
10LOCAL_TARGETS= 13all-local: NEWS
11if HAVE_DOXYGEN 14if HAVE_DOXYGEN
12LOCAL_TARGETS+=doxygen 15clean-local:
16 rm -rf doxydox
13endif 17endif
14 18
15all-local: NEWS $(addprefix all-lota-,${LOCAL_TARGETS})
16clean-local: $(addprefix clean-lota-,${LOCAL_TARGETS})
17
18NEWS: NEWS.xsl NEWS.xml 19NEWS: NEWS.xsl NEWS.xml
19 ${XSLTPROC} -o $@ NEWS.xsl NEWS.xml 20 ${XSLTPROC} -o $@ NEWS.xsl NEWS.xml
20 21
21all-lota-doxygen: doxydox/built 22if HAVE_DOXYGEN
22doxydox/built: $(wildcard ${top_srcdir}/include/kingate/*.h) 23dox:
23 ${DOXYGEN} 24 ${DOXYGEN}
24 touch $@ 25endif
25
26clean-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 @@
1AC_INIT([kingate], [0.0], [kingate-bugs@klever.net]) 1AC_INIT([kingate], [0.0.1], [kingate-bugs@klever.net])
2AC_CONFIG_SRCDIR([include/kingate/cgi_gateway.h]) 2AC_CONFIG_SRCDIR([include/kingate/cgi_gateway.h])
3AC_CONFIG_HEADER([config.h]) 3AC_CONFIG_HEADER([config.h])
4AM_INIT_AUTOMAKE([dist-bzip2]) 4AM_INIT_AUTOMAKE([dist-bzip2])
@@ -12,17 +12,22 @@ AC_PROG_LIBTOOL
12AC_HEADER_STDC 12AC_HEADER_STDC
13AC_CHECK_HEADERS([sys/types.h sys/stat.h]) 13AC_CHECK_HEADERS([sys/types.h sys/stat.h])
14 14
15HAVE_FCGI=false
15AC_LANG_PUSH(C++) 16AC_LANG_PUSH(C++)
16AC_CHECK_HEADERS([fcgio.h],,[ 17AC_CHECK_HEADERS([fcgio.h],[
17 exit 1 18 AC_CHECK_LIB(fcgi,FCGX_Init,[
18]) 19 LIBS="-lfcgi ${LIBS}"
19AC_CHECK_LIB(fcgi,FCGX_Init,,[ 20 AC_CHECK_LIB([fcgi++],[main],[
20 exit 1 21 LIBS="-lfcgi++ ${LIBS}"
21]) 22 HAVE_FCGI=true
22AC_CHECK_LIB([fcgi++],[main],,[ 23 ])
23 exit 1 24 ])
24]) 25])
25AC_LANG_POP(C++) 26AC_LANG_POP(C++)
27if ! ${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])
29fi
30AM_CONDITIONAL([HAVE_FCGI],[${HAVE_FCGI}])
26 31
27AC_C_CONST 32AC_C_CONST
28 33
@@ -54,7 +59,7 @@ fi
54 59
55AC_CONFIG_FILES([ 60AC_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
12namespace 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 @@
1prefix=@prefix@
2exec_prefix=@exec_prefix@
3libdir=@libdir@
4includedir=@includedir@
5
6Name: kingate-plaincgi
7Description: plain cgi implementation of kingate interface
8Version: @VERSION@
9Requires: kingate = @VERSION@
10Libs: -L${libdir} -lkingate-plaincgi
11Cflags: -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 @@
1lib_LTLIBRARIES = libkingate.la libkingate-fcgi.la 1lib_LTLIBRARIES = libkingate.la libkingate-plaincgi.la
2
3if HAVE_FCGI
4lib_LTLIBRARIES += libkingate-fcgi.la
5endif
2 6
3INCLUDES = -I${top_srcdir}/include 7INCLUDES = -I${top_srcdir}/include
4AM_CXXFLAGS = ${KONFORKA_CFLAGS} 8AM_CXXFLAGS = ${KONFORKA_CFLAGS}
@@ -13,3 +17,9 @@ libkingate_la_LDFLAGS = -version-info 1:0:0
13libkingate_fcgi_la_SOURCES = \ 17libkingate_fcgi_la_SOURCES = \
14 fastcgi.cc 18 fastcgi.cc
15libkingate_fcgi_la_LDFLAGS = -version-info 1:0:0 19libkingate_fcgi_la_LDFLAGS = -version-info 1:0:0
20
21libkingate_plaincgi_la_SOURCES = \
22 plaincgi.cc
23libkingate_plaincgi_la_LDFLAGS = -version-info 1:0:0
24
25EXTRA_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
7namespace 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}