00001
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
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
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