00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef HTTPCOOKIE_H
00016 #define HTTPCOOKIE_H
00017
00018 #include "pandabase.h"
00019
00020
00021
00022
00023
00024
00025 #ifdef HAVE_OPENSSL
00026
00027 #include "httpDate.h"
00028 #include "urlSpec.h"
00029
00030
00031
00032
00033
00034
00035
00036 class EXPCL_PANDAEXPRESS HTTPCookie {
00037 PUBLISHED:
00038 INLINE HTTPCookie();
00039 INLINE HTTPCookie(const string &format, const URLSpec &url);
00040 INLINE HTTPCookie(const string &name, const string &path, const string &domain);
00041 INLINE ~HTTPCookie();
00042
00043 INLINE void set_name(const string &name);
00044 INLINE const string &get_name() const;
00045
00046 INLINE void set_value(const string &value);
00047 INLINE const string &get_value() const;
00048
00049 INLINE void set_domain(const string &domain);
00050 INLINE const string &get_domain() const;
00051
00052 INLINE void set_path(const string &path);
00053 INLINE const string &get_path() const;
00054
00055 INLINE void set_expires(const HTTPDate &expires);
00056 INLINE void clear_expires();
00057 INLINE bool has_expires() const;
00058 INLINE HTTPDate get_expires() const;
00059
00060 INLINE void set_secure(bool flag);
00061 INLINE bool get_secure() const;
00062
00063 bool operator < (const HTTPCookie &other) const;
00064 void update_from(const HTTPCookie &other);
00065
00066 bool parse_set_cookie(const string &format, const URLSpec &url);
00067 INLINE bool is_expired(const HTTPDate &now = HTTPDate::now()) const;
00068 bool matches_url(const URLSpec &url) const;
00069
00070 void output(ostream &out) const;
00071
00072 private:
00073 bool parse_cookie_param(const string ¶m, bool first_param);
00074
00075 string _name;
00076 string _value;
00077 string _path;
00078 string _domain;
00079 HTTPDate _expires;
00080 bool _secure;
00081 };
00082
00083 INLINE ostream &operator << (ostream &out, const HTTPCookie &cookie);
00084
00085 #include "httpCookie.I"
00086
00087 #endif // HAVE_OPENSSL
00088
00089 #endif