HttpBaseSocket.hGo to the documentation of this file.00001 00006 /* 00007 Copyright (C) 2007-2008 Anders Hedstrom 00008 00009 This library is made available under the terms of the GNU GPL. 00010 00011 If you would like to use this library in a closed-source application, 00012 a separate license agreement is available. For information about 00013 the closed-source license agreement for the C++ sockets library, 00014 please visit http://www.alhem.net/Sockets/license.html and/or 00015 email license@alhem.net. 00016 00017 This program is free software; you can redistribute it and/or 00018 modify it under the terms of the GNU General Public License 00019 as published by the Free Software Foundation; either version 2 00020 of the License, or (at your option) any later version. 00021 00022 This program is distributed in the hope that it will be useful, 00023 but WITHOUT ANY WARRANTY; without even the implied warranty of 00024 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00025 GNU General Public License for more details. 00026 00027 You should have received a copy of the GNU General Public License 00028 along with this program; if not, write to the Free Software 00029 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00030 */ 00031 #ifndef _HttpBaseSocket_H 00032 #define _HttpBaseSocket_H 00033 00034 #include "HTTPSocket.h" 00035 #include "HttpRequest.h" 00036 #include "IHttpServer.h" 00037 #include "HttpResponse.h" 00038 00039 #ifdef SOCKETS_NAMESPACE 00040 namespace SOCKETS_NAMESPACE { 00041 #endif 00042 00043 00044 class HttpResponse; 00045 00046 class HttpBaseSocket : public HTTPSocket, public IHttpServer 00047 { 00048 public: 00049 HttpBaseSocket(ISocketHandler& h); 00050 ~HttpBaseSocket(); 00051 00052 void OnFirst(); 00053 void OnHeader(const std::string& key,const std::string& value); 00054 void OnHeaderComplete(); 00055 void OnData(const char *,size_t); 00056 00057 // implements IHttpServer::Respond 00058 void Respond(const HttpResponse& res); 00059 00060 void OnTransferLimit(); 00061 00062 protected: 00063 HttpBaseSocket(const HttpBaseSocket& s) : HTTPSocket(s) {} // copy constructor 00064 // 00065 HttpRequest m_req; 00066 HttpResponse m_res; 00067 void Reset(); 00068 00069 private: 00070 HttpBaseSocket& operator=(const HttpBaseSocket& ) { return *this; } // assignment operator 00071 void Execute(); 00072 // 00073 size_t m_body_size_left; 00074 bool m_b_keepalive; 00075 }; 00076 00077 00078 00079 00080 #ifdef SOCKETS_NAMESPACE 00081 } // namespace SOCKETS_NAMESPACE { 00082 #endif 00083 00084 #endif // _HttpBaseSocket_H 00085 |
1.4.4
