00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033 #ifndef _HttpBaseSocket_H
00034 #define _HttpBaseSocket_H
00035
00036 #include "HTTPSocket.h"
00037 #include "HttpRequest.h"
00038 #include "IHttpServer.h"
00039 #include "HttpResponse.h"
00040
00041 #ifdef SOCKETS_NAMESPACE
00042 namespace SOCKETS_NAMESPACE {
00043 #endif
00044
00045
00046 class HttpResponse;
00047
00048 class HttpBaseSocket : public HTTPSocket, public IHttpServer
00049 {
00050 public:
00051 HttpBaseSocket(ISocketHandler& h);
00052 ~HttpBaseSocket();
00053
00054 void OnFirst();
00055 void OnHeader(const std::string& key,const std::string& value);
00056 void OnHeaderComplete();
00057 void OnData(const char *,size_t);
00058
00059
00060 void IHttpServer_Respond(const HttpResponse& res);
00061
00062 void OnTransferLimit();
00063
00064 protected:
00065 HttpBaseSocket(const HttpBaseSocket& s) : HTTPSocket(s) {}
00066
00067 HttpRequest m_req;
00068 HttpResponse m_res;
00069 void Reset();
00070
00071 private:
00072 HttpBaseSocket& operator=(const HttpBaseSocket& ) { return *this; }
00073 void Execute();
00074
00075 size_t m_body_size_left;
00076 bool m_b_keepalive;
00077 };
00078
00079
00080
00081
00082 #ifdef SOCKETS_NAMESPACE
00083 }
00084 #endif
00085
00086 #endif // _HttpBaseSocket_H
00087