author | Michael Krelin <hacker@klever.net> | 2005-02-13 14:02:29 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2005-02-13 14:02:29 (UTC) |
commit | 4fa4a0071ef9a04c02f8934b2e1d3b7628a65c80 (patch) (unidiff) | |
tree | 47f2e6866ab812985ae9e6adbcea8bb785fa0403 /src | |
parent | ff4b919683537625f693eedf53006364d0f8444d (diff) | |
download | kingate-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
-rw-r--r-- | src/Makefile.am | 12 | ||||
-rw-r--r-- | src/fastcgi.cc | 1 | ||||
-rw-r--r-- | src/plaincgi.cc | 27 |
3 files changed, 38 insertions, 2 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 8a5447b..e5c6778 100644 --- a/src/Makefile.am +++ b/src/Makefile.am | |||
@@ -1,15 +1,25 @@ | |||
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} |
5 | LDADD = ${KONFORKA_LIBS} | 9 | LDADD = ${KONFORKA_LIBS} |
6 | 10 | ||
7 | libkingate_la_SOURCES = \ | 11 | libkingate_la_SOURCES = \ |
8 | cgi_gateway.cc \ | 12 | cgi_gateway.cc \ |
9 | cgi_interface.cc \ | 13 | cgi_interface.cc \ |
10 | util.cc | 14 | util.cc |
11 | libkingate_la_LDFLAGS = -version-info 1:0:0 | 15 | libkingate_la_LDFLAGS = -version-info 1:0:0 |
12 | 16 | ||
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 | |||
@@ -40,17 +40,16 @@ namespace kingate { | |||
40 | : sin(&sbin), sout(&sbout), serr(&sberr) { | 40 | : sin(&sbin), sout(&sbout), serr(&sberr) { |
41 | if( FCGX_InitRequest(&request,s.sock,f) ) | 41 | if( FCGX_InitRequest(&request,s.sock,f) ) |
42 | throw exception(CODEPOINT,"failed to FCGX_InitRequest()"); | 42 | throw exception(CODEPOINT,"failed to FCGX_InitRequest()"); |
43 | if( FCGX_Accept_r(&request) ) | 43 | if( FCGX_Accept_r(&request) ) |
44 | throw exception(CODEPOINT,"failed to FCGX_Accept_r()"); | 44 | throw exception(CODEPOINT,"failed to FCGX_Accept_r()"); |
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){ |
52 | // XXX: check if we have it already? | 51 | // XXX: check if we have it already? |
53 | metavars[*p] = string(0); | 52 | metavars[*p] = string(0); |
54 | }else{ | 53 | }else{ |
55 | int l = e-*p; e++; | 54 | int l = e-*p; e++; |
56 | // XXX: check if we have it already? | 55 | // XXX: check if we have it already? |
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 | } | ||