draft-ietf-httpstate-cookie-15.txt   draft-ietf-httpstate-cookie-16.txt 
httpstate A. Barth httpstate A. Barth
Internet-Draft U.C. Berkeley Internet-Draft U.C. Berkeley
Obsoletes: 2109 (if approved) October 10, 2010 Obsoletes: 2965 (if approved) October 25, 2010
Intended status: Standards Track Intended status: Standards Track
Expires: April 13, 2011 Expires: April 28, 2011
HTTP State Management Mechanism HTTP State Management Mechanism
draft-ietf-httpstate-cookie-15 draft-ietf-httpstate-cookie-16
Abstract Abstract
This document defines the HTTP Cookie and Set-Cookie header fields. This document defines the HTTP Cookie and Set-Cookie header fields.
These header fields can be used by HTTP servers to store state These header fields can be used by HTTP servers to store state
(called cookies) at HTTP user agents, letting the servers maintain a (called cookies) at HTTP user agents, letting the servers maintain a
stateful session over the mostly stateless HTTP protocol. Although stateful session over the mostly stateless HTTP protocol. Although
cookies have many historical infelicities that degrade their security cookies have many historical infelicities that degrade their security
and privacy, the Cookie and Set-Cookie header fields are widely used and privacy, the Cookie and Set-Cookie header fields are widely used
on the Internet. on the Internet.
skipping to change at page 2, line 27 skipping to change at page 2, line 27
Internet-Drafts are working documents of the Internet Engineering Internet-Drafts are working documents of the Internet Engineering
Task Force (IETF). Note that other groups may also distribute Task Force (IETF). Note that other groups may also distribute
working documents as Internet-Drafts. The list of current Internet- working documents as Internet-Drafts. The list of current Internet-
Drafts is at http://datatracker.ietf.org/drafts/current/. Drafts is at http://datatracker.ietf.org/drafts/current/.
Internet-Drafts are draft documents valid for a maximum of six months Internet-Drafts are draft documents valid for a maximum of six months
and may be updated, replaced, or obsoleted by other documents at any and may be updated, replaced, or obsoleted by other documents at any
time. It is inappropriate to use Internet-Drafts as reference time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress." material or to cite them other than as "work in progress."
This Internet-Draft will expire on April 13, 2011. This Internet-Draft will expire on April 28, 2011.
Copyright Notice Copyright Notice
Copyright (c) 2010 IETF Trust and the persons identified as the Copyright (c) 2010 IETF Trust and the persons identified as the
document authors. All rights reserved. document authors. All rights reserved.
This document is subject to BCP 78 and the IETF Trust's Legal This document is subject to BCP 78 and the IETF Trust's Legal
Provisions Relating to IETF Documents Provisions Relating to IETF Documents
(http://trustee.ietf.org/license-info) in effect on the date of (http://trustee.ietf.org/license-info) in effect on the date of
publication of this document. Please review these documents publication of this document. Please review these documents
skipping to change at page 5, line 14 skipping to change at page 5, line 14
1. Introduction 1. Introduction
This document defines the HTTP Cookie and Set-Cookie header fields. This document defines the HTTP Cookie and Set-Cookie header fields.
Using the Set-Cookie header field, an HTTP server can pass name/value Using the Set-Cookie header field, an HTTP server can pass name/value
pairs and associated metadata (called cookies) to a user agent. When pairs and associated metadata (called cookies) to a user agent. When
the user agent makes subsequent requests to the server, the user the user agent makes subsequent requests to the server, the user
agent uses the metadata and other information to determine whether to agent uses the metadata and other information to determine whether to
return the name/value pairs in the Cookie header. return the name/value pairs in the Cookie header.
Although simple on its surface, cookies have a number of Although simple on their surface, cookies have a number of
complexities. For example, the server indicates a scope for each complexities. For example, the server indicates a scope for each
cookie when sending them to the user agent. The scope indicates the cookie when sending it to the user agent. The scope indicates the
maximum amount of time the user agent should return the cookie, the maximum amount of time the user agent should return the cookie, the
servers to which the user agent should return the cookie, and the URI servers to which the user agent should return the cookie, and the URI
schemes for which the cookie is applicable. schemes for which the cookie is applicable.
For historical reasons, cookies contain a number of security and For historical reasons, cookies contain a number of security and
privacy infelicities. For example, a server can indicate that a privacy infelicities. For example, a server can indicate that a
given cookie is intended for "secure" connections, but the Secure given cookie is intended for "secure" connections, but the Secure
attribute does not provide integrity in the presence of an active attribute does not provide integrity in the presence of an active
network attackers. Similarly, cookies for a given host are shared network attacker. Similarly, cookies for a given host are shared
across all the ports on that host, even though the usual "same-origin across all the ports on that host, even though the usual "same-origin
policy" used by web browsers isolates content retrieved via different policy" used by web browsers isolates content retrieved via different
ports. ports.
Prior to this document, there were at least three descriptions of Prior to this document, there were at least three descriptions of
cookies: the so-called "Netscape cookie specification" [Netscape], cookies: the so-called "Netscape cookie specification" [Netscape],
RFC 2109 [RFC2109], and RFC 2965 [RFC2965]. However, none of these RFC 2109 [RFC2109], and RFC 2965 [RFC2965]. However, none of these
documents describe how the Cookie and Set-Cookie headers are actually documents describe how the Cookie and Set-Cookie headers are actually
used on the Internet (see [Kri2001] for historical context). This used on the Internet (see [Kri2001] for historical context). This
document attempts to specify the syntax and semantics of these document attempts to specify the syntax and semantics of these
headers as they are actually used on the Internet. headers as they are actually used on the Internet.
Therefore, in relation to previous IETF specifications of HTTP state
management mechanisms, this document requests the following actions:
1. Change the status of [RFC2109] to Historic (it has already been
obsoleted by [RFC2965]).
2. Change the status of [RFC2965] to Historic.
3. Indicate that [RFC2965] is obsoleted by this document.
2. Conventions 2. Conventions
2.1. Conformance Criteria 2.1. Conformance Criteria
The keywords "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT", The keywords "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD NOT",
"RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be
interpreted as described in [RFC2119]. interpreted as described in [RFC2119].
Requirements phrased in the imperative as part of algorithms (such as Requirements phrased in the imperative as part of algorithms (such as
"strip any leading space characters" or "return false and abort these "strip any leading space characters" or "return false and abort these
skipping to change at page 12, line 11 skipping to change at page 12, line 11
secure-av = "Secure" secure-av = "Secure"
httponly-av = "HttpOnly" httponly-av = "HttpOnly"
extension-av = <any CHAR except CTLs or ";"> extension-av = <any CHAR except CTLs or ";">
Note that some of the grammatical terms above reference documents Note that some of the grammatical terms above reference documents
that use different grammatical notations than this document (which that use different grammatical notations than this document (which
uses ABNF from [RFC5234]). uses ABNF from [RFC5234]).
The semantics of the cookie-value are not defined by this document. The semantics of the cookie-value are not defined by this document.
To maximize compatibility with user agents, servers that wish to To maximize compatibility with user agents, servers that wish to
store non-ASCII data in a cookie-value SHOULD encode that data using store arbitrary data in a cookie-value SHOULD encode that data, for
a printable ASCII encoding. example, using Base 16 [RFC3548].
The portions of the set-cookie-string produced by the cookie-av term The portions of the set-cookie-string produced by the cookie-av term
are known as attributes. To maximize compatibility with user agents, are known as attributes. To maximize compatibility with user agents,
servers SHOULD NOT produce two attributes with the same name in the servers SHOULD NOT produce two attributes with the same name in the
same set-cookie-string. same set-cookie-string.
Servers SHOULD NOT include more than one Set-Cookie header field in Servers SHOULD NOT include more than one Set-Cookie header field in
the same response with the same cookie-name. the same response with the same cookie-name.
If a server sends multiple responses containing Set-Cookie headers If a server sends multiple responses containing Set-Cookie headers
concurrently to the user agent (e.g., when communicating with the concurrently to the user agent (e.g., when communicating with the
user agent over multiple sockets), these responses create a "race user agent over multiple sockets), these responses create a "race
condition" that can lead to unpredictable behavior. condition" that can lead to unpredictable behavior.
NOTE: Some legacy user agents differ on their interpretation of two- NOTE: Some existing user agents differ on their interpretation of
digit years. To avoid compatibility issues, servers SHOULD use the two-digit years. To avoid compatibility issues, servers SHOULD use
rfc1123-date format, which requires a four-digit year. the rfc1123-date format, which requires a four-digit year.
NOTE: Some user agents represent dates using 32-bit UNIX time_t NOTE: Some user agents represent dates using 32-bit UNIX time_t
values. Some of these user agents might contain bugs that cause them values. Some of these user agents might contain bugs that cause them
to process dates after the year 2038 incorrectly. to process dates after the year 2038 incorrectly.
4.1.2. Semantics (Non-Normative) 4.1.2. Semantics (Non-Normative)
This section describes a simplified semantics of the Set-Cookie This section describes a simplified semantics of the Set-Cookie
header. These semantics are detailed enough to be useful for header. These semantics are detailed enough to be useful for
understanding the most common uses of cookies by servers. The full understanding the most common uses of cookies by servers. The full
skipping to change at page 13, line 8 skipping to change at page 13, line 8
If the user agent receives a new cookie with the same cookie-name, If the user agent receives a new cookie with the same cookie-name,
domain-value, and path-value as a cookie that it has already stored, domain-value, and path-value as a cookie that it has already stored,
the existing cookie is evicted and replaced with the new cookie. the existing cookie is evicted and replaced with the new cookie.
Notice that servers can delete cookies by sending the user agent a Notice that servers can delete cookies by sending the user agent a
new cookie with an Expires attribute with a value in the past. new cookie with an Expires attribute with a value in the past.
Unless the cookie's attributes indicate otherwise, the cookie is Unless the cookie's attributes indicate otherwise, the cookie is
returned only to the origin server, and it expires at the end of the returned only to the origin server, and it expires at the end of the
current session (as defined by the user agent). User agents ignore current session (as defined by the user agent). User agents ignore
unrecognized cookie attributes. unrecognized cookie attributes (but not the entire cookie).
4.1.2.1. The Expires Attribute 4.1.2.1. The Expires Attribute
The Expires attribute indicates the maximum lifetime of the cookie, The Expires attribute indicates the maximum lifetime of the cookie,
represented as the date and time at which the cookie expires. The represented as the date and time at which the cookie expires. The
user agent is not required to retain the cookie until the specified user agent is not required to retain the cookie until the specified
date has passed. In fact, user agents often evict cookies due to date has passed. In fact, user agents often evict cookies due to
memory pressure or privacy concerns. memory pressure or privacy concerns.
4.1.2.2. The Max-Age Attribute 4.1.2.2. The Max-Age Attribute
The Max-Age attribute indicates the maximum lifetime of the cookie, The Max-Age attribute indicates the maximum lifetime of the cookie,
represented as the number of seconds until the cookie expires. The represented as the number of seconds until the cookie expires. The
user agent is not required to retain the cookie for the specified user agent is not required to retain the cookie for the specified
duration. In fact, user agents often evict cookies from due to duration. In fact, user agents often evict cookies from due to
memory pressure or privacy concerns. memory pressure or privacy concerns.
NOTE: Some legacy user agents do not support the Max-Age NOTE: Some existing user agents do not support the Max-Age
attribute. User agents that do not support the Max-Age attribute attribute. User agents that do not support the Max-Age attribute
ignore the attribute. ignore the attribute.
If a cookie has both the Max-Age and the Expires attribute, the Max- If a cookie has both the Max-Age and the Expires attribute, the Max-
Age attribute has precedence and controls the expiration date of the Age attribute has precedence and controls the expiration date of the
cookie. If a cookie has neither the Max-Age nor the Expires cookie. If a cookie has neither the Max-Age nor the Expires
attribute, the user agent will retain the cookie until "the current attribute, the user agent will retain the cookie until "the current
session is over" (as defined by the user agent). session is over" (as defined by the user agent).
4.1.2.3. The Domain Attribute 4.1.2.3. The Domain Attribute
The Domain attribute specifies those hosts to which the cookie will The Domain attribute specifies those hosts to which the cookie will
be sent. For example, if the value of the Domain attribute is be sent. For example, if the value of the Domain attribute is
"example.com", the user agent will include the cookie in the Cookie "example.com", the user agent will include the cookie in the Cookie
header when making HTTP requests to example.com, www.example.com, and header when making HTTP requests to example.com, www.example.com, and
www.corp.example.com. (Note that a leading %x2E ("."), if present, www.corp.example.com. (Note that a leading %x2E ("."), if present,
is ignored even though that character is not permitted.) If the is ignored even though that character is not permitted.) If the
server omits the Domain attribute, the user agent will return the server omits the Domain attribute, the user agent will return the
cookie only to the origin server. cookie only to the origin server.
WARNING: Some legacy user agents treat an absent Domain attribute WARNING: Some existing user agents treat an absent Domain
as if the Domain attribute were present and contained the current attribute as if the Domain attribute were present and contained
host name. For example, if example.com returns a Set-Cookie the current host name. For example, if example.com returns a Set-
header without a Domain attribute, these user agents will Cookie header without a Domain attribute, these user agents will
erroneously send the cookie to www.example.com as well. erroneously send the cookie to www.example.com as well.
The user agent will reject cookies unless the Domain attribute The user agent will reject cookies unless the Domain attribute
specifies a scope for the cookie that would include the origin specifies a scope for the cookie that would include the origin
server. For example, the user agent will accept a cookie with a server. For example, the user agent will accept a cookie with a
Domain attribute of "example.com" or of "foo.example.com" from Domain attribute of "example.com" or of "foo.example.com" from
foo.example.com, but the user agent will not accept a cookie with a foo.example.com, but the user agent will not accept a cookie with a
Domain attribute of "bar.example.com" or of "baz.foo.example.com". Domain attribute of "bar.example.com" or of "baz.foo.example.com".
NOTE: For security reasons, many user agents are configured to reject NOTE: For security reasons, many user agents are configured to reject
Domain attributes that correspond to "public suffixes." For example, Domain attributes that correspond to "public suffixes". For example,
some user agents will reject Domain attributes of "com" or "co.uk". some user agents will reject Domain attributes of "com" or "co.uk".
(See Section 5.3 for more information.)
4.1.2.4. The Path Attribute 4.1.2.4. The Path Attribute
The scope of each cookie is limited to a set of paths, controlled by The scope of each cookie is limited to a set of paths, controlled by
the Path attribute. If the server omits the Path attribute, the user the Path attribute. If the server omits the Path attribute, the user
agent will use the "directory" of the request-uri's path component as agent will use the "directory" of the request-uri's path component as
the default value. (See Section 5.1.4 for more details.) the default value. (See Section 5.1.4 for more details.)
The user agent will include the cookie in an HTTP request only if the The user agent will include the cookie in an HTTP request only if the
path portion of the request-uri matches (or is a subdirectory of) the path portion of the request-uri matches (or is a subdirectory of) the
skipping to change at page 14, line 38 skipping to change at page 14, line 39
Although seemingly useful for isolating cookies between different Although seemingly useful for isolating cookies between different
paths within a given host, the Path attribute cannot be relied upon paths within a given host, the Path attribute cannot be relied upon
for security (see Section 8). for security (see Section 8).
4.1.2.5. The Secure Attribute 4.1.2.5. The Secure Attribute
The Secure attribute limits the scope of the cookie to "secure" The Secure attribute limits the scope of the cookie to "secure"
channels (where "secure" is defined by the user agent). When a channels (where "secure" is defined by the user agent). When a
cookie has the Secure attribute, the user agent will include the cookie has the Secure attribute, the user agent will include the
cookie in an HTTP request only if the request is transmitted over a cookie in an HTTP request only if the request is transmitted over a
secure channel (typically HTTP over SSL, HTTP over TLS [RFC2818], and secure channel (typically HTTP over Secure Sockets Layer (SSL), HTTP
TLS [RFC5246] itself). over Transport Layer Security (TLS) [RFC2818], and TLS [RFC5246]
itself).
Although seemingly useful for protecting cookies from active network Although seemingly useful for protecting cookies from active network
attackers, the Secure attribute protects only the cookie's attackers, the Secure attribute protects only the cookie's
confidentiality. An active network attacker can overwrite Secure confidentiality. An active network attacker can overwrite Secure
cookies from an insecure channel, disrupting their integrity (see cookies from an insecure channel, disrupting their integrity (see
Section 8.6 for more details). Section 8.6 for more details).
4.1.2.6. The HttpOnly Attribute 4.1.2.6. The HttpOnly Attribute
The HttpOnly attribute limits the scope of the cookie to HTTP The HttpOnly attribute limits the scope of the cookie to HTTP
requests. In particular, the attribute instructs the user agent to requests. In particular, the attribute instructs the user agent to
omit the cookie when providing access to cookies via "non-HTTP" APIs omit the cookie when providing access to cookies via "non-HTTP" APIs
(such as a web browser API that exposes cookies to scripts). (such as a web browser API that exposes cookies to scripts).
4.2. Cookie 4.2. Cookie
4.2.1. Syntax 4.2.1. Syntax
The user agent sends stored cookies to the origin server in the The user agent sends stored cookies to the origin server in the
Cookie header. If the server conforms to the requirements in Cookie header. If the server conforms to the requirements in
Section 4.1 (and the user agent conforms to the requirements in the Section 4.1 (and the user agent conforms to the requirements in
Section 5), the user agent will send a Cookie header that conforms to Section 5), the user agent will send a Cookie header that conforms to
the following grammar: the following grammar:
cookie-header = "Cookie:" OWS cookie-string OWS cookie-header = "Cookie:" OWS cookie-string OWS
cookie-string = cookie-pair *( ";" SP cookie-pair ) cookie-string = cookie-pair *( ";" SP cookie-pair )
4.2.2. Semantics 4.2.2. Semantics
Each cookie-pair represents a cookie stored by the user agent. The Each cookie-pair represents a cookie stored by the user agent. The
cookie-pair contains the cookie-name and cookie-value the user agent cookie-pair contains the cookie-name and cookie-value the user agent
skipping to change at page 17, line 27 skipping to change at page 17, line 27
the year production, set the found-year flag and set the the year production, set the found-year flag and set the
year-value to the number denoted by the date-token. Skip the year-value to the number denoted by the date-token. Skip the
remaining sub-steps and continue to the next date-token. remaining sub-steps and continue to the next date-token.
3. If the year-value is greater than or equal to 70 and less than or 3. If the year-value is greater than or equal to 70 and less than or
equal to 99, increment the year-value by 1900. equal to 99, increment the year-value by 1900.
4. If the year-value is greater than or equal to 0 and less than or 4. If the year-value is greater than or equal to 0 and less than or
equal to 69, increment the year-value by 2000. equal to 69, increment the year-value by 2000.
1. NOTE: Some legacy user agents interpret two-digit years 1. NOTE: Some existing user agents interpret two-digit years
differently. differently.
5. Abort these steps and fail to parse the cookie-date if 5. Abort these steps and fail to parse the cookie-date if
* at least one of the found-day-of-month, found-month, found- * at least one of the found-day-of-month, found-month, found-
year, or found-time flags is not set, year, or found-time flags is not set,
* the day-of-month-value is less than 1 or greater than 31, * the day-of-month-value is less than 1 or greater than 31,
* the year-value is less than 1601, * the year-value is less than 1601,
* the hour-value is greater than 23, * the hour-value is greater than 23,
* the minute-value is greater than 59, or * the minute-value is greater than 59, or
* the second-value is greater than 59. * the second-value is greater than 59.
6. Let the parsed-cookie-date be the date whose day-of-month, month, 6. Let the parsed-cookie-date be the date whose day-of-month, month,
year, hour, minute, and second (in GMT) are the day-of-month- year, hour, minute, and second (in UTC) are the day-of-month-
value, the month-value, the year-value, the hour-value, the value, the month-value, the year-value, the hour-value, the
minute-value, and the second-value, respectively. If no such minute-value, and the second-value, respectively. If no such
date exists, abort these steps and fail to parse the cookie-date. date exists, abort these steps and fail to parse the cookie-date.
7. Return the parsed-cookie-date as the result of this algorithm. 7. Return the parsed-cookie-date as the result of this algorithm.
5.1.2. Canonicalized host names 5.1.2. Canonicalized host names
A canonicalized host name is the string generated by the following A canonicalized host name is the string generated by the following
algorithm: algorithm:
1. Convert the host name to a sequence of NR-LDH labels (see Section 1. Convert the host name to a sequence of NR-LDH labels (see Section
2.3.2.2 of [RFC5890]) and/or A-labels according to the 2.3.2.2 of [RFC5890]) or a sequence of A-labels according to the
appropriate IDNA specification [RFC5891] or [RFC3490] (see appropriate IDNA specification [RFC5891] or [RFC3490] (see
Section 6.3 of this specification) Section 6.3 of this specification)
2. Convert the labels to lower case. 2. Concatenate the labels resulting from the previous step,
separating each label from the next with a %x2E (".") character.
3. Concatenate the labels, separating each label from the next with
a %x2E (".") character.
5.1.3. Domain matching 5.1.3. Domain matching
A string domain-matches a given domain string if at least one of the A string domain-matches a given domain string if at least one of the
following conditions hold: following conditions hold:
o The domain string and the string are identical. o The domain string and the string are identical.
o All of the following conditions hold: o All of the following conditions hold:
skipping to change at page 18, line 48 skipping to change at page 18, line 46
The user agent MUST use an algorithm equivalent to the following The user agent MUST use an algorithm equivalent to the following
algorithm to compute the default-path of a cookie: algorithm to compute the default-path of a cookie:
1. Let uri-path be the path portion of the request-uri if such a 1. Let uri-path be the path portion of the request-uri if such a
portion exists (and empty otherwise). For example, if the portion exists (and empty otherwise). For example, if the
request-uri contains just a path (and optional query string), request-uri contains just a path (and optional query string),
then the uri-path is that path (without the %x3F ("?") character then the uri-path is that path (without the %x3F ("?") character
or query string), and if the request-uri contains a full or query string), and if the request-uri contains a full
absoluteURI, the uri-path is the path component of that URI. absoluteURI, the uri-path is the path component of that URI.
2. If the uri-path is empty or if first character of the uri-path is 2. If the uri-path is empty or if the first character of the uri-
not a %x2F ("/") character, output %x2F ("/") and skip the path is not a %x2F ("/") character, output %x2F ("/") and skip
remaining steps. the remaining steps.
3. If the uri-path contains only a single %x2F ("/") character, 3. If the uri-path contains only a single %x2F ("/") character,
output %x2F ("/") and skip the remaining steps. output %x2F ("/") and skip the remaining steps.
4. Output the characters of the uri-path from the first character up 4. Output the characters of the uri-path from the first character up
to, but not including, the right-most %x2F ("/"). to, but not including, the right-most %x2F ("/").
A request-path path-matches a given cookie-path if at least one of A request-path path-matches a given cookie-path if at least one of
the following conditions hold: the following conditions hold:
skipping to change at page 19, line 26 skipping to change at page 19, line 23
o The cookie-path is a prefix of the request-path and the last o The cookie-path is a prefix of the request-path and the last
character of the cookie-path is %x2F ("/"). character of the cookie-path is %x2F ("/").
o The cookie-path is a prefix of the request-path and the first o The cookie-path is a prefix of the request-path and the first
character of the request-path that is not included in the cookie- character of the request-path that is not included in the cookie-
path is a %x2F ("/") character. path is a %x2F ("/") character.
5.2. The Set-Cookie Header 5.2. The Set-Cookie Header
When a user agent receives a Set-Cookie header field in an HTTP When a user agent receives a Set-Cookie header field in an HTTP
response, the user agent MUST parse the field-value of the Set-Cookie response, the user agent MAY ignore the Set-Cookie header field in
its entirety. For example, the user agent might wish to block
responses to "third-party" requests from setting cookies.
If the user agent does not ignore the Set-Cookie header field in its
entirety, the user agent MUST parse the field-value of the Set-Cookie
header field as a set-cookie-string (defined below). header field as a set-cookie-string (defined below).
NOTE: The algorithm below is more permissive than the grammar in NOTE: The algorithm below is more permissive than the grammar in
Section 4.1. For example, the algorithm strips leading and trailing Section 4.1. For example, the algorithm strips leading and trailing
whitespace from the cookie name and value (but maintains internal whitespace from the cookie name and value (but maintains internal
whitespace), whereas the grammar in Section 4.1 forbids whitespace in whitespace), whereas the grammar in Section 4.1 forbids whitespace in
these positions. User agents use this algorithm so as to these positions. User agents use this algorithm so as to
interoperate with servers that do not follow the recommendations in interoperate with servers that do not follow the recommendations in
Section 4. Section 4.
skipping to change at page 24, line 39 skipping to change at page 24, line 41
5. If the user agent is configured to reject "public suffixes" and 5. If the user agent is configured to reject "public suffixes" and
the domain-attribute is a public suffix: the domain-attribute is a public suffix:
If the domain-attribute is identical to the canonicalized If the domain-attribute is identical to the canonicalized
request-host: request-host:
Let the domain-attribute be the empty string. Let the domain-attribute be the empty string.
Otherwise: Otherwise:
Ignore the cookie entirely and abort these steps Ignore the cookie entirely and abort these steps.
NOTE: A "public suffix" is a domain that is controlled by a NOTE: A "public suffix" is a domain that is controlled by a
public registry, such as "com", "co.uk", and "pvt.k12.wy.us". public registry, such as "com", "co.uk", and "pvt.k12.wy.us".
This step is essential for preventing attacker.com from This step is essential for preventing attacker.com from
disrupting the integrity of example.com by setting a cookie disrupting the integrity of example.com by setting a cookie
with a Domain attribute of "com". Unfortunately, the set of with a Domain attribute of "com". Unfortunately, the set of
public suffixes (also known as "registry controlled domains") public suffixes (also known as "registry controlled domains")
changes over time. If feasible, user agents SHOULD use an changes over time. If feasible, user agents SHOULD use an
up-to-date public suffix list, such as the one maintained by up-to-date public suffix list, such as the one maintained by
the Mozilla project at <http://publicsuffix.org/>. the Mozilla project at <http://publicsuffix.org/>.
6. If the domain-attribute is non-empty: 6. If the domain-attribute is non-empty:
If the canonicalized request-host does not domain-match the If the canonicalized request-host does not domain-match the
domain-attribute, ignore the cookie entirely and abort these domain-attribute:
steps.
Set the cookie's host-only-flag to false. Ignore the cookie entirely and abort these steps.
Set the cookie's domain to the domain-attribute. Otherwise:
Set the cookie's host-only-flag to false.
Set the cookie's domain to the domain-attribute.
Otherwise: Otherwise:
Set the cookie's host-only-flag to true. Set the cookie's host-only-flag to true.
Set the cookie's domain to the canonicalized request-host. Set the cookie's domain to the canonicalized request-host.
7. If the cookie-attribute-list contains an attribute with an 7. If the cookie-attribute-list contains an attribute with an
attribute-name of "Path", set the cookie's path to attribute- attribute-name of "Path", set the cookie's path to attribute-
value of the last attribute in the cookie-attribute-list with an value of the last attribute in the cookie-attribute-list with an
skipping to change at page 25, line 47 skipping to change at page 25, line 50
cookie entirely. cookie entirely.
11. If the cookie store contains a cookie with the same name, 11. If the cookie store contains a cookie with the same name,
domain, and path as the newly created cookie: domain, and path as the newly created cookie:
1. Let old-cookie be the existing cookie with the same name, 1. Let old-cookie be the existing cookie with the same name,
domain, and path as the newly created cookie. (Notice that domain, and path as the newly created cookie. (Notice that
this algorithm maintains the invariant that there is at most this algorithm maintains the invariant that there is at most
one such cookie.) one such cookie.)
2. If the newly created cookie was received from an "non-HTTP" 2. If the newly created cookie was received from a "non-HTTP"
API and the old-cookie's http-only-flag is set, abort these API and the old-cookie's http-only-flag is set, abort these
steps and ignore the newly created cookie entirely. steps and ignore the newly created cookie entirely.
3. Update the creation-time of the newly created cookie to 3. Update the creation-time of the newly created cookie to
match the creation-time of the old-cookie. match the creation-time of the old-cookie.
4. Remove the old-cookie from the cookie store. 4. Remove the old-cookie from the cookie store.
12. Insert the newly created cookie into the cookie store. 12. Insert the newly created cookie into the cookie store.
skipping to change at page 30, line 44 skipping to change at page 30, line 44
achieving their privacy goals if servers attempt to work around their achieving their privacy goals if servers attempt to work around their
restrictions to track users. In particular, two collaborating restrictions to track users. In particular, two collaborating
servers can often track users without using cookies at all. servers can often track users without using cookies at all.
7.2. User Controls 7.2. User Controls
User agents should provide users with a mechanism for managing the User agents should provide users with a mechanism for managing the
cookies stored in the cookie store. For example, a user agent might cookies stored in the cookie store. For example, a user agent might
let users delete all cookies received during a specified time period let users delete all cookies received during a specified time period
or all the cookies related to a particular domain. In addition, many or all the cookies related to a particular domain. In addition, many
user agent include a user interface element that lets users examine user agents include a user interface element that lets users examine
the cookies stored in their cookie store. the cookies stored in their cookie store.
User agents should provide users with a mechanism for disabling User agents should provide users with a mechanism for disabling
cookies. When cookies are disabled, the user agent MUST NOT include cookies. When cookies are disabled, the user agent MUST NOT include
a Cookie header in outbound HTTP requests and the user agent MUST NOT a Cookie header in outbound HTTP requests and the user agent MUST NOT
process Set-Cookie headers in inbound HTTP responses. process Set-Cookie headers in inbound HTTP responses.
Some user agents provide users the option of preventing persistent Some user agents provide users the option of preventing persistent
storage of cookies across sessions. When configured thusly, user storage of cookies across sessions. When configured thusly, user
agents MUST treat all received cookies as if the persistent-flag were agents MUST treat all received cookies as if the persistent-flag were
skipping to change at page 38, line 20 skipping to change at page 38, line 20
[Netscape] [Netscape]
Netscape Communications Corp., "Persistent Client State -- Netscape Communications Corp., "Persistent Client State --
HTTP Cookies", 1999, <http://web.archive.org/web/ HTTP Cookies", 1999, <http://web.archive.org/web/
20020803110822/http://wp.netscape.com/newsref/std/ 20020803110822/http://wp.netscape.com/newsref/std/
cookie_spec.html>. cookie_spec.html>.
[Kri2001] Kristol, D., "HTTP Cookies: Standards, Privacy, and [Kri2001] Kristol, D., "HTTP Cookies: Standards, Privacy, and
Politics", ACM Transactions on Internet Technology Vol. 1, Politics", ACM Transactions on Internet Technology Vol. 1,
#2, November 2001, <http://arxiv.org/abs/cs.SE/0105018>. #2, November 2001, <http://arxiv.org/abs/cs.SE/0105018>.
[RFC3548] Josefsson, S., "The Base16, Base32, and Base64 Data
Encodings", RFC 3548, July 2003.
[RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration
Procedures for Message Header Fields", BCP 90, RFC 3864, Procedures for Message Header Fields", BCP 90, RFC 3864,
September 2004. September 2004.
Appendix A. Acknowledgements Appendix A. Acknowledgements
This document borrows heavily from RFC 2109 [RFC2109]. We are This document borrows heavily from RFC 2109 [RFC2109]. We are
indebted to David M. Kristol and Lou Montulli for their efforts to indebted to David M. Kristol and Lou Montulli for their efforts to
specify cookies. David M. Kristol, in particular, provided specify cookies. David M. Kristol, in particular, provided
invaluable advice on navigating the IETF process. We would also like invaluable advice on navigating the IETF process. We would also like
 End of changes. 30 change blocks. 
40 lines changed or deleted 61 lines changed or added

This html diff was produced by rfcdiff 1.40. The latest version is available from http://tools.ietf.org/tools/rfcdiff/