Monday 28 January 2008

Internet Cookies

Netscape developed cookies. They did so as a means to store "state-related" (a programming term) and other information in a persistent manner. The information in a cookie survives after you disconnect from the remote server. When you connect again, that server can look up the cookie. Cookies work with CGI (Common Gate Interface) programs that reside on the remote server.

When a browser requests a URL (Uniform Resource Locator) from a remote server, the browser first searches a cookies file to see if any of that file's cookies match the URL it's requesting. The browser then sends, as part of the URL request, the remote server information contained in the matching cookie(s). Cookies allow CGI programs to store information on your computer instead of the remote one.

A cookie is a HyperText Transfer Protocol (HTTP) header that consists of a text-only string. Your browser stores this text string in its memory when called upon. This string contains the domain, path, lifetime, and value of a variable. That variable is something a CGI script is looking for--your e-mail address, what site you came from to get to the remote server, what browser you are using, or what operating system you run. A server can get all of this information without cookies, but doing so slows the server down. This is the only information a cookie can contain, unless you fill out a form that explicitly adds other information or the remote server sends you a cookie with information it added--such as a shopping cart ID number. A cookie cannot and does not scan your hard drive.

No comments: