1 /** \file HttpDebugSocket.h 2 ** \date 2004-09-27 3 **/ 4 /* 5 Copyright (C) 2004-2011 Anders Hedstrom (grymse@alhem.net) 6 7 This library is made available under the terms of the GNU GPL, with 8 the additional exemption that compiling, linking, and/or using OpenSSL 9 is allowed. 10 11 If you would like to use this library in a closed-source application, 12 a separate license agreement is available. For information about 13 the closed-source license agreement for the C++ sockets library, 14 please visit http://www.alhem.net/Sockets/license.html and/or 15 email license@alhem.net. 16 17 This program is free software; you can redistribute it and/or 18 modify it under the terms of the GNU General Public License 19 as published by the Free Software Foundation; either version 2 20 of the License, or (at your option) any later version. 21 22 This program is distributed in the hope that it will be useful, 23 but WITHOUT ANY WARRANTY; without even the implied warranty of 24 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25 GNU General Public License for more details. 26 27 You should have received a copy of the GNU General Public License 28 along with this program; if not, write to the Free Software 29 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 30 */ 31 #ifndef _SOCKETS_HttpDebugSocket_H 32 #define _SOCKETS_HttpDebugSocket_H 33 34 #include "sockets-config.h" 35 #include "HTTPSocket.h" 36 37 #ifdef SOCKETS_NAMESPACE 38 namespace SOCKETS_NAMESPACE { 39 #endif 40 41 class ISocketHandler; 42 43 /** HTTP request "echo" class. This class echoes a http request/body 44 with a html formatted page. 45 \ingroup http */ 46 class HttpDebugSocket : public HTTPSocket 47 { 48 public: 49 HttpDebugSocket(ISocketHandler&); 50 ~HttpDebugSocket(); 51 52 void Init(); 53 54 void OnFirst(); 55 void OnHeader(const std::string& key,const std::string& value); 56 void OnHeaderComplete(); 57 void OnData(const char *,size_t); 58 void OnDataComplete(); 59 60 private: HttpDebugSocket(const HttpDebugSocket & s)61 HttpDebugSocket(const HttpDebugSocket& s) : HTTPSocket(s) {} // copy constructor 62 HttpDebugSocket& operator=(const HttpDebugSocket& ) { return *this; } // assignment operator 63 int m_content_length; 64 int m_read_ptr; 65 }; 66 67 68 #ifdef SOCKETS_NAMESPACE 69 } 70 #endif 71 72 #endif // _SOCKETS_HttpDebugSocket_H 73 74