codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  Cookies and Threads C++  TheDarkness at 12:08 on Wednesday, October 17, 2007
 

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.









CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums
//








Recent Forum Threads
•  Job @ EarlySail
•  Job @ EarlySail (perl)
•  Security - Code verify
•  IPC problem
•  Re: import contacts of msn/yahoo
•  Cookies and Threads C++
•  right justify a background in a table?
•  Help with Loop (C++/MFC)
•  Help with Loop (C++/MFC)


Recent Articles
ASP GetTempName
Decode and Encode UTF-8
ASP GetFile
ASP FolderExists
ASP FileExists
ASP OpenTextFile
ASP FilesystemObject
ASP CreateFolder
ASP CreateTextFile
Javascript Get Selected Text


© Copyright codetoad.com 2001-2007