/* */ #ifndef _D_COOKIE_H_ #define _D_COOKIE_H_ #include "common.h" class Cookie { public: string name; string value; time_t expires; string path; string domain; bool secure; bool onetime; // if true, this cookie will expire when the user's session ends. public: Cookie(const string& name, const string& value, time_t expires, const string& path, const string& domain, bool secure): name(name), value(value), expires(expires), path(path), domain(domain), secure(secure), onetime(false) {} Cookie(const string& name, const string& value, const string& path, const string& domain, bool secure): name(name), value(value), path(path), domain(domain), secure(secure), onetime(true) {} Cookie():expires(0), secure(false), onetime(true) {} ~Cookie() {} string toString() const { return name+"="+value; } void clear() { name = value = path = domain = ""; expires = 0; secure = false; } bool good() const { return !name.empty(); } bool match(const string& host, const string& dir, time_t date, bool secure) const; }; typedef deque Cookies; #endif // _D_COOKIE_H_