1. When a URL is requested from an HTTP server, the browser compares the URL with all Cookies stored on the client host, the line that matches the cookie that contains the name/value pair will be included in the HTTP request header.
The format of the request header line is:
COOKIE: name1 = value1; name2 = value2; ......; Namen = valuen
2. When the HTTP server encounters this row in the Request Header, it extracts the child string of the name/value pair from this row and places the string in the environment variable http_cookie. When CGI is executed, you can obtain data from the environment variable http_cookie in the form of name/value pairs.
For example:
Send the following requests to the server:
GET/cgi/Hello. cgi? Name = zhangsan & quest = Peace HTTP/1.0
Cooike: age = 25
<Blank line>
Then, the server puts the string "name = zhangsan & quest = Peace" into the environment variable QUERY_STRING and puts the string "age = 25" into the environment variable http_cookie to provide the CGI script to be called.