|
I am trying to design a c++ class called CCookieJar that manages a web database of cookis. In production use, one cookie jar object will be used for a process. Multiple threads will use the cookie jar within the process. Cookie jars are not shared between processes. All contents of the cookie jar are maintained in memory. (No disk I/O or external DB is required.)
The class will have sufficient member functions to do the following:
- Parse a passed set of HTTP headers to extract the cookies and
store their components in association with the URL associated with
the headers. (Assume the headers always contain a Host header.)
- Enable adding, changing, deleting individual cookies.
- Be able to do all operations based on parameters specifying
URLs, paths, expiration dates, or domains in any combination.
- Given a URL, be able to recreate a Cookie header containing all
cookies applicable to that URL that were stored in the cookie jar.
The class is to use standard C++ library facilities (no MFC) for
all but the synchronization mechanisms.
The synchronization mechanisms used for multithreading integrity
are those appropriate to the Microsoft Windows environment.
I'm trying to write the class definition for this. I think I know what I need but I'm not very familiar with c++. Does anyone know what I need to do? Or at least where to start? The part that I'm most lost on is the part about the threads. I also don't really know which parts are supposed to be public or private and what variables/variable types I'm going to need.
But this is what I have so far:
class CCookieJar
{
public:
CCookieJar();
void parseHeader(string Header);
void addCookie(string url,string path, string expirationDates, string domain);
void recreateCookieHeader(string url);
void changeCookie(string url, string path, string expirationDates, string domain);
void deleteCookie(string url, string path, string expirationDates, string domain);
private:
CCookieJar CookieJar;
};
Does anyone know if this looks right? What else will I need? Thanks.
|
|
|
|
|
|
|
// |