HTTPServer.h

00001 // $Id: HTTPServer.h 21 2010-09-05 04:18:17Z cschwarz1 $
00002 
00003 #ifndef BASE_HTTP_HTTPSERVER_H
00004 #define BASE_HTTP_HTTPSERVER_H
00005 
00006 #include "HTTPClient.h"
00007 
00008 namespace base_http {
00010 
00014     class PPBASE_HTTP_EXPORT HTTPServer: public HTTPClient {
00015     public:
00017 
00022         HTTPServer(const char *name = NULL, base::Socket *sock = NULL, const base::String &addr = "");
00023 
00025         void clearNonce();
00026 
00028 
00032         base::String createDigestHeader(const char *realm);
00033 
00035 
00038         base::String createDigestNonce();
00039 
00041 
00044         base::String createInfoHeader();
00045 
00047 
00050         const char *getNonce() const;
00051 
00053 
00056         const char *getServerName() const;
00057 
00059 
00062         HTTPRequest *readHeader();
00063 
00065 
00068         HTTPRequest *readRequest();
00069 
00071 
00078         void sendError(const HTTPRequest &request, int code, const char *message, const char *fname = NULL, const char *body = NULL);
00079 
00081 
00084         void sendResponse(HTTPResponse &response);
00085 
00087 
00090         void setServerName(const char *name);
00091 
00092     protected:
00093         bool         _closeconn;   
00094         base::String  _name;        
00095         base::String  _nonce;       
00096     };
00097 }
00098 
00099 #endif