tags:

views:

122

answers:

3

How are cookies passed in the HTTP protocol?

+1  A: 

Cookies are passed as HTTP headers, both in the request (client -> server), and in the response (server -> client).

Douglas Leeder
+7  A: 

The server sends a

Set-Cookie: name=value

in its response header to set the field. If there is a cookie set then the browser sends a

Cookie: name=value

in its request header. See wikipedia

deinst
A: 

Cookies are passed in ResponseHeader of HttpServletResponse object by server. Read this for more details in context of Java Servlets.

Tushar Tarkas
The question specifically asked about the HTTP protocol itself, not how Java does it.
cHao