aboutsummaryrefslogtreecommitdiff
path: root/src/protocolhttp.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2007-10-08 04:11:56 +0000
committerMike Buland <eichlan@xagasoft.com>2007-10-08 04:11:56 +0000
commitfe1862511da4a6d66e2f11ba633c035c3cf7b14f (patch)
tree5b7b4d863c0b26390ae7f786b23485341c0ebd50 /src/protocolhttp.h
parentd8ba63fd2b512297b42b8b7db877205ab287e067 (diff)
downloadlibbu++-fe1862511da4a6d66e2f11ba633c035c3cf7b14f.tar.gz
libbu++-fe1862511da4a6d66e2f11ba633c035c3cf7b14f.tar.bz2
libbu++-fe1862511da4a6d66e2f11ba633c035c3cf7b14f.tar.xz
libbu++-fe1862511da4a6d66e2f11ba633c035c3cf7b14f.zip
Added some helpers and fixes to Bu::Client, also got all the basics of a
general Http handler working, the test for the moment, is Doxysrv, I'll probably write a cute little stand-alone one in libbu++ later as a demo/test.
Diffstat (limited to '')
-rw-r--r--src/protocolhttp.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/protocolhttp.h b/src/protocolhttp.h
index e10cb23..e2612f5 100644
--- a/src/protocolhttp.h
+++ b/src/protocolhttp.h
@@ -24,6 +24,30 @@ namespace Bu
24 24
25 virtual void onNewConnection( Bu::Client *pClient ); 25 virtual void onNewConnection( Bu::Client *pClient );
26 virtual void onNewData( Bu::Client *pClient ); 26 virtual void onNewData( Bu::Client *pClient );
27
28 virtual void onRequest(
29 const Bu::FString &sMethod, const Bu::FString &sPath )=0;
30
31 class Response
32 {
33 friend class Bu::ProtocolHttp;
34 public:
35 Response( int iCode );
36 Response( int iCode, const Bu::FString &sReason );
37 virtual ~Response();
38
39 void setHeader( const Bu::FString &sKey, const Bu::FString &sVal );
40 void setContent( const Bu::FString &sCont );
41
42 private:
43 int iCode;
44 Bu::FString sReason;
45 typedef Bu::Hash<Bu::FString,Bu::FString> StringHash;
46 StringHash hHeaders;
47 Bu::FString sContent;
48 };
49
50 void sendResponse( const Response &rRes );
27 51
28 private: 52 private:
29 enum TokenType 53 enum TokenType
@@ -47,6 +71,9 @@ namespace Bu
47 bool isWS( char buf ); 71 bool isWS( char buf );
48 bool isSeperator( char buf ); 72 bool isSeperator( char buf );
49 73
74 void earlyResponse();
75 void lateResponse();
76
50 private: /* state */ 77 private: /* state */
51 Bu::Client *pClient; 78 Bu::Client *pClient;
52 TokenList lTokens; 79 TokenList lTokens;