From 1df2d73183a08fc37bc1b97a530c13a9445dad65 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Tue, 2 Jun 2009 18:33:41 +0000 Subject: Updates to the cgi system, and I'm putting the general CGI related stuff like encoding and decoding and uri encoded splitting etc in one class. --- src/cgiutil.cpp | 10 ++++++++++ src/cgiutil.h | 16 ++++++++++++++++ src/fastcgi.cpp | 2 +- src/fastcgi.h | 6 +++--- src/tests/fastcgi.cpp | 4 ++-- 5 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 src/cgiutil.cpp create mode 100644 src/cgiutil.h (limited to 'src') diff --git a/src/cgiutil.cpp b/src/cgiutil.cpp new file mode 100644 index 0000000..1f7a8d0 --- /dev/null +++ b/src/cgiutil.cpp @@ -0,0 +1,10 @@ +#include "bu/cgiutil.h" + +Bu::CgiUtil::CgiUtil() +{ +} + +Bu::CgiUtil::~CgiUtil() +{ +} + diff --git a/src/cgiutil.h b/src/cgiutil.h new file mode 100644 index 0000000..4a9ae2d --- /dev/null +++ b/src/cgiutil.h @@ -0,0 +1,16 @@ +#ifndef CGI_UTIL_H +#define CGI_UTIL_H + +namespace Bu +{ + class CgiUtil + { + public: + CgiUtil(); + virtual ~CgiUtil(); + + private: + }; +}; + +#endif diff --git a/src/fastcgi.cpp b/src/fastcgi.cpp index 9a602de..58d886d 100644 --- a/src/fastcgi.cpp +++ b/src/fastcgi.cpp @@ -282,7 +282,7 @@ void Bu::FastCgi::run() { sio << "All done, generating output." << sio.nl; Bu::MemBuf mStdOut, mStdErr; - int iRet = request( + int iRet = onRequest( pChan->hParams, pChan->sStdIn, mStdOut, mStdErr ); diff --git a/src/fastcgi.h b/src/fastcgi.h index 67ec82f..4efa992 100644 --- a/src/fastcgi.h +++ b/src/fastcgi.h @@ -95,11 +95,11 @@ namespace Bu virtual void run(); - virtual void init() { }; - virtual int request( const StrHash &hParams, + virtual void onInit() { }; + virtual int onRequest( const StrHash &hParams, const Bu::FString &sStdIn, Bu::Stream &sStdOut, Bu::Stream &sStdErr )=0; - virtual void deinit() { }; + virtual void onUninit() { }; private: void read( Bu::Socket &s, Record &r ); diff --git a/src/tests/fastcgi.cpp b/src/tests/fastcgi.cpp index 53dd68a..e71b3c5 100644 --- a/src/tests/fastcgi.cpp +++ b/src/tests/fastcgi.cpp @@ -17,9 +17,9 @@ public: { } - virtual int request( const StrHash &hParams, + virtual int onRequest( const StrHash &hParams, const Bu::FString &sStdIn, Bu::Stream &sStdOut, - Bu::Stream &sStdErr ) + Bu::Stream &/*sStdErr*/ ) { Bu::FString sOut("Content-Type: text/html\r\n\r\n"); sOut += "

Environment: