From ec05778d5718a7912e506764d443a78d6a6179e3 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 5 Nov 2012 22:41:51 +0000 Subject: Converted tabs to spaces with tabconv. --- src/stable/protocolhttp.h | 146 +++++++++++++++++++++++----------------------- 1 file changed, 73 insertions(+), 73 deletions(-) (limited to 'src/stable/protocolhttp.h') diff --git a/src/stable/protocolhttp.h b/src/stable/protocolhttp.h index 87dc49b..51ca58c 100644 --- a/src/stable/protocolhttp.h +++ b/src/stable/protocolhttp.h @@ -18,89 +18,89 @@ namespace Bu { - /** - * An HTTP Protocol handler. Yes, I know that HTTP stands for Hyper Text - * Transfer Protocol, and that the Protocol part is redundant, but in this - * case the word Protocol is refering to the Libbu++ construct Bu::Protocol, - * and not a means of encoding conversations. Anyway, this class represents - * a general HTTP server processor. Every time a request comes in it calls - * the onRequest function in a subclass with the method and URI that were - * requested. The sub-class can then do whatever it needs to to send back - * a response. - *@ingroup Serving - */ - class ProtocolHttp : public Protocol - { - public: /* Types */ - typedef Bu::List TokenList; + /** + * An HTTP Protocol handler. Yes, I know that HTTP stands for Hyper Text + * Transfer Protocol, and that the Protocol part is redundant, but in this + * case the word Protocol is refering to the Libbu++ construct Bu::Protocol, + * and not a means of encoding conversations. Anyway, this class represents + * a general HTTP server processor. Every time a request comes in it calls + * the onRequest function in a subclass with the method and URI that were + * requested. The sub-class can then do whatever it needs to to send back + * a response. + *@ingroup Serving + */ + class ProtocolHttp : public Protocol + { + public: /* Types */ + typedef Bu::List TokenList; - public: /* Interface */ - ProtocolHttp(); - virtual ~ProtocolHttp(); + public: /* Interface */ + ProtocolHttp(); + virtual ~ProtocolHttp(); - virtual void onNewConnection( Bu::Client *pClient ); - virtual void onNewData( Bu::Client *pClient ); + virtual void onNewConnection( Bu::Client *pClient ); + virtual void onNewData( Bu::Client *pClient ); - virtual void onRequest( - const Bu::String &sMethod, const Bu::String &sPath )=0; + virtual void onRequest( + const Bu::String &sMethod, const Bu::String &sPath )=0; - class Response - { - friend class Bu::ProtocolHttp; - public: - Response( int iCode ); - Response( int iCode, const Bu::String &sReason ); - virtual ~Response(); + class Response + { + friend class Bu::ProtocolHttp; + public: + Response( int iCode ); + Response( int iCode, const Bu::String &sReason ); + virtual ~Response(); - void setHeader( const Bu::String &sKey, const Bu::String &sVal ); - void setContent( const Bu::String &sCont ); + void setHeader( const Bu::String &sKey, const Bu::String &sVal ); + void setContent( const Bu::String &sCont ); - private: - int iCode; - Bu::String sReason; - typedef Bu::Hash StringHash; - StringHash hHeaders; - Bu::String sContent; - }; - - void sendResponse( const Response &rRes ); - - private: - enum TokenType - { - ttOutOfData, - ttString, - ttNewline, - ttDoubleNewline, - ttSeperator - }; - /** - * Read an HTTP line, this is up to the first CRLF that isn't followed - * by a continuation character, converting it to one line as it reads. - *@param line All data read will be appended to line, even if no - * end-of-line is read. - *@returns True if an end-of-line is read and the line should be - * processed, false if the end-of-line has not been reached, and more - * data needs to be read before this operation can continue. - */ - TokenType getToken( Bu::String &line ); - bool isWS( char buf ); - bool isSeperator( char buf ); + private: + int iCode; + Bu::String sReason; + typedef Bu::Hash StringHash; + StringHash hHeaders; + Bu::String sContent; + }; + + void sendResponse( const Response &rRes ); + + private: + enum TokenType + { + ttOutOfData, + ttString, + ttNewline, + ttDoubleNewline, + ttSeperator + }; + /** + * Read an HTTP line, this is up to the first CRLF that isn't followed + * by a continuation character, converting it to one line as it reads. + *@param line All data read will be appended to line, even if no + * end-of-line is read. + *@returns True if an end-of-line is read and the line should be + * processed, false if the end-of-line has not been reached, and more + * data needs to be read before this operation can continue. + */ + TokenType getToken( Bu::String &line ); + bool isWS( char buf ); + bool isSeperator( char buf ); - void earlyResponse(); - void lateResponse(); + void earlyResponse(); + void lateResponse(); - private: /* state */ - Bu::Client *pClient; - TokenList lTokens; + private: /* state */ + Bu::Client *pClient; + TokenList lTokens; - int iState; + int iState; - Bu::String sMethod; - Bu::String sPath; - int iMajor; - int iMinor; - }; + Bu::String sMethod; + Bu::String sPath; + int iMajor; + int iMinor; + }; } #endif -- cgit v1.2.3