···11+22+33+44+55+66+77+Internet Engineering Task Force (IETF) A. Barth
88+Request for Comments: 6265 U.C. Berkeley
99+Obsoletes: 2965 April 2011
1010+Category: Standards Track
1111+ISSN: 2070-1721
1212+1313+1414+ HTTP State Management Mechanism
1515+1616+Abstract
1717+1818+ This document defines the HTTP Cookie and Set-Cookie header fields.
1919+ These header fields can be used by HTTP servers to store state
2020+ (called cookies) at HTTP user agents, letting the servers maintain a
2121+ stateful session over the mostly stateless HTTP protocol. Although
2222+ cookies have many historical infelicities that degrade their security
2323+ and privacy, the Cookie and Set-Cookie header fields are widely used
2424+ on the Internet. This document obsoletes RFC 2965.
2525+2626+Status of This Memo
2727+2828+ This is an Internet Standards Track document.
2929+3030+ This document is a product of the Internet Engineering Task Force
3131+ (IETF). It represents the consensus of the IETF community. It has
3232+ received public review and has been approved for publication by the
3333+ Internet Engineering Steering Group (IESG). Further information on
3434+ Internet Standards is available in Section 2 of RFC 5741.
3535+3636+ Information about the current status of this document, any errata,
3737+ and how to provide feedback on it may be obtained at
3838+ http://www.rfc-editor.org/info/rfc6265.
3939+4040+Copyright Notice
4141+4242+ Copyright (c) 2011 IETF Trust and the persons identified as the
4343+ document authors. All rights reserved.
4444+4545+ This document is subject to BCP 78 and the IETF Trust's Legal
4646+ Provisions Relating to IETF Documents
4747+ (http://trustee.ietf.org/license-info) in effect on the date of
4848+ publication of this document. Please review these documents
4949+ carefully, as they describe your rights and restrictions with respect
5050+ to this document. Code Components extracted from this document must
5151+ include Simplified BSD License text as described in Section 4.e of
5252+ the Trust Legal Provisions and are provided without warranty as
5353+ described in the Simplified BSD License.
5454+5555+5656+5757+5858+Barth Standards Track [Page 1]
5959+6060+RFC 6265 HTTP State Management Mechanism April 2011
6161+6262+6363+ This document may contain material from IETF Documents or IETF
6464+ Contributions published or made publicly available before November
6565+ 10, 2008. The person(s) controlling the copyright in some of this
6666+ material may not have granted the IETF Trust the right to allow
6767+ modifications of such material outside the IETF Standards Process.
6868+ Without obtaining an adequate license from the person(s) controlling
6969+ the copyright in such materials, this document may not be modified
7070+ outside the IETF Standards Process, and derivative works of it may
7171+ not be created outside the IETF Standards Process, except to format
7272+ it for publication as an RFC or to translate it into languages other
7373+ than English.
7474+7575+Table of Contents
7676+7777+ 1. Introduction ....................................................3
7878+ 2. Conventions .....................................................4
7979+ 2.1. Conformance Criteria .......................................4
8080+ 2.2. Syntax Notation ............................................5
8181+ 2.3. Terminology ................................................5
8282+ 3. Overview ........................................................6
8383+ 3.1. Examples ...................................................6
8484+ 4. Server Requirements .............................................8
8585+ 4.1. Set-Cookie .................................................8
8686+ 4.1.1. Syntax ..............................................8
8787+ 4.1.2. Semantics (Non-Normative) ..........................10
8888+ 4.2. Cookie ....................................................13
8989+ 4.2.1. Syntax .............................................13
9090+ 4.2.2. Semantics ..........................................13
9191+ 5. User Agent Requirements ........................................14
9292+ 5.1. Subcomponent Algorithms ...................................14
9393+ 5.1.1. Dates ..............................................14
9494+ 5.1.2. Canonicalized Host Names ...........................16
9595+ 5.1.3. Domain Matching ....................................16
9696+ 5.1.4. Paths and Path-Match ...............................16
9797+ 5.2. The Set-Cookie Header .....................................17
9898+ 5.2.1. The Expires Attribute ..............................19
9999+ 5.2.2. The Max-Age Attribute ..............................20
100100+ 5.2.3. The Domain Attribute ...............................20
101101+ 5.2.4. The Path Attribute .................................21
102102+ 5.2.5. The Secure Attribute ...............................21
103103+ 5.2.6. The HttpOnly Attribute .............................21
104104+ 5.3. Storage Model .............................................21
105105+ 5.4. The Cookie Header .........................................25
106106+ 6. Implementation Considerations ..................................27
107107+ 6.1. Limits ....................................................27
108108+ 6.2. Application Programming Interfaces ........................27
109109+ 6.3. IDNA Dependency and Migration .............................27
110110+ 7. Privacy Considerations .........................................28
111111+112112+113113+114114+Barth Standards Track [Page 2]
115115+116116+RFC 6265 HTTP State Management Mechanism April 2011
117117+118118+119119+ 7.1. Third-Party Cookies .......................................28
120120+ 7.2. User Controls .............................................28
121121+ 7.3. Expiration Dates ..........................................29
122122+ 8. Security Considerations ........................................29
123123+ 8.1. Overview ..................................................29
124124+ 8.2. Ambient Authority .........................................30
125125+ 8.3. Clear Text ................................................30
126126+ 8.4. Session Identifiers .......................................31
127127+ 8.5. Weak Confidentiality ......................................32
128128+ 8.6. Weak Integrity ............................................32
129129+ 8.7. Reliance on DNS ...........................................33
130130+ 9. IANA Considerations ............................................33
131131+ 9.1. Cookie ....................................................34
132132+ 9.2. Set-Cookie ................................................34
133133+ 9.3. Cookie2 ...................................................34
134134+ 9.4. Set-Cookie2 ...............................................34
135135+ 10. References ....................................................35
136136+ 10.1. Normative References .....................................35
137137+ 10.2. Informative References ...................................35
138138+ Appendix A. Acknowledgements ......................................37
139139+140140+1. Introduction
141141+142142+ This document defines the HTTP Cookie and Set-Cookie header fields.
143143+ Using the Set-Cookie header field, an HTTP server can pass name/value
144144+ pairs and associated metadata (called cookies) to a user agent. When
145145+ the user agent makes subsequent requests to the server, the user
146146+ agent uses the metadata and other information to determine whether to
147147+ return the name/value pairs in the Cookie header.
148148+149149+ Although simple on their surface, cookies have a number of
150150+ complexities. For example, the server indicates a scope for each
151151+ cookie when sending it to the user agent. The scope indicates the
152152+ maximum amount of time in which the user agent should return the
153153+ cookie, the servers to which the user agent should return the cookie,
154154+ and the URI schemes for which the cookie is applicable.
155155+156156+ For historical reasons, cookies contain a number of security and
157157+ privacy infelicities. For example, a server can indicate that a
158158+ given cookie is intended for "secure" connections, but the Secure
159159+ attribute does not provide integrity in the presence of an active
160160+ network attacker. Similarly, cookies for a given host are shared
161161+ across all the ports on that host, even though the usual "same-origin
162162+ policy" used by web browsers isolates content retrieved via different
163163+ ports.
164164+165165+ There are two audiences for this specification: developers of cookie-
166166+ generating servers and developers of cookie-consuming user agents.
167167+168168+169169+170170+Barth Standards Track [Page 3]
171171+172172+RFC 6265 HTTP State Management Mechanism April 2011
173173+174174+175175+ To maximize interoperability with user agents, servers SHOULD limit
176176+ themselves to the well-behaved profile defined in Section 4 when
177177+ generating cookies.
178178+179179+ User agents MUST implement the more liberal processing rules defined
180180+ in Section 5, in order to maximize interoperability with existing
181181+ servers that do not conform to the well-behaved profile defined in
182182+ Section 4.
183183+184184+ This document specifies the syntax and semantics of these headers as
185185+ they are actually used on the Internet. In particular, this document
186186+ does not create new syntax or semantics beyond those in use today.
187187+ The recommendations for cookie generation provided in Section 4
188188+ represent a preferred subset of current server behavior, and even the
189189+ more liberal cookie processing algorithm provided in Section 5 does
190190+ not recommend all of the syntactic and semantic variations in use
191191+ today. Where some existing software differs from the recommended
192192+ protocol in significant ways, the document contains a note explaining
193193+ the difference.
194194+195195+ Prior to this document, there were at least three descriptions of
196196+ cookies: the so-called "Netscape cookie specification" [Netscape],
197197+ RFC 2109 [RFC2109], and RFC 2965 [RFC2965]. However, none of these
198198+ documents describe how the Cookie and Set-Cookie headers are actually
199199+ used on the Internet (see [Kri2001] for historical context). In
200200+ relation to previous IETF specifications of HTTP state management
201201+ mechanisms, this document requests the following actions:
202202+203203+ 1. Change the status of [RFC2109] to Historic (it has already been
204204+ obsoleted by [RFC2965]).
205205+206206+ 2. Change the status of [RFC2965] to Historic.
207207+208208+ 3. Indicate that [RFC2965] has been obsoleted by this document.
209209+210210+ In particular, in moving RFC 2965 to Historic and obsoleting it, this
211211+ document deprecates the use of the Cookie2 and Set-Cookie2 header
212212+ fields.
213213+214214+2. Conventions
215215+216216+2.1. Conformance Criteria
217217+218218+ The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT",
219219+ "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this
220220+ document are to be interpreted as described in [RFC2119].
221221+222222+223223+224224+225225+226226+Barth Standards Track [Page 4]
227227+228228+RFC 6265 HTTP State Management Mechanism April 2011
229229+230230+231231+ Requirements phrased in the imperative as part of algorithms (such as
232232+ "strip any leading space characters" or "return false and abort these
233233+ steps") are to be interpreted with the meaning of the key word
234234+ ("MUST", "SHOULD", "MAY", etc.) used in introducing the algorithm.
235235+236236+ Conformance requirements phrased as algorithms or specific steps can
237237+ be implemented in any manner, so long as the end result is
238238+ equivalent. In particular, the algorithms defined in this
239239+ specification are intended to be easy to understand and are not
240240+ intended to be performant.
241241+242242+2.2. Syntax Notation
243243+244244+ This specification uses the Augmented Backus-Naur Form (ABNF)
245245+ notation of [RFC5234].
246246+247247+ The following core rules are included by reference, as defined in
248248+ [RFC5234], Appendix B.1: ALPHA (letters), CR (carriage return), CRLF
249249+ (CR LF), CTLs (controls), DIGIT (decimal 0-9), DQUOTE (double quote),
250250+ HEXDIG (hexadecimal 0-9/A-F/a-f), LF (line feed), NUL (null octet),
251251+ OCTET (any 8-bit sequence of data except NUL), SP (space), HTAB
252252+ (horizontal tab), CHAR (any [USASCII] character), VCHAR (any visible
253253+ [USASCII] character), and WSP (whitespace).
254254+255255+ The OWS (optional whitespace) rule is used where zero or more linear
256256+ whitespace characters MAY appear:
257257+258258+ OWS = *( [ obs-fold ] WSP )
259259+ ; "optional" whitespace
260260+ obs-fold = CRLF
261261+262262+ OWS SHOULD either not be produced or be produced as a single SP
263263+ character.
264264+265265+2.3. Terminology
266266+267267+ The terms user agent, client, server, proxy, and origin server have
268268+ the same meaning as in the HTTP/1.1 specification ([RFC2616], Section
269269+ 1.3).
270270+271271+ The request-host is the name of the host, as known by the user agent,
272272+ to which the user agent is sending an HTTP request or from which it
273273+ is receiving an HTTP response (i.e., the name of the host to which it
274274+ sent the corresponding HTTP request).
275275+276276+ The term request-uri is defined in Section 5.1.2 of [RFC2616].
277277+278278+279279+280280+281281+282282+Barth Standards Track [Page 5]
283283+284284+RFC 6265 HTTP State Management Mechanism April 2011
285285+286286+287287+ Two sequences of octets are said to case-insensitively match each
288288+ other if and only if they are equivalent under the i;ascii-casemap
289289+ collation defined in [RFC4790].
290290+291291+ The term string means a sequence of non-NUL octets.
292292+293293+3. Overview
294294+295295+ This section outlines a way for an origin server to send state
296296+ information to a user agent and for the user agent to return the
297297+ state information to the origin server.
298298+299299+ To store state, the origin server includes a Set-Cookie header in an
300300+ HTTP response. In subsequent requests, the user agent returns a
301301+ Cookie request header to the origin server. The Cookie header
302302+ contains cookies the user agent received in previous Set-Cookie
303303+ headers. The origin server is free to ignore the Cookie header or
304304+ use its contents for an application-defined purpose.
305305+306306+ Origin servers MAY send a Set-Cookie response header with any
307307+ response. User agents MAY ignore Set-Cookie headers contained in
308308+ responses with 100-level status codes but MUST process Set-Cookie
309309+ headers contained in other responses (including responses with 400-
310310+ and 500-level status codes). An origin server can include multiple
311311+ Set-Cookie header fields in a single response. The presence of a
312312+ Cookie or a Set-Cookie header field does not preclude HTTP caches
313313+ from storing and reusing a response.
314314+315315+ Origin servers SHOULD NOT fold multiple Set-Cookie header fields into
316316+ a single header field. The usual mechanism for folding HTTP headers
317317+ fields (i.e., as defined in [RFC2616]) might change the semantics of
318318+ the Set-Cookie header field because the %x2C (",") character is used
319319+ by Set-Cookie in a way that conflicts with such folding.
320320+321321+3.1. Examples
322322+323323+ Using the Set-Cookie header, a server can send the user agent a short
324324+ string in an HTTP response that the user agent will return in future
325325+ HTTP requests that are within the scope of the cookie. For example,
326326+ the server can send the user agent a "session identifier" named SID
327327+ with the value 31d4d96e407aad42. The user agent then returns the
328328+ session identifier in subsequent requests.
329329+330330+331331+332332+333333+334334+335335+336336+337337+338338+Barth Standards Track [Page 6]
339339+340340+RFC 6265 HTTP State Management Mechanism April 2011
341341+342342+343343+ == Server -> User Agent ==
344344+345345+ Set-Cookie: SID=31d4d96e407aad42
346346+347347+ == User Agent -> Server ==
348348+349349+ Cookie: SID=31d4d96e407aad42
350350+351351+ The server can alter the default scope of the cookie using the Path
352352+ and Domain attributes. For example, the server can instruct the user
353353+ agent to return the cookie to every path and every subdomain of
354354+ example.com.
355355+356356+ == Server -> User Agent ==
357357+358358+ Set-Cookie: SID=31d4d96e407aad42; Path=/; Domain=example.com
359359+360360+ == User Agent -> Server ==
361361+362362+ Cookie: SID=31d4d96e407aad42
363363+364364+ As shown in the next example, the server can store multiple cookies
365365+ at the user agent. For example, the server can store a session
366366+ identifier as well as the user's preferred language by returning two
367367+ Set-Cookie header fields. Notice that the server uses the Secure and
368368+ HttpOnly attributes to provide additional security protections for
369369+ the more sensitive session identifier (see Section 4.1.2.)
370370+371371+ == Server -> User Agent ==
372372+373373+ Set-Cookie: SID=31d4d96e407aad42; Path=/; Secure; HttpOnly
374374+ Set-Cookie: lang=en-US; Path=/; Domain=example.com
375375+376376+ == User Agent -> Server ==
377377+378378+ Cookie: SID=31d4d96e407aad42; lang=en-US
379379+380380+ Notice that the Cookie header above contains two cookies, one named
381381+ SID and one named lang. If the server wishes the user agent to
382382+ persist the cookie over multiple "sessions" (e.g., user agent
383383+ restarts), the server can specify an expiration date in the Expires
384384+ attribute. Note that the user agent might delete the cookie before
385385+ the expiration date if the user agent's cookie store exceeds its
386386+ quota or if the user manually deletes the server's cookie.
387387+388388+389389+390390+391391+392392+393393+394394+Barth Standards Track [Page 7]
395395+396396+RFC 6265 HTTP State Management Mechanism April 2011
397397+398398+399399+ == Server -> User Agent ==
400400+401401+ Set-Cookie: lang=en-US; Expires=Wed, 09 Jun 2021 10:18:14 GMT
402402+403403+ == User Agent -> Server ==
404404+405405+ Cookie: SID=31d4d96e407aad42; lang=en-US
406406+407407+ Finally, to remove a cookie, the server returns a Set-Cookie header
408408+ with an expiration date in the past. The server will be successful
409409+ in removing the cookie only if the Path and the Domain attribute in
410410+ the Set-Cookie header match the values used when the cookie was
411411+ created.
412412+413413+ == Server -> User Agent ==
414414+415415+ Set-Cookie: lang=; Expires=Sun, 06 Nov 1994 08:49:37 GMT
416416+417417+ == User Agent -> Server ==
418418+419419+ Cookie: SID=31d4d96e407aad42
420420+421421+4. Server Requirements
422422+423423+ This section describes the syntax and semantics of a well-behaved
424424+ profile of the Cookie and Set-Cookie headers.
425425+426426+4.1. Set-Cookie
427427+428428+ The Set-Cookie HTTP response header is used to send cookies from the
429429+ server to the user agent.
430430+431431+4.1.1. Syntax
432432+433433+ Informally, the Set-Cookie response header contains the header name
434434+ "Set-Cookie" followed by a ":" and a cookie. Each cookie begins with
435435+ a name-value-pair, followed by zero or more attribute-value pairs.
436436+ Servers SHOULD NOT send Set-Cookie headers that fail to conform to
437437+ the following grammar:
438438+439439+440440+441441+442442+443443+444444+445445+446446+447447+448448+449449+450450+Barth Standards Track [Page 8]
451451+452452+RFC 6265 HTTP State Management Mechanism April 2011
453453+454454+455455+ set-cookie-header = "Set-Cookie:" SP set-cookie-string
456456+ set-cookie-string = cookie-pair *( ";" SP cookie-av )
457457+ cookie-pair = cookie-name "=" cookie-value
458458+ cookie-name = token
459459+ cookie-value = *cookie-octet / ( DQUOTE *cookie-octet DQUOTE )
460460+ cookie-octet = %x21 / %x23-2B / %x2D-3A / %x3C-5B / %x5D-7E
461461+ ; US-ASCII characters excluding CTLs,
462462+ ; whitespace DQUOTE, comma, semicolon,
463463+ ; and backslash
464464+ token = <token, defined in [RFC2616], Section 2.2>
465465+466466+ cookie-av = expires-av / max-age-av / domain-av /
467467+ path-av / secure-av / httponly-av /
468468+ extension-av
469469+ expires-av = "Expires=" sane-cookie-date
470470+ sane-cookie-date = <rfc1123-date, defined in [RFC2616], Section 3.3.1>
471471+ max-age-av = "Max-Age=" non-zero-digit *DIGIT
472472+ ; In practice, both expires-av and max-age-av
473473+ ; are limited to dates representable by the
474474+ ; user agent.
475475+ non-zero-digit = %x31-39
476476+ ; digits 1 through 9
477477+ domain-av = "Domain=" domain-value
478478+ domain-value = <subdomain>
479479+ ; defined in [RFC1034], Section 3.5, as
480480+ ; enhanced by [RFC1123], Section 2.1
481481+ path-av = "Path=" path-value
482482+ path-value = <any CHAR except CTLs or ";">
483483+ secure-av = "Secure"
484484+ httponly-av = "HttpOnly"
485485+ extension-av = <any CHAR except CTLs or ";">
486486+487487+ Note that some of the grammatical terms above reference documents
488488+ that use different grammatical notations than this document (which
489489+ uses ABNF from [RFC5234]).
490490+491491+ The semantics of the cookie-value are not defined by this document.
492492+493493+ To maximize compatibility with user agents, servers that wish to
494494+ store arbitrary data in a cookie-value SHOULD encode that data, for
495495+ example, using Base64 [RFC4648].
496496+497497+ The portions of the set-cookie-string produced by the cookie-av term
498498+ are known as attributes. To maximize compatibility with user agents,
499499+ servers SHOULD NOT produce two attributes with the same name in the
500500+ same set-cookie-string. (See Section 5.3 for how user agents handle
501501+ this case.)
502502+503503+504504+505505+506506+Barth Standards Track [Page 9]
507507+508508+RFC 6265 HTTP State Management Mechanism April 2011
509509+510510+511511+ Servers SHOULD NOT include more than one Set-Cookie header field in
512512+ the same response with the same cookie-name. (See Section 5.2 for
513513+ how user agents handle this case.)
514514+515515+ If a server sends multiple responses containing Set-Cookie headers
516516+ concurrently to the user agent (e.g., when communicating with the
517517+ user agent over multiple sockets), these responses create a "race
518518+ condition" that can lead to unpredictable behavior.
519519+520520+ NOTE: Some existing user agents differ in their interpretation of
521521+ two-digit years. To avoid compatibility issues, servers SHOULD use
522522+ the rfc1123-date format, which requires a four-digit year.
523523+524524+ NOTE: Some user agents store and process dates in cookies as 32-bit
525525+ UNIX time_t values. Implementation bugs in the libraries supporting
526526+ time_t processing on some systems might cause such user agents to
527527+ process dates after the year 2038 incorrectly.
528528+529529+4.1.2. Semantics (Non-Normative)
530530+531531+ This section describes simplified semantics of the Set-Cookie header.
532532+ These semantics are detailed enough to be useful for understanding
533533+ the most common uses of cookies by servers. The full semantics are
534534+ described in Section 5.
535535+536536+ When the user agent receives a Set-Cookie header, the user agent
537537+ stores the cookie together with its attributes. Subsequently, when
538538+ the user agent makes an HTTP request, the user agent includes the
539539+ applicable, non-expired cookies in the Cookie header.
540540+541541+ If the user agent receives a new cookie with the same cookie-name,
542542+ domain-value, and path-value as a cookie that it has already stored,
543543+ the existing cookie is evicted and replaced with the new cookie.
544544+ Notice that servers can delete cookies by sending the user agent a
545545+ new cookie with an Expires attribute with a value in the past.
546546+547547+ Unless the cookie's attributes indicate otherwise, the cookie is
548548+ returned only to the origin server (and not, for example, to any
549549+ subdomains), and it expires at the end of the current session (as
550550+ defined by the user agent). User agents ignore unrecognized cookie
551551+ attributes (but not the entire cookie).
552552+553553+554554+555555+556556+557557+558558+559559+560560+561561+562562+Barth Standards Track [Page 10]
563563+564564+RFC 6265 HTTP State Management Mechanism April 2011
565565+566566+567567+4.1.2.1. The Expires Attribute
568568+569569+ The Expires attribute indicates the maximum lifetime of the cookie,
570570+ represented as the date and time at which the cookie expires. The
571571+ user agent is not required to retain the cookie until the specified
572572+ date has passed. In fact, user agents often evict cookies due to
573573+ memory pressure or privacy concerns.
574574+575575+4.1.2.2. The Max-Age Attribute
576576+577577+ The Max-Age attribute indicates the maximum lifetime of the cookie,
578578+ represented as the number of seconds until the cookie expires. The
579579+ user agent is not required to retain the cookie for the specified
580580+ duration. In fact, user agents often evict cookies due to memory
581581+ pressure or privacy concerns.
582582+583583+ NOTE: Some existing user agents do not support the Max-Age
584584+ attribute. User agents that do not support the Max-Age attribute
585585+ ignore the attribute.
586586+587587+ If a cookie has both the Max-Age and the Expires attribute, the Max-
588588+ Age attribute has precedence and controls the expiration date of the
589589+ cookie. If a cookie has neither the Max-Age nor the Expires
590590+ attribute, the user agent will retain the cookie until "the current
591591+ session is over" (as defined by the user agent).
592592+593593+4.1.2.3. The Domain Attribute
594594+595595+ The Domain attribute specifies those hosts to which the cookie will
596596+ be sent. For example, if the value of the Domain attribute is
597597+ "example.com", the user agent will include the cookie in the Cookie
598598+ header when making HTTP requests to example.com, www.example.com, and
599599+ www.corp.example.com. (Note that a leading %x2E ("."), if present,
600600+ is ignored even though that character is not permitted, but a
601601+ trailing %x2E ("."), if present, will cause the user agent to ignore
602602+ the attribute.) If the server omits the Domain attribute, the user
603603+ agent will return the cookie only to the origin server.
604604+605605+ WARNING: Some existing user agents treat an absent Domain
606606+ attribute as if the Domain attribute were present and contained
607607+ the current host name. For example, if example.com returns a Set-
608608+ Cookie header without a Domain attribute, these user agents will
609609+ erroneously send the cookie to www.example.com as well.
610610+611611+612612+613613+614614+615615+616616+617617+618618+Barth Standards Track [Page 11]
619619+620620+RFC 6265 HTTP State Management Mechanism April 2011
621621+622622+623623+ The user agent will reject cookies unless the Domain attribute
624624+ specifies a scope for the cookie that would include the origin
625625+ server. For example, the user agent will accept a cookie with a
626626+ Domain attribute of "example.com" or of "foo.example.com" from
627627+ foo.example.com, but the user agent will not accept a cookie with a
628628+ Domain attribute of "bar.example.com" or of "baz.foo.example.com".
629629+630630+ NOTE: For security reasons, many user agents are configured to reject
631631+ Domain attributes that correspond to "public suffixes". For example,
632632+ some user agents will reject Domain attributes of "com" or "co.uk".
633633+ (See Section 5.3 for more information.)
634634+635635+4.1.2.4. The Path Attribute
636636+637637+ The scope of each cookie is limited to a set of paths, controlled by
638638+ the Path attribute. If the server omits the Path attribute, the user
639639+ agent will use the "directory" of the request-uri's path component as
640640+ the default value. (See Section 5.1.4 for more details.)
641641+642642+ The user agent will include the cookie in an HTTP request only if the
643643+ path portion of the request-uri matches (or is a subdirectory of) the
644644+ cookie's Path attribute, where the %x2F ("/") character is
645645+ interpreted as a directory separator.
646646+647647+ Although seemingly useful for isolating cookies between different
648648+ paths within a given host, the Path attribute cannot be relied upon
649649+ for security (see Section 8).
650650+651651+4.1.2.5. The Secure Attribute
652652+653653+ The Secure attribute limits the scope of the cookie to "secure"
654654+ channels (where "secure" is defined by the user agent). When a
655655+ cookie has the Secure attribute, the user agent will include the
656656+ cookie in an HTTP request only if the request is transmitted over a
657657+ secure channel (typically HTTP over Transport Layer Security (TLS)
658658+ [RFC2818]).
659659+660660+ Although seemingly useful for protecting cookies from active network
661661+ attackers, the Secure attribute protects only the cookie's
662662+ confidentiality. An active network attacker can overwrite Secure
663663+ cookies from an insecure channel, disrupting their integrity (see
664664+ Section 8.6 for more details).
665665+666666+667667+668668+669669+670670+671671+672672+673673+674674+Barth Standards Track [Page 12]
675675+676676+RFC 6265 HTTP State Management Mechanism April 2011
677677+678678+679679+4.1.2.6. The HttpOnly Attribute
680680+681681+ The HttpOnly attribute limits the scope of the cookie to HTTP
682682+ requests. In particular, the attribute instructs the user agent to
683683+ omit the cookie when providing access to cookies via "non-HTTP" APIs
684684+ (such as a web browser API that exposes cookies to scripts).
685685+686686+ Note that the HttpOnly attribute is independent of the Secure
687687+ attribute: a cookie can have both the HttpOnly and the Secure
688688+ attribute.
689689+690690+4.2. Cookie
691691+692692+4.2.1. Syntax
693693+694694+ The user agent sends stored cookies to the origin server in the
695695+ Cookie header. If the server conforms to the requirements in
696696+ Section 4.1 (and the user agent conforms to the requirements in
697697+ Section 5), the user agent will send a Cookie header that conforms to
698698+ the following grammar:
699699+700700+ cookie-header = "Cookie:" OWS cookie-string OWS
701701+ cookie-string = cookie-pair *( ";" SP cookie-pair )
702702+703703+4.2.2. Semantics
704704+705705+ Each cookie-pair represents a cookie stored by the user agent. The
706706+ cookie-pair contains the cookie-name and cookie-value the user agent
707707+ received in the Set-Cookie header.
708708+709709+ Notice that the cookie attributes are not returned. In particular,
710710+ the server cannot determine from the Cookie header alone when a
711711+ cookie will expire, for which hosts the cookie is valid, for which
712712+ paths the cookie is valid, or whether the cookie was set with the
713713+ Secure or HttpOnly attributes.
714714+715715+ The semantics of individual cookies in the Cookie header are not
716716+ defined by this document. Servers are expected to imbue these
717717+ cookies with application-specific semantics.
718718+719719+ Although cookies are serialized linearly in the Cookie header,
720720+ servers SHOULD NOT rely upon the serialization order. In particular,
721721+ if the Cookie header contains two cookies with the same name (e.g.,
722722+ that were set with different Path or Domain attributes), servers
723723+ SHOULD NOT rely upon the order in which these cookies appear in the
724724+ header.
725725+726726+727727+728728+729729+730730+Barth Standards Track [Page 13]
731731+732732+RFC 6265 HTTP State Management Mechanism April 2011
733733+734734+735735+5. User Agent Requirements
736736+737737+ This section specifies the Cookie and Set-Cookie headers in
738738+ sufficient detail that a user agent implementing these requirements
739739+ precisely can interoperate with existing servers (even those that do
740740+ not conform to the well-behaved profile described in Section 4).
741741+742742+ A user agent could enforce more restrictions than those specified
743743+ herein (e.g., for the sake of improved security); however,
744744+ experiments have shown that such strictness reduces the likelihood
745745+ that a user agent will be able to interoperate with existing servers.
746746+747747+5.1. Subcomponent Algorithms
748748+749749+ This section defines some algorithms used by user agents to process
750750+ specific subcomponents of the Cookie and Set-Cookie headers.
751751+752752+5.1.1. Dates
753753+754754+ The user agent MUST use an algorithm equivalent to the following
755755+ algorithm to parse a cookie-date. Note that the various boolean
756756+ flags defined as a part of the algorithm (i.e., found-time, found-
757757+ day-of-month, found-month, found-year) are initially "not set".
758758+759759+ 1. Using the grammar below, divide the cookie-date into date-tokens.
760760+761761+ cookie-date = *delimiter date-token-list *delimiter
762762+ date-token-list = date-token *( 1*delimiter date-token )
763763+ date-token = 1*non-delimiter
764764+765765+ delimiter = %x09 / %x20-2F / %x3B-40 / %x5B-60 / %x7B-7E
766766+ non-delimiter = %x00-08 / %x0A-1F / DIGIT / ":" / ALPHA / %x7F-FF
767767+ non-digit = %x00-2F / %x3A-FF
768768+769769+ day-of-month = 1*2DIGIT ( non-digit *OCTET )
770770+ month = ( "jan" / "feb" / "mar" / "apr" /
771771+ "may" / "jun" / "jul" / "aug" /
772772+ "sep" / "oct" / "nov" / "dec" ) *OCTET
773773+ year = 2*4DIGIT ( non-digit *OCTET )
774774+ time = hms-time ( non-digit *OCTET )
775775+ hms-time = time-field ":" time-field ":" time-field
776776+ time-field = 1*2DIGIT
777777+778778+ 2. Process each date-token sequentially in the order the date-tokens
779779+ appear in the cookie-date:
780780+781781+782782+783783+784784+785785+786786+Barth Standards Track [Page 14]
787787+788788+RFC 6265 HTTP State Management Mechanism April 2011
789789+790790+791791+ 1. If the found-time flag is not set and the token matches the
792792+ time production, set the found-time flag and set the hour-
793793+ value, minute-value, and second-value to the numbers denoted
794794+ by the digits in the date-token, respectively. Skip the
795795+ remaining sub-steps and continue to the next date-token.
796796+797797+ 2. If the found-day-of-month flag is not set and the date-token
798798+ matches the day-of-month production, set the found-day-of-
799799+ month flag and set the day-of-month-value to the number
800800+ denoted by the date-token. Skip the remaining sub-steps and
801801+ continue to the next date-token.
802802+803803+ 3. If the found-month flag is not set and the date-token matches
804804+ the month production, set the found-month flag and set the
805805+ month-value to the month denoted by the date-token. Skip the
806806+ remaining sub-steps and continue to the next date-token.
807807+808808+ 4. If the found-year flag is not set and the date-token matches
809809+ the year production, set the found-year flag and set the
810810+ year-value to the number denoted by the date-token. Skip the
811811+ remaining sub-steps and continue to the next date-token.
812812+813813+ 3. If the year-value is greater than or equal to 70 and less than or
814814+ equal to 99, increment the year-value by 1900.
815815+816816+ 4. If the year-value is greater than or equal to 0 and less than or
817817+ equal to 69, increment the year-value by 2000.
818818+819819+ 1. NOTE: Some existing user agents interpret two-digit years
820820+ differently.
821821+822822+ 5. Abort these steps and fail to parse the cookie-date if:
823823+824824+ * at least one of the found-day-of-month, found-month, found-
825825+ year, or found-time flags is not set,
826826+827827+ * the day-of-month-value is less than 1 or greater than 31,
828828+829829+ * the year-value is less than 1601,
830830+831831+ * the hour-value is greater than 23,
832832+833833+ * the minute-value is greater than 59, or
834834+835835+ * the second-value is greater than 59.
836836+837837+ (Note that leap seconds cannot be represented in this syntax.)
838838+839839+840840+841841+842842+Barth Standards Track [Page 15]
843843+844844+RFC 6265 HTTP State Management Mechanism April 2011
845845+846846+847847+ 6. Let the parsed-cookie-date be the date whose day-of-month, month,
848848+ year, hour, minute, and second (in UTC) are the day-of-month-
849849+ value, the month-value, the year-value, the hour-value, the
850850+ minute-value, and the second-value, respectively. If no such
851851+ date exists, abort these steps and fail to parse the cookie-date.
852852+853853+ 7. Return the parsed-cookie-date as the result of this algorithm.
854854+855855+5.1.2. Canonicalized Host Names
856856+857857+ A canonicalized host name is the string generated by the following
858858+ algorithm:
859859+860860+ 1. Convert the host name to a sequence of individual domain name
861861+ labels.
862862+863863+ 2. Convert each label that is not a Non-Reserved LDH (NR-LDH) label,
864864+ to an A-label (see Section 2.3.2.1 of [RFC5890] for the former
865865+ and latter), or to a "punycode label" (a label resulting from the
866866+ "ToASCII" conversion in Section 4 of [RFC3490]), as appropriate
867867+ (see Section 6.3 of this specification).
868868+869869+ 3. Concatenate the resulting labels, separated by a %x2E (".")
870870+ character.
871871+872872+5.1.3. Domain Matching
873873+874874+ A string domain-matches a given domain string if at least one of the
875875+ following conditions hold:
876876+877877+ o The domain string and the string are identical. (Note that both
878878+ the domain string and the string will have been canonicalized to
879879+ lower case at this point.)
880880+881881+ o All of the following conditions hold:
882882+883883+ * The domain string is a suffix of the string.
884884+885885+ * The last character of the string that is not included in the
886886+ domain string is a %x2E (".") character.
887887+888888+ * The string is a host name (i.e., not an IP address).
889889+890890+5.1.4. Paths and Path-Match
891891+892892+ The user agent MUST use an algorithm equivalent to the following
893893+ algorithm to compute the default-path of a cookie:
894894+895895+896896+897897+898898+Barth Standards Track [Page 16]
899899+900900+RFC 6265 HTTP State Management Mechanism April 2011
901901+902902+903903+ 1. Let uri-path be the path portion of the request-uri if such a
904904+ portion exists (and empty otherwise). For example, if the
905905+ request-uri contains just a path (and optional query string),
906906+ then the uri-path is that path (without the %x3F ("?") character
907907+ or query string), and if the request-uri contains a full
908908+ absoluteURI, the uri-path is the path component of that URI.
909909+910910+ 2. If the uri-path is empty or if the first character of the uri-
911911+ path is not a %x2F ("/") character, output %x2F ("/") and skip
912912+ the remaining steps.
913913+914914+ 3. If the uri-path contains no more than one %x2F ("/") character,
915915+ output %x2F ("/") and skip the remaining step.
916916+917917+ 4. Output the characters of the uri-path from the first character up
918918+ to, but not including, the right-most %x2F ("/").
919919+920920+ A request-path path-matches a given cookie-path if at least one of
921921+ the following conditions holds:
922922+923923+ o The cookie-path and the request-path are identical.
924924+925925+ o The cookie-path is a prefix of the request-path, and the last
926926+ character of the cookie-path is %x2F ("/").
927927+928928+ o The cookie-path is a prefix of the request-path, and the first
929929+ character of the request-path that is not included in the cookie-
930930+ path is a %x2F ("/") character.
931931+932932+5.2. The Set-Cookie Header
933933+934934+ When a user agent receives a Set-Cookie header field in an HTTP
935935+ response, the user agent MAY ignore the Set-Cookie header field in
936936+ its entirety. For example, the user agent might wish to block
937937+ responses to "third-party" requests from setting cookies (see
938938+ Section 7.1).
939939+940940+ If the user agent does not ignore the Set-Cookie header field in its
941941+ entirety, the user agent MUST parse the field-value of the Set-Cookie
942942+ header field as a set-cookie-string (defined below).
943943+944944+ NOTE: The algorithm below is more permissive than the grammar in
945945+ Section 4.1. For example, the algorithm strips leading and trailing
946946+ whitespace from the cookie name and value (but maintains internal
947947+ whitespace), whereas the grammar in Section 4.1 forbids whitespace in
948948+ these positions. User agents use this algorithm so as to
949949+ interoperate with servers that do not follow the recommendations in
950950+ Section 4.
951951+952952+953953+954954+Barth Standards Track [Page 17]
955955+956956+RFC 6265 HTTP State Management Mechanism April 2011
957957+958958+959959+ A user agent MUST use an algorithm equivalent to the following
960960+ algorithm to parse a "set-cookie-string":
961961+962962+ 1. If the set-cookie-string contains a %x3B (";") character:
963963+964964+ The name-value-pair string consists of the characters up to,
965965+ but not including, the first %x3B (";"), and the unparsed-
966966+ attributes consist of the remainder of the set-cookie-string
967967+ (including the %x3B (";") in question).
968968+969969+ Otherwise:
970970+971971+ The name-value-pair string consists of all the characters
972972+ contained in the set-cookie-string, and the unparsed-
973973+ attributes is the empty string.
974974+975975+ 2. If the name-value-pair string lacks a %x3D ("=") character,
976976+ ignore the set-cookie-string entirely.
977977+978978+ 3. The (possibly empty) name string consists of the characters up
979979+ to, but not including, the first %x3D ("=") character, and the
980980+ (possibly empty) value string consists of the characters after
981981+ the first %x3D ("=") character.
982982+983983+ 4. Remove any leading or trailing WSP characters from the name
984984+ string and the value string.
985985+986986+ 5. If the name string is empty, ignore the set-cookie-string
987987+ entirely.
988988+989989+ 6. The cookie-name is the name string, and the cookie-value is the
990990+ value string.
991991+992992+ The user agent MUST use an algorithm equivalent to the following
993993+ algorithm to parse the unparsed-attributes:
994994+995995+ 1. If the unparsed-attributes string is empty, skip the rest of
996996+ these steps.
997997+998998+ 2. Discard the first character of the unparsed-attributes (which
999999+ will be a %x3B (";") character).
10001000+10011001+ 3. If the remaining unparsed-attributes contains a %x3B (";")
10021002+ character:
10031003+10041004+ Consume the characters of the unparsed-attributes up to, but
10051005+ not including, the first %x3B (";") character.
10061006+10071007+10081008+10091009+10101010+Barth Standards Track [Page 18]
10111011+10121012+RFC 6265 HTTP State Management Mechanism April 2011
10131013+10141014+10151015+ Otherwise:
10161016+10171017+ Consume the remainder of the unparsed-attributes.
10181018+10191019+ Let the cookie-av string be the characters consumed in this step.
10201020+10211021+ 4. If the cookie-av string contains a %x3D ("=") character:
10221022+10231023+ The (possibly empty) attribute-name string consists of the
10241024+ characters up to, but not including, the first %x3D ("=")
10251025+ character, and the (possibly empty) attribute-value string
10261026+ consists of the characters after the first %x3D ("=")
10271027+ character.
10281028+10291029+ Otherwise:
10301030+10311031+ The attribute-name string consists of the entire cookie-av
10321032+ string, and the attribute-value string is empty.
10331033+10341034+ 5. Remove any leading or trailing WSP characters from the attribute-
10351035+ name string and the attribute-value string.
10361036+10371037+ 6. Process the attribute-name and attribute-value according to the
10381038+ requirements in the following subsections. (Notice that
10391039+ attributes with unrecognized attribute-names are ignored.)
10401040+10411041+ 7. Return to Step 1 of this algorithm.
10421042+10431043+ When the user agent finishes parsing the set-cookie-string, the user
10441044+ agent is said to "receive a cookie" from the request-uri with name
10451045+ cookie-name, value cookie-value, and attributes cookie-attribute-
10461046+ list. (See Section 5.3 for additional requirements triggered by
10471047+ receiving a cookie.)
10481048+10491049+5.2.1. The Expires Attribute
10501050+10511051+ If the attribute-name case-insensitively matches the string
10521052+ "Expires", the user agent MUST process the cookie-av as follows.
10531053+10541054+ Let the expiry-time be the result of parsing the attribute-value as
10551055+ cookie-date (see Section 5.1.1).
10561056+10571057+ If the attribute-value failed to parse as a cookie date, ignore the
10581058+ cookie-av.
10591059+10601060+ If the expiry-time is later than the last date the user agent can
10611061+ represent, the user agent MAY replace the expiry-time with the last
10621062+ representable date.
10631063+10641064+10651065+10661066+Barth Standards Track [Page 19]
10671067+10681068+RFC 6265 HTTP State Management Mechanism April 2011
10691069+10701070+10711071+ If the expiry-time is earlier than the earliest date the user agent
10721072+ can represent, the user agent MAY replace the expiry-time with the
10731073+ earliest representable date.
10741074+10751075+ Append an attribute to the cookie-attribute-list with an attribute-
10761076+ name of Expires and an attribute-value of expiry-time.
10771077+10781078+5.2.2. The Max-Age Attribute
10791079+10801080+ If the attribute-name case-insensitively matches the string "Max-
10811081+ Age", the user agent MUST process the cookie-av as follows.
10821082+10831083+ If the first character of the attribute-value is not a DIGIT or a "-"
10841084+ character, ignore the cookie-av.
10851085+10861086+ If the remainder of attribute-value contains a non-DIGIT character,
10871087+ ignore the cookie-av.
10881088+10891089+ Let delta-seconds be the attribute-value converted to an integer.
10901090+10911091+ If delta-seconds is less than or equal to zero (0), let expiry-time
10921092+ be the earliest representable date and time. Otherwise, let the
10931093+ expiry-time be the current date and time plus delta-seconds seconds.
10941094+10951095+ Append an attribute to the cookie-attribute-list with an attribute-
10961096+ name of Max-Age and an attribute-value of expiry-time.
10971097+10981098+5.2.3. The Domain Attribute
10991099+11001100+ If the attribute-name case-insensitively matches the string "Domain",
11011101+ the user agent MUST process the cookie-av as follows.
11021102+11031103+ If the attribute-value is empty, the behavior is undefined. However,
11041104+ the user agent SHOULD ignore the cookie-av entirely.
11051105+11061106+ If the first character of the attribute-value string is %x2E ("."):
11071107+11081108+ Let cookie-domain be the attribute-value without the leading %x2E
11091109+ (".") character.
11101110+11111111+ Otherwise:
11121112+11131113+ Let cookie-domain be the entire attribute-value.
11141114+11151115+ Convert the cookie-domain to lower case.
11161116+11171117+ Append an attribute to the cookie-attribute-list with an attribute-
11181118+ name of Domain and an attribute-value of cookie-domain.
11191119+11201120+11211121+11221122+Barth Standards Track [Page 20]
11231123+11241124+RFC 6265 HTTP State Management Mechanism April 2011
11251125+11261126+11271127+5.2.4. The Path Attribute
11281128+11291129+ If the attribute-name case-insensitively matches the string "Path",
11301130+ the user agent MUST process the cookie-av as follows.
11311131+11321132+ If the attribute-value is empty or if the first character of the
11331133+ attribute-value is not %x2F ("/"):
11341134+11351135+ Let cookie-path be the default-path.
11361136+11371137+ Otherwise:
11381138+11391139+ Let cookie-path be the attribute-value.
11401140+11411141+ Append an attribute to the cookie-attribute-list with an attribute-
11421142+ name of Path and an attribute-value of cookie-path.
11431143+11441144+5.2.5. The Secure Attribute
11451145+11461146+ If the attribute-name case-insensitively matches the string "Secure",
11471147+ the user agent MUST append an attribute to the cookie-attribute-list
11481148+ with an attribute-name of Secure and an empty attribute-value.
11491149+11501150+5.2.6. The HttpOnly Attribute
11511151+11521152+ If the attribute-name case-insensitively matches the string
11531153+ "HttpOnly", the user agent MUST append an attribute to the cookie-
11541154+ attribute-list with an attribute-name of HttpOnly and an empty
11551155+ attribute-value.
11561156+11571157+5.3. Storage Model
11581158+11591159+ The user agent stores the following fields about each cookie: name,
11601160+ value, expiry-time, domain, path, creation-time, last-access-time,
11611161+ persistent-flag, host-only-flag, secure-only-flag, and http-only-
11621162+ flag.
11631163+11641164+ When the user agent "receives a cookie" from a request-uri with name
11651165+ cookie-name, value cookie-value, and attributes cookie-attribute-
11661166+ list, the user agent MUST process the cookie as follows:
11671167+11681168+ 1. A user agent MAY ignore a received cookie in its entirety. For
11691169+ example, the user agent might wish to block receiving cookies
11701170+ from "third-party" responses or the user agent might not wish to
11711171+ store cookies that exceed some size.
11721172+11731173+11741174+11751175+11761176+11771177+11781178+Barth Standards Track [Page 21]
11791179+11801180+RFC 6265 HTTP State Management Mechanism April 2011
11811181+11821182+11831183+ 2. Create a new cookie with name cookie-name, value cookie-value.
11841184+ Set the creation-time and the last-access-time to the current
11851185+ date and time.
11861186+11871187+ 3. If the cookie-attribute-list contains an attribute with an
11881188+ attribute-name of "Max-Age":
11891189+11901190+ Set the cookie's persistent-flag to true.
11911191+11921192+ Set the cookie's expiry-time to attribute-value of the last
11931193+ attribute in the cookie-attribute-list with an attribute-name
11941194+ of "Max-Age".
11951195+11961196+ Otherwise, if the cookie-attribute-list contains an attribute
11971197+ with an attribute-name of "Expires" (and does not contain an
11981198+ attribute with an attribute-name of "Max-Age"):
11991199+12001200+ Set the cookie's persistent-flag to true.
12011201+12021202+ Set the cookie's expiry-time to attribute-value of the last
12031203+ attribute in the cookie-attribute-list with an attribute-name
12041204+ of "Expires".
12051205+12061206+ Otherwise:
12071207+12081208+ Set the cookie's persistent-flag to false.
12091209+12101210+ Set the cookie's expiry-time to the latest representable
12111211+ date.
12121212+12131213+ 4. If the cookie-attribute-list contains an attribute with an
12141214+ attribute-name of "Domain":
12151215+12161216+ Let the domain-attribute be the attribute-value of the last
12171217+ attribute in the cookie-attribute-list with an attribute-name
12181218+ of "Domain".
12191219+12201220+ Otherwise:
12211221+12221222+ Let the domain-attribute be the empty string.
12231223+12241224+ 5. If the user agent is configured to reject "public suffixes" and
12251225+ the domain-attribute is a public suffix:
12261226+12271227+ If the domain-attribute is identical to the canonicalized
12281228+ request-host:
12291229+12301230+ Let the domain-attribute be the empty string.
12311231+12321232+12331233+12341234+Barth Standards Track [Page 22]
12351235+12361236+RFC 6265 HTTP State Management Mechanism April 2011
12371237+12381238+12391239+ Otherwise:
12401240+12411241+ Ignore the cookie entirely and abort these steps.
12421242+12431243+ NOTE: A "public suffix" is a domain that is controlled by a
12441244+ public registry, such as "com", "co.uk", and "pvt.k12.wy.us".
12451245+ This step is essential for preventing attacker.com from
12461246+ disrupting the integrity of example.com by setting a cookie
12471247+ with a Domain attribute of "com". Unfortunately, the set of
12481248+ public suffixes (also known as "registry controlled domains")
12491249+ changes over time. If feasible, user agents SHOULD use an
12501250+ up-to-date public suffix list, such as the one maintained by
12511251+ the Mozilla project at <http://publicsuffix.org/>.
12521252+12531253+ 6. If the domain-attribute is non-empty:
12541254+12551255+ If the canonicalized request-host does not domain-match the
12561256+ domain-attribute:
12571257+12581258+ Ignore the cookie entirely and abort these steps.
12591259+12601260+ Otherwise:
12611261+12621262+ Set the cookie's host-only-flag to false.
12631263+12641264+ Set the cookie's domain to the domain-attribute.
12651265+12661266+ Otherwise:
12671267+12681268+ Set the cookie's host-only-flag to true.
12691269+12701270+ Set the cookie's domain to the canonicalized request-host.
12711271+12721272+ 7. If the cookie-attribute-list contains an attribute with an
12731273+ attribute-name of "Path", set the cookie's path to attribute-
12741274+ value of the last attribute in the cookie-attribute-list with an
12751275+ attribute-name of "Path". Otherwise, set the cookie's path to
12761276+ the default-path of the request-uri.
12771277+12781278+ 8. If the cookie-attribute-list contains an attribute with an
12791279+ attribute-name of "Secure", set the cookie's secure-only-flag to
12801280+ true. Otherwise, set the cookie's secure-only-flag to false.
12811281+12821282+ 9. If the cookie-attribute-list contains an attribute with an
12831283+ attribute-name of "HttpOnly", set the cookie's http-only-flag to
12841284+ true. Otherwise, set the cookie's http-only-flag to false.
12851285+12861286+12871287+12881288+12891289+12901290+Barth Standards Track [Page 23]
12911291+12921292+RFC 6265 HTTP State Management Mechanism April 2011
12931293+12941294+12951295+ 10. If the cookie was received from a "non-HTTP" API and the
12961296+ cookie's http-only-flag is set, abort these steps and ignore the
12971297+ cookie entirely.
12981298+12991299+ 11. If the cookie store contains a cookie with the same name,
13001300+ domain, and path as the newly created cookie:
13011301+13021302+ 1. Let old-cookie be the existing cookie with the same name,
13031303+ domain, and path as the newly created cookie. (Notice that
13041304+ this algorithm maintains the invariant that there is at most
13051305+ one such cookie.)
13061306+13071307+ 2. If the newly created cookie was received from a "non-HTTP"
13081308+ API and the old-cookie's http-only-flag is set, abort these
13091309+ steps and ignore the newly created cookie entirely.
13101310+13111311+ 3. Update the creation-time of the newly created cookie to
13121312+ match the creation-time of the old-cookie.
13131313+13141314+ 4. Remove the old-cookie from the cookie store.
13151315+13161316+ 12. Insert the newly created cookie into the cookie store.
13171317+13181318+ A cookie is "expired" if the cookie has an expiry date in the past.
13191319+13201320+ The user agent MUST evict all expired cookies from the cookie store
13211321+ if, at any time, an expired cookie exists in the cookie store.
13221322+13231323+ At any time, the user agent MAY "remove excess cookies" from the
13241324+ cookie store if the number of cookies sharing a domain field exceeds
13251325+ some implementation-defined upper bound (such as 50 cookies).
13261326+13271327+ At any time, the user agent MAY "remove excess cookies" from the
13281328+ cookie store if the cookie store exceeds some predetermined upper
13291329+ bound (such as 3000 cookies).
13301330+13311331+ When the user agent removes excess cookies from the cookie store, the
13321332+ user agent MUST evict cookies in the following priority order:
13331333+13341334+ 1. Expired cookies.
13351335+13361336+ 2. Cookies that share a domain field with more than a predetermined
13371337+ number of other cookies.
13381338+13391339+ 3. All cookies.
13401340+13411341+ If two cookies have the same removal priority, the user agent MUST
13421342+ evict the cookie with the earliest last-access date first.
13431343+13441344+13451345+13461346+Barth Standards Track [Page 24]
13471347+13481348+RFC 6265 HTTP State Management Mechanism April 2011
13491349+13501350+13511351+ When "the current session is over" (as defined by the user agent),
13521352+ the user agent MUST remove from the cookie store all cookies with the
13531353+ persistent-flag set to false.
13541354+13551355+5.4. The Cookie Header
13561356+13571357+ The user agent includes stored cookies in the Cookie HTTP request
13581358+ header.
13591359+13601360+ When the user agent generates an HTTP request, the user agent MUST
13611361+ NOT attach more than one Cookie header field.
13621362+13631363+ A user agent MAY omit the Cookie header in its entirety. For
13641364+ example, the user agent might wish to block sending cookies during
13651365+ "third-party" requests from setting cookies (see Section 7.1).
13661366+13671367+ If the user agent does attach a Cookie header field to an HTTP
13681368+ request, the user agent MUST send the cookie-string (defined below)
13691369+ as the value of the header field.
13701370+13711371+ The user agent MUST use an algorithm equivalent to the following
13721372+ algorithm to compute the "cookie-string" from a cookie store and a
13731373+ request-uri:
13741374+13751375+ 1. Let cookie-list be the set of cookies from the cookie store that
13761376+ meets all of the following requirements:
13771377+13781378+ * Either:
13791379+13801380+ The cookie's host-only-flag is true and the canonicalized
13811381+ request-host is identical to the cookie's domain.
13821382+13831383+ Or:
13841384+13851385+ The cookie's host-only-flag is false and the canonicalized
13861386+ request-host domain-matches the cookie's domain.
13871387+13881388+ * The request-uri's path path-matches the cookie's path.
13891389+13901390+ * If the cookie's secure-only-flag is true, then the request-
13911391+ uri's scheme must denote a "secure" protocol (as defined by
13921392+ the user agent).
13931393+13941394+ NOTE: The notion of a "secure" protocol is not defined by
13951395+ this document. Typically, user agents consider a protocol
13961396+ secure if the protocol makes use of transport-layer
13971397+13981398+13991399+14001400+14011401+14021402+Barth Standards Track [Page 25]
14031403+14041404+RFC 6265 HTTP State Management Mechanism April 2011
14051405+14061406+14071407+ security, such as SSL or TLS. For example, most user
14081408+ agents consider "https" to be a scheme that denotes a
14091409+ secure protocol.
14101410+14111411+ * If the cookie's http-only-flag is true, then exclude the
14121412+ cookie if the cookie-string is being generated for a "non-
14131413+ HTTP" API (as defined by the user agent).
14141414+14151415+ 2. The user agent SHOULD sort the cookie-list in the following
14161416+ order:
14171417+14181418+ * Cookies with longer paths are listed before cookies with
14191419+ shorter paths.
14201420+14211421+ * Among cookies that have equal-length path fields, cookies with
14221422+ earlier creation-times are listed before cookies with later
14231423+ creation-times.
14241424+14251425+ NOTE: Not all user agents sort the cookie-list in this order, but
14261426+ this order reflects common practice when this document was
14271427+ written, and, historically, there have been servers that
14281428+ (erroneously) depended on this order.
14291429+14301430+ 3. Update the last-access-time of each cookie in the cookie-list to
14311431+ the current date and time.
14321432+14331433+ 4. Serialize the cookie-list into a cookie-string by processing each
14341434+ cookie in the cookie-list in order:
14351435+14361436+ 1. Output the cookie's name, the %x3D ("=") character, and the
14371437+ cookie's value.
14381438+14391439+ 2. If there is an unprocessed cookie in the cookie-list, output
14401440+ the characters %x3B and %x20 ("; ").
14411441+14421442+ NOTE: Despite its name, the cookie-string is actually a sequence of
14431443+ octets, not a sequence of characters. To convert the cookie-string
14441444+ (or components thereof) into a sequence of characters (e.g., for
14451445+ presentation to the user), the user agent might wish to try using the
14461446+ UTF-8 character encoding [RFC3629] to decode the octet sequence.
14471447+ This decoding might fail, however, because not every sequence of
14481448+ octets is valid UTF-8.
14491449+14501450+14511451+14521452+14531453+14541454+14551455+14561456+14571457+14581458+Barth Standards Track [Page 26]
14591459+14601460+RFC 6265 HTTP State Management Mechanism April 2011
14611461+14621462+14631463+6. Implementation Considerations
14641464+14651465+6.1. Limits
14661466+14671467+ Practical user agent implementations have limits on the number and
14681468+ size of cookies that they can store. General-use user agents SHOULD
14691469+ provide each of the following minimum capabilities:
14701470+14711471+ o At least 4096 bytes per cookie (as measured by the sum of the
14721472+ length of the cookie's name, value, and attributes).
14731473+14741474+ o At least 50 cookies per domain.
14751475+14761476+ o At least 3000 cookies total.
14771477+14781478+ Servers SHOULD use as few and as small cookies as possible to avoid
14791479+ reaching these implementation limits and to minimize network
14801480+ bandwidth due to the Cookie header being included in every request.
14811481+14821482+ Servers SHOULD gracefully degrade if the user agent fails to return
14831483+ one or more cookies in the Cookie header because the user agent might
14841484+ evict any cookie at any time on orders from the user.
14851485+14861486+6.2. Application Programming Interfaces
14871487+14881488+ One reason the Cookie and Set-Cookie headers use such esoteric syntax
14891489+ is that many platforms (both in servers and user agents) provide a
14901490+ string-based application programming interface (API) to cookies,
14911491+ requiring application-layer programmers to generate and parse the
14921492+ syntax used by the Cookie and Set-Cookie headers, which many
14931493+ programmers have done incorrectly, resulting in interoperability
14941494+ problems.
14951495+14961496+ Instead of providing string-based APIs to cookies, platforms would be
14971497+ well-served by providing more semantic APIs. It is beyond the scope
14981498+ of this document to recommend specific API designs, but there are
14991499+ clear benefits to accepting an abstract "Date" object instead of a
15001500+ serialized date string.
15011501+15021502+6.3. IDNA Dependency and Migration
15031503+15041504+ IDNA2008 [RFC5890] supersedes IDNA2003 [RFC3490]. However, there are
15051505+ differences between the two specifications, and thus there can be
15061506+ differences in processing (e.g., converting) domain name labels that
15071507+ have been registered under one from those registered under the other.
15081508+ There will be a transition period of some time during which IDNA2003-
15091509+ based domain name labels will exist in the wild. User agents SHOULD
15101510+ implement IDNA2008 [RFC5890] and MAY implement [UTS46] or [RFC5895]
15111511+15121512+15131513+15141514+Barth Standards Track [Page 27]
15151515+15161516+RFC 6265 HTTP State Management Mechanism April 2011
15171517+15181518+15191519+ in order to facilitate their IDNA transition. If a user agent does
15201520+ not implement IDNA2008, the user agent MUST implement IDNA2003
15211521+ [RFC3490].
15221522+15231523+7. Privacy Considerations
15241524+15251525+ Cookies are often criticized for letting servers track users. For
15261526+ example, a number of "web analytics" companies use cookies to
15271527+ recognize when a user returns to a web site or visits another web
15281528+ site. Although cookies are not the only mechanism servers can use to
15291529+ track users across HTTP requests, cookies facilitate tracking because
15301530+ they are persistent across user agent sessions and can be shared
15311531+ between hosts.
15321532+15331533+7.1. Third-Party Cookies
15341534+15351535+ Particularly worrisome are so-called "third-party" cookies. In
15361536+ rendering an HTML document, a user agent often requests resources
15371537+ from other servers (such as advertising networks). These third-party
15381538+ servers can use cookies to track the user even if the user never
15391539+ visits the server directly. For example, if a user visits a site
15401540+ that contains content from a third party and then later visits
15411541+ another site that contains content from the same third party, the
15421542+ third party can track the user between the two sites.
15431543+15441544+ Some user agents restrict how third-party cookies behave. For
15451545+ example, some of these user agents refuse to send the Cookie header
15461546+ in third-party requests. Others refuse to process the Set-Cookie
15471547+ header in responses to third-party requests. User agents vary widely
15481548+ in their third-party cookie policies. This document grants user
15491549+ agents wide latitude to experiment with third-party cookie policies
15501550+ that balance the privacy and compatibility needs of their users.
15511551+ However, this document does not endorse any particular third-party
15521552+ cookie policy.
15531553+15541554+ Third-party cookie blocking policies are often ineffective at
15551555+ achieving their privacy goals if servers attempt to work around their
15561556+ restrictions to track users. In particular, two collaborating
15571557+ servers can often track users without using cookies at all by
15581558+ injecting identifying information into dynamic URLs.
15591559+15601560+7.2. User Controls
15611561+15621562+ User agents SHOULD provide users with a mechanism for managing the
15631563+ cookies stored in the cookie store. For example, a user agent might
15641564+ let users delete all cookies received during a specified time period
15651565+15661566+15671567+15681568+15691569+15701570+Barth Standards Track [Page 28]
15711571+15721572+RFC 6265 HTTP State Management Mechanism April 2011
15731573+15741574+15751575+ or all the cookies related to a particular domain. In addition, many
15761576+ user agents include a user interface element that lets users examine
15771577+ the cookies stored in their cookie store.
15781578+15791579+ User agents SHOULD provide users with a mechanism for disabling
15801580+ cookies. When cookies are disabled, the user agent MUST NOT include
15811581+ a Cookie header in outbound HTTP requests and the user agent MUST NOT
15821582+ process Set-Cookie headers in inbound HTTP responses.
15831583+15841584+ Some user agents provide users the option of preventing persistent
15851585+ storage of cookies across sessions. When configured thusly, user
15861586+ agents MUST treat all received cookies as if the persistent-flag were
15871587+ set to false. Some popular user agents expose this functionality via
15881588+ "private browsing" mode [Aggarwal2010].
15891589+15901590+ Some user agents provide users with the ability to approve individual
15911591+ writes to the cookie store. In many common usage scenarios, these
15921592+ controls generate a large number of prompts. However, some privacy-
15931593+ conscious users find these controls useful nonetheless.
15941594+15951595+7.3. Expiration Dates
15961596+15971597+ Although servers can set the expiration date for cookies to the
15981598+ distant future, most user agents do not actually retain cookies for
15991599+ multiple decades. Rather than choosing gratuitously long expiration
16001600+ periods, servers SHOULD promote user privacy by selecting reasonable
16011601+ cookie expiration periods based on the purpose of the cookie. For
16021602+ example, a typical session identifier might reasonably be set to
16031603+ expire in two weeks.
16041604+16051605+8. Security Considerations
16061606+16071607+8.1. Overview
16081608+16091609+ Cookies have a number of security pitfalls. This section overviews a
16101610+ few of the more salient issues.
16111611+16121612+ In particular, cookies encourage developers to rely on ambient
16131613+ authority for authentication, often becoming vulnerable to attacks
16141614+ such as cross-site request forgery [CSRF]. Also, when storing
16151615+ session identifiers in cookies, developers often create session
16161616+ fixation vulnerabilities.
16171617+16181618+ Transport-layer encryption, such as that employed in HTTPS, is
16191619+ insufficient to prevent a network attacker from obtaining or altering
16201620+ a victim's cookies because the cookie protocol itself has various
16211621+ vulnerabilities (see "Weak Confidentiality" and "Weak Integrity",
16221622+16231623+16241624+16251625+16261626+Barth Standards Track [Page 29]
16271627+16281628+RFC 6265 HTTP State Management Mechanism April 2011
16291629+16301630+16311631+ below). In addition, by default, cookies do not provide
16321632+ confidentiality or integrity from network attackers, even when used
16331633+ in conjunction with HTTPS.
16341634+16351635+8.2. Ambient Authority
16361636+16371637+ A server that uses cookies to authenticate users can suffer security
16381638+ vulnerabilities because some user agents let remote parties issue
16391639+ HTTP requests from the user agent (e.g., via HTTP redirects or HTML
16401640+ forms). When issuing those requests, user agents attach cookies even
16411641+ if the remote party does not know the contents of the cookies,
16421642+ potentially letting the remote party exercise authority at an unwary
16431643+ server.
16441644+16451645+ Although this security concern goes by a number of names (e.g.,
16461646+ cross-site request forgery, confused deputy), the issue stems from
16471647+ cookies being a form of ambient authority. Cookies encourage server
16481648+ operators to separate designation (in the form of URLs) from
16491649+ authorization (in the form of cookies). Consequently, the user agent
16501650+ might supply the authorization for a resource designated by the
16511651+ attacker, possibly causing the server or its clients to undertake
16521652+ actions designated by the attacker as though they were authorized by
16531653+ the user.
16541654+16551655+ Instead of using cookies for authorization, server operators might
16561656+ wish to consider entangling designation and authorization by treating
16571657+ URLs as capabilities. Instead of storing secrets in cookies, this
16581658+ approach stores secrets in URLs, requiring the remote entity to
16591659+ supply the secret itself. Although this approach is not a panacea,
16601660+ judicious application of these principles can lead to more robust
16611661+ security.
16621662+16631663+8.3. Clear Text
16641664+16651665+ Unless sent over a secure channel (such as TLS), the information in
16661666+ the Cookie and Set-Cookie headers is transmitted in the clear.
16671667+16681668+ 1. All sensitive information conveyed in these headers is exposed to
16691669+ an eavesdropper.
16701670+16711671+ 2. A malicious intermediary could alter the headers as they travel
16721672+ in either direction, with unpredictable results.
16731673+16741674+ 3. A malicious client could alter the Cookie header before
16751675+ transmission, with unpredictable results.
16761676+16771677+16781678+16791679+16801680+16811681+16821682+Barth Standards Track [Page 30]
16831683+16841684+RFC 6265 HTTP State Management Mechanism April 2011
16851685+16861686+16871687+ Servers SHOULD encrypt and sign the contents of cookies (using
16881688+ whatever format the server desires) when transmitting them to the
16891689+ user agent (even when sending the cookies over a secure channel).
16901690+ However, encrypting and signing cookie contents does not prevent an
16911691+ attacker from transplanting a cookie from one user agent to another
16921692+ or from replaying the cookie at a later time.
16931693+16941694+ In addition to encrypting and signing the contents of every cookie,
16951695+ servers that require a higher level of security SHOULD use the Cookie
16961696+ and Set-Cookie headers only over a secure channel. When using
16971697+ cookies over a secure channel, servers SHOULD set the Secure
16981698+ attribute (see Section 4.1.2.5) for every cookie. If a server does
16991699+ not set the Secure attribute, the protection provided by the secure
17001700+ channel will be largely moot.
17011701+17021702+ For example, consider a webmail server that stores a session
17031703+ identifier in a cookie and is typically accessed over HTTPS. If the
17041704+ server does not set the Secure attribute on its cookies, an active
17051705+ network attacker can intercept any outbound HTTP request from the
17061706+ user agent and redirect that request to the webmail server over HTTP.
17071707+ Even if the webmail server is not listening for HTTP connections, the
17081708+ user agent will still include cookies in the request. The active
17091709+ network attacker can intercept these cookies, replay them against the
17101710+ server, and learn the contents of the user's email. If, instead, the
17111711+ server had set the Secure attribute on its cookies, the user agent
17121712+ would not have included the cookies in the clear-text request.
17131713+17141714+8.4. Session Identifiers
17151715+17161716+ Instead of storing session information directly in a cookie (where it
17171717+ might be exposed to or replayed by an attacker), servers commonly
17181718+ store a nonce (or "session identifier") in a cookie. When the server
17191719+ receives an HTTP request with a nonce, the server can look up state
17201720+ information associated with the cookie using the nonce as a key.
17211721+17221722+ Using session identifier cookies limits the damage an attacker can
17231723+ cause if the attacker learns the contents of a cookie because the
17241724+ nonce is useful only for interacting with the server (unlike non-
17251725+ nonce cookie content, which might itself be sensitive). Furthermore,
17261726+ using a single nonce prevents an attacker from "splicing" together
17271727+ cookie content from two interactions with the server, which could
17281728+ cause the server to behave unexpectedly.
17291729+17301730+ Using session identifiers is not without risk. For example, the
17311731+ server SHOULD take care to avoid "session fixation" vulnerabilities.
17321732+ A session fixation attack proceeds in three steps. First, the
17331733+ attacker transplants a session identifier from his or her user agent
17341734+ to the victim's user agent. Second, the victim uses that session
17351735+17361736+17371737+17381738+Barth Standards Track [Page 31]
17391739+17401740+RFC 6265 HTTP State Management Mechanism April 2011
17411741+17421742+17431743+ identifier to interact with the server, possibly imbuing the session
17441744+ identifier with the user's credentials or confidential information.
17451745+ Third, the attacker uses the session identifier to interact with
17461746+ server directly, possibly obtaining the user's authority or
17471747+ confidential information.
17481748+17491749+8.5. Weak Confidentiality
17501750+17511751+ Cookies do not provide isolation by port. If a cookie is readable by
17521752+ a service running on one port, the cookie is also readable by a
17531753+ service running on another port of the same server. If a cookie is
17541754+ writable by a service on one port, the cookie is also writable by a
17551755+ service running on another port of the same server. For this reason,
17561756+ servers SHOULD NOT both run mutually distrusting services on
17571757+ different ports of the same host and use cookies to store security-
17581758+ sensitive information.
17591759+17601760+ Cookies do not provide isolation by scheme. Although most commonly
17611761+ used with the http and https schemes, the cookies for a given host
17621762+ might also be available to other schemes, such as ftp and gopher.
17631763+ Although this lack of isolation by scheme is most apparent in non-
17641764+ HTTP APIs that permit access to cookies (e.g., HTML's document.cookie
17651765+ API), the lack of isolation by scheme is actually present in
17661766+ requirements for processing cookies themselves (e.g., consider
17671767+ retrieving a URI with the gopher scheme via HTTP).
17681768+17691769+ Cookies do not always provide isolation by path. Although the
17701770+ network-level protocol does not send cookies stored for one path to
17711771+ another, some user agents expose cookies via non-HTTP APIs, such as
17721772+ HTML's document.cookie API. Because some of these user agents (e.g.,
17731773+ web browsers) do not isolate resources received from different paths,
17741774+ a resource retrieved from one path might be able to access cookies
17751775+ stored for another path.
17761776+17771777+8.6. Weak Integrity
17781778+17791779+ Cookies do not provide integrity guarantees for sibling domains (and
17801780+ their subdomains). For example, consider foo.example.com and
17811781+ bar.example.com. The foo.example.com server can set a cookie with a
17821782+ Domain attribute of "example.com" (possibly overwriting an existing
17831783+ "example.com" cookie set by bar.example.com), and the user agent will
17841784+ include that cookie in HTTP requests to bar.example.com. In the
17851785+ worst case, bar.example.com will be unable to distinguish this cookie
17861786+ from a cookie it set itself. The foo.example.com server might be
17871787+ able to leverage this ability to mount an attack against
17881788+ bar.example.com.
17891789+17901790+17911791+17921792+17931793+17941794+Barth Standards Track [Page 32]
17951795+17961796+RFC 6265 HTTP State Management Mechanism April 2011
17971797+17981798+17991799+ Even though the Set-Cookie header supports the Path attribute, the
18001800+ Path attribute does not provide any integrity protection because the
18011801+ user agent will accept an arbitrary Path attribute in a Set-Cookie
18021802+ header. For example, an HTTP response to a request for
18031803+ http://example.com/foo/bar can set a cookie with a Path attribute of
18041804+ "/qux". Consequently, servers SHOULD NOT both run mutually
18051805+ distrusting services on different paths of the same host and use
18061806+ cookies to store security-sensitive information.
18071807+18081808+ An active network attacker can also inject cookies into the Cookie
18091809+ header sent to https://example.com/ by impersonating a response from
18101810+ http://example.com/ and injecting a Set-Cookie header. The HTTPS
18111811+ server at example.com will be unable to distinguish these cookies
18121812+ from cookies that it set itself in an HTTPS response. An active
18131813+ network attacker might be able to leverage this ability to mount an
18141814+ attack against example.com even if example.com uses HTTPS
18151815+ exclusively.
18161816+18171817+ Servers can partially mitigate these attacks by encrypting and
18181818+ signing the contents of their cookies. However, using cryptography
18191819+ does not mitigate the issue completely because an attacker can replay
18201820+ a cookie he or she received from the authentic example.com server in
18211821+ the user's session, with unpredictable results.
18221822+18231823+ Finally, an attacker might be able to force the user agent to delete
18241824+ cookies by storing a large number of cookies. Once the user agent
18251825+ reaches its storage limit, the user agent will be forced to evict
18261826+ some cookies. Servers SHOULD NOT rely upon user agents retaining
18271827+ cookies.
18281828+18291829+8.7. Reliance on DNS
18301830+18311831+ Cookies rely upon the Domain Name System (DNS) for security. If the
18321832+ DNS is partially or fully compromised, the cookie protocol might fail
18331833+ to provide the security properties required by applications.
18341834+18351835+9. IANA Considerations
18361836+18371837+ The permanent message header field registry (see [RFC3864]) has been
18381838+ updated with the following registrations.
18391839+18401840+18411841+18421842+18431843+18441844+18451845+18461846+18471847+18481848+18491849+18501850+Barth Standards Track [Page 33]
18511851+18521852+RFC 6265 HTTP State Management Mechanism April 2011
18531853+18541854+18551855+9.1. Cookie
18561856+18571857+ Header field name: Cookie
18581858+18591859+ Applicable protocol: http
18601860+18611861+ Status: standard
18621862+18631863+ Author/Change controller: IETF
18641864+18651865+ Specification document: this specification (Section 5.4)
18661866+18671867+9.2. Set-Cookie
18681868+18691869+ Header field name: Set-Cookie
18701870+18711871+ Applicable protocol: http
18721872+18731873+ Status: standard
18741874+18751875+ Author/Change controller: IETF
18761876+18771877+ Specification document: this specification (Section 5.2)
18781878+18791879+9.3. Cookie2
18801880+18811881+ Header field name: Cookie2
18821882+18831883+ Applicable protocol: http
18841884+18851885+ Status: obsoleted
18861886+18871887+ Author/Change controller: IETF
18881888+18891889+ Specification document: [RFC2965]
18901890+18911891+9.4. Set-Cookie2
18921892+18931893+ Header field name: Set-Cookie2
18941894+18951895+ Applicable protocol: http
18961896+18971897+ Status: obsoleted
18981898+18991899+ Author/Change controller: IETF
19001900+19011901+ Specification document: [RFC2965]
19021902+19031903+19041904+19051905+19061906+Barth Standards Track [Page 34]
19071907+19081908+RFC 6265 HTTP State Management Mechanism April 2011
19091909+19101910+19111911+10. References
19121912+19131913+10.1. Normative References
19141914+19151915+ [RFC1034] Mockapetris, P., "Domain names - concepts and facilities",
19161916+ STD 13, RFC 1034, November 1987.
19171917+19181918+ [RFC1123] Braden, R., "Requirements for Internet Hosts - Application
19191919+ and Support", STD 3, RFC 1123, October 1989.
19201920+19211921+ [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate
19221922+ Requirement Levels", BCP 14, RFC 2119, March 1997.
19231923+19241924+ [RFC2616] Fielding, R., Gettys, J., Mogul, J., Frystyk, H.,
19251925+ Masinter, L., Leach, P., and T. Berners-Lee, "Hypertext
19261926+ Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.
19271927+19281928+ [RFC3490] Faltstrom, P., Hoffman, P., and A. Costello,
19291929+ "Internationalizing Domain Names in Applications (IDNA)",
19301930+ RFC 3490, March 2003.
19311931+19321932+ See Section 6.3 for an explanation why the normative
19331933+ reference to an obsoleted specification is needed.
19341934+19351935+ [RFC4790] Newman, C., Duerst, M., and A. Gulbrandsen, "Internet
19361936+ Application Protocol Collation Registry", RFC 4790,
19371937+ March 2007.
19381938+19391939+ [RFC5234] Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax
19401940+ Specifications: ABNF", STD 68, RFC 5234, January 2008.
19411941+19421942+ [RFC5890] Klensin, J., "Internationalized Domain Names for
19431943+ Applications (IDNA): Definitions and Document Framework",
19441944+ RFC 5890, August 2010.
19451945+19461946+ [USASCII] American National Standards Institute, "Coded Character
19471947+ Set -- 7-bit American Standard Code for Information
19481948+ Interchange", ANSI X3.4, 1986.
19491949+19501950+10.2. Informative References
19511951+19521952+ [RFC2109] Kristol, D. and L. Montulli, "HTTP State Management
19531953+ Mechanism", RFC 2109, February 1997.
19541954+19551955+ [RFC2965] Kristol, D. and L. Montulli, "HTTP State Management
19561956+ Mechanism", RFC 2965, October 2000.
19571957+19581958+19591959+19601960+19611961+19621962+Barth Standards Track [Page 35]
19631963+19641964+RFC 6265 HTTP State Management Mechanism April 2011
19651965+19661966+19671967+ [RFC2818] Rescorla, E., "HTTP Over TLS", RFC 2818, May 2000.
19681968+19691969+ [Netscape] Netscape Communications Corp., "Persistent Client State --
19701970+ HTTP Cookies", 1999, <http://web.archive.org/web/
19711971+ 20020803110822/http://wp.netscape.com/newsref/std/
19721972+ cookie_spec.html>.
19731973+19741974+ [Kri2001] Kristol, D., "HTTP Cookies: Standards, Privacy, and
19751975+ Politics", ACM Transactions on Internet Technology Vol. 1,
19761976+ #2, November 2001, <http://arxiv.org/abs/cs.SE/0105018>.
19771977+19781978+ [RFC3629] Yergeau, F., "UTF-8, a transformation format of ISO
19791979+ 10646", STD 63, RFC 3629, November 2003.
19801980+19811981+ [RFC4648] Josefsson, S., "The Base16, Base32, and Base64 Data
19821982+ Encodings", RFC 4648, October 2006.
19831983+19841984+ [RFC3864] Klyne, G., Nottingham, M., and J. Mogul, "Registration
19851985+ Procedures for Message Header Fields", BCP 90, RFC 3864,
19861986+ September 2004.
19871987+19881988+ [RFC5895] Resnick, P. and P. Hoffman, "Mapping Characters for
19891989+ Internationalized Domain Names in Applications (IDNA)
19901990+ 2008", RFC 5895, September 2010.
19911991+19921992+ [UTS46] Davis, M. and M. Suignard, "Unicode IDNA Compatibility
19931993+ Processing", Unicode Technical Standards # 46, 2010,
19941994+ <http://unicode.org/reports/tr46/>.
19951995+19961996+ [CSRF] Barth, A., Jackson, C., and J. Mitchell, "Robust Defenses
19971997+ for Cross-Site Request Forgery", 2008,
19981998+ <http://portal.acm.org/citation.cfm?id=1455770.1455782>.
19991999+20002000+ [Aggarwal2010]
20012001+ Aggarwal, G., Burzstein, E., Jackson, C., and D. Boneh,
20022002+ "An Analysis of Private Browsing Modes in Modern
20032003+ Browsers", 2010, <http://www.usenix.org/events/sec10/tech/
20042004+ full_papers/Aggarwal.pdf>.
20052005+20062006+20072007+20082008+20092009+20102010+20112011+20122012+20132013+20142014+20152015+20162016+20172017+20182018+Barth Standards Track [Page 36]
20192019+20202020+RFC 6265 HTTP State Management Mechanism April 2011
20212021+20222022+20232023+Appendix A. Acknowledgements
20242024+20252025+ This document borrows heavily from RFC 2109 [RFC2109]. We are
20262026+ indebted to David M. Kristol and Lou Montulli for their efforts to
20272027+ specify cookies. David M. Kristol, in particular, provided
20282028+ invaluable advice on navigating the IETF process. We would also like
20292029+ to thank Thomas Broyer, Tyler Close, Alissa Cooper, Bil Corry,
20302030+ corvid, Lisa Dusseault, Roy T. Fielding, Blake Frantz, Anne van
20312031+ Kesteren, Eran Hammer-Lahav, Jeff Hodges, Bjoern Hoehrmann, Achim
20322032+ Hoffmann, Georg Koppen, Dean McNamee, Alexey Melnikov, Mark Miller,
20332033+ Mark Pauley, Yngve N. Pettersen, Julian Reschke, Peter Saint-Andre,
20342034+ Mark Seaborn, Maciej Stachowiak, Daniel Stenberg, Tatsuhiro
20352035+ Tsujikawa, David Wagner, Dan Winship, and Dan Witte for their
20362036+ valuable feedback on this document.
20372037+20382038+Author's Address
20392039+20402040+ Adam Barth
20412041+ University of California, Berkeley
20422042+20432043+ EMail: abarth@eecs.berkeley.edu
20442044+ URI: http://www.adambarth.com/
20452045+20462046+20472047+20482048+20492049+20502050+20512051+20522052+20532053+20542054+20552055+20562056+20572057+20582058+20592059+20602060+20612061+20622062+20632063+20642064+20652065+20662066+20672067+20682068+20692069+20702070+20712071+20722072+20732073+20742074+Barth Standards Track [Page 37]
20752075+