Logo
~Sockets~
~Examples~
~Contact~


HttpdSocket.h

Go to the documentation of this file.
00001 
00003 /*
00004 Copyright (C) 2001-2007  Anders Hedstrom (grymse@alhem.net)
00005 
00006 This library is made available under the terms of the GNU GPL.
00007 
00008 If you would like to use this library in a closed-source application,
00009 a separate license agreement is available. For information about 
00010 the closed-source license agreement for the C++ sockets library,
00011 please visit http://www.alhem.net/Sockets/license.html and/or
00012 email license@alhem.net.
00013 
00014 This program is free software; you can redistribute it and/or
00015 modify it under the terms of the GNU General Public License
00016 as published by the Free Software Foundation; either version 2
00017 of the License, or (at your option) any later version.
00018 
00019 This program is distributed in the hope that it will be useful,
00020 but WITHOUT ANY WARRANTY; without even the implied warranty of
00021 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00022 GNU General Public License for more details.
00023 
00024 You should have received a copy of the GNU General Public License
00025 along with this program; if not, write to the Free Software
00026 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00027 */
00028 #ifndef _SOCKETS_HttpdSocket_H
00029 #define _SOCKETS_HttpdSocket_H
00030 
00031 #include "sockets-config.h"
00032 #include "HTTPSocket.h"
00033 #include "ISocketHandler.h"
00034 
00035 #ifdef SOCKETS_NAMESPACE
00036 namespace SOCKETS_NAMESPACE {
00037 #endif
00038 
00039 
00040 class HttpdCookies;
00041 class HttpdForm;
00042 class IFile;
00043 
00047 class HttpdSocket : public HTTPSocket
00048 {
00049 public:
00050         HttpdSocket(ISocketHandler& );
00051         ~HttpdSocket();
00052 
00053         void OnFirst();
00054         void OnHeader(const std::string& key,const std::string& value);
00055         void OnHeaderComplete();
00056         void OnData(const char *,size_t);
00057 
00060         virtual void Exec() = 0;
00062         const std::string& GetHttpDate();
00064         HttpdCookies *GetCookies();
00066         HttpdForm *GetForm();
00067 
00068 protected:
00072         void Send64(const std::string& str64, const std::string& type);
00073         std::string datetime2httpdate(const std::string& dt);
00074         std::string GetDate();
00075         void Reset();
00076         // headers
00077         std::string m_http_cookie;
00078         std::string m_content_type;
00079         std::string m_content_length_str;
00080         std::string m_if_modified_since;
00081 
00082 private:
00083 static  int m_request_count;
00084 static  std::string m_start;
00085         size_t m_content_length;
00086         IFile *m_file;
00087         size_t m_received;
00088         int m_request_id;
00089         std::string m_http_date;
00090         HttpdCookies *m_cookies;
00091         HttpdForm *m_form;
00092 };
00093 
00094 
00095 #ifdef SOCKETS_NAMESPACE
00096 }
00097 #endif
00098 
00099 #endif // _SOCKETS_HttpdSocket_H
Page, code, and content Copyright (C) 2007 by Anders Hedström
Generated for C++ Sockets by  doxygen 1.4.4