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
00029 #ifndef _SOCKETS_HttpdCookies_H
00030 #define _SOCKETS_HttpdCookies_H
00031
00032 #include "sockets-config.h"
00033 #include <list>
00034 #include <string>
00035
00036 #ifdef SOCKETS_NAMESPACE
00037 namespace SOCKETS_NAMESPACE {
00038 #endif
00039
00040
00042
00043
00044
00046 class HTTPSocket;
00047
00052 class HttpdCookies
00053 {
00055 typedef std::list<std::pair<std::string, std::string> > cookie_v;
00056
00057 public:
00058 HttpdCookies();
00059 HttpdCookies(const std::string& query_string);
00060 ~HttpdCookies();
00061
00062 void add(const std::string& s);
00063
00064 bool getvalue(const std::string&,std::string&) const;
00065 void replacevalue(const std::string& ,const std::string& );
00066 void replacevalue(const std::string& ,long);
00067 void replacevalue(const std::string& ,int);
00068 size_t getlength(const std::string& ) const;
00069 void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,const std::string& v);
00070 void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,long v);
00071 void setcookie(HTTPSocket *,const std::string& d,const std::string& p,const std::string& c,int v);
00072 const std::string& expiredatetime() const;
00073
00074 cookie_v& GetHttpdCookies() { return m_cookies; }
00075
00076 void Reset();
00077
00078 private:
00079 cookie_v m_cookies;
00080 mutable std::string m_date;
00081 };
00082
00083
00084 #ifdef SOCKETS_NAMESPACE
00085 }
00086 #endif
00087
00088 #endif // _SOCKETS_HttpdCookies_H
00089