home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1997 December / Internet_Info_CD-ROM_Walnut_Creek_December_1997.iso / drafts / draft__misc / cookie-2.54.txt < prev    next >
Text File  |  1997-05-05  |  48KB  |  1,387 lines

  1.  
  2.  
  3. HTTP Working Group                                      David M. Kristol
  4. INTERNET DRAFT                    Bell Laboratories, Lucent Technologies
  5. Obsoletes: RFC 2109                                         Lou Montulli
  6.                                                  Netscape Communications
  7. <draft-ietf-http-state-man-mec-01.txt>
  8. May 5, 1997                                     Expires November 5, 1997
  9.  
  10.  
  11.                  HTTP State Management Mechanism (Rev1)
  12.  
  13.  
  14.  
  15.                           Status of this Memo
  16.  
  17.      This document is an Internet-Draft.  Internet-Drafts are
  18.      working documents of the Internet Engineering Task Force
  19.      (IETF), its areas, and its working groups.  Note that other
  20.      groups may also distribute working documents as Internet-
  21.      Drafts.
  22.  
  23.      Internet-Drafts are draft documents valid for a maximum of six
  24.      months and may be updated, replaced, or obsoleted by other
  25.      documents at any time.  It is inappropriate to use Internet-
  26.      Drafts as reference material or to cite them other than as
  27.      ``work in progress.''
  28.  
  29.      To learn the current status of any Internet-Draft, please
  30.      check the ``1id-abstracts.txt'' listing contained in the
  31.      Internet- Drafts Shadow Directories on ftp.is.co.za (Africa),
  32.      nic.nordu.net (Europe), munnari.oz.au (Pacific Rim),
  33.      ds.internic.net (US East Coast), or ftp.isi.edu (US West
  34.      Coast).
  35.  
  36.      This is authors' draft 2.54.
  37.  
  38.  
  39. 1.  ABSTRACT
  40.  
  41. This document specifies a way to create a stateful session with HTTP
  42. requests and responses.  It describes two new headers, Cookie and Set-
  43. Cookie2, which carry state information between participating origin
  44. servers and user agents.  The method described here differs from
  45. Netscape's Cookie proposal, but it can interoperate with HTTP/1.0 user
  46. agents that use Netscape's method.  (See the HISTORICAL section.)
  47.  
  48. This document reflects implementation experience with RFC 2109 and
  49. obsoletes it.
  50.  
  51.  
  52. 2.  TERMINOLOGY
  53.  
  54. The terms user agent, client, server, proxy, and origin server have the
  55. same meaning as in the HTTP/1.1 specification [RFC 2068].
  56.  
  57. Fully-qualified host name (FQHN) means either the fully-qualified domain
  58. name (FQDN) of a host (i.e., a completely specified domain name ending
  59.  
  60.  
  61.  
  62. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 1]
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  71.  
  72.  
  73.  
  74. in a top-level domain such as .com or .uk), or the numeric Internet
  75. Protocol (IP) address of a host.  The fully qualified domain name is
  76. preferred; use of numeric IP addresses is strongly discouraged.
  77.  
  78. The terms request-host and request-URI refer to the values the client
  79. would send to the server as, respectively, the host (but not port) and
  80. abs_path portions of the absoluteURI (http_URL) of the HTTP request
  81. line.  Note that request-host must be a FQHN.
  82.  
  83. The term request-port refers to the port portion of the absoluteURI
  84. (http_URL) of the HTTP request line.  If the absoluteURI has no explicit
  85. port, the request-port is the HTTP default, 80.  The request-port of a
  86. cookie is the request-port of the request in which a Set-Cookie2
  87. response header was returned to the user agent.
  88.  
  89. Host names can be specified either as an IP address or a FQHN string.
  90. Sometimes we compare one host name with another.  Host A's name domain-
  91. matches host B's if
  92.  
  93.    * both host names are IP addresses and their host name strings match
  94.      exactly; or
  95.  
  96.    * both host names are FQDN strings and their host name strings match
  97.      exactly; or
  98.  
  99.    * A is a FQDN string and has the form NB, where N is a non-empty name
  100.      string, B has the form .B', and B' is a FQDN string.  (So, x.y.com
  101.      domain-matches .y.com but not y.com.)
  102.  
  103. Note that domain-match is not a commutative operation: a.b.c.com
  104. domain-matches .c.com, but not the reverse.
  105.  
  106. Because it was used in Netscape's original implementation of state
  107. management, we will use the term cookie to refer to the state
  108. information that passes between an origin server and user agent, and
  109. that gets stored by the user agent.
  110.  
  111.  
  112. 3.  STATE AND SESSIONS
  113.  
  114. This document describes a way to create stateful sessions with HTTP
  115. requests and responses.  Currently, HTTP servers respond to each client
  116. request without relating that request to previous or subsequent
  117. requests; the technique allows clients and servers that wish to exchange
  118. state information to place HTTP requests and responses within a larger
  119. context, which we term a ``session.''  This context might be used to
  120. create, for example, a "shopping cart", in which user selections can be
  121. aggregated before purchase, or a magazine browsing system, in which a
  122. user's previous reading affects which offerings are presented.
  123.  
  124.  
  125.  
  126.  
  127.  
  128. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 2]
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  137.  
  138.  
  139.  
  140. There are, of course, many different potential contexts and thus many
  141. different potential types of session.  The designers' paradigm for
  142. sessions created by the exchange of cookies has these key attributes:
  143.  
  144.   1.  Each session has a beginning and an end.
  145.  
  146.   2.  Each session is relatively short-lived.
  147.  
  148.   3.  Either the user agent or the origin server may terminate a
  149.       session.
  150.  
  151.   4.  The session is implicit in the exchange of state information.
  152.  
  153.  
  154. 4.  OUTLINE
  155.  
  156. We outline here a way for an origin server to send state information to
  157. the user agent, and for the user agent to return the state information
  158. to the origin server.  The goal is to have a minimal impact on HTTP and
  159. user agents.  Only origin servers that need to maintain sessions would
  160. suffer any significant impact, and that impact can largely be confined
  161. to Common Gateway Interface (CGI) programs, unless the server provides
  162. more sophisticated state management support.  (See Implementation
  163. Considerations, below.)
  164.  
  165. 4.1  Syntax:  General
  166.  
  167. The two state management headers, Set-Cookie2 and Cookie, have common
  168. syntactic properties involving attribute-value pairs.  The following
  169. grammar uses the notation, and tokens DIGIT (decimal digits) and token
  170. (informally, a sequence of non-special, non-white space characters) from
  171. the HTTP/1.1 specification [RFC 2068] to describe their syntax.
  172.  
  173. av-pairs        =       av-pair *(";" av-pair)
  174. av-pair         =       attr ["=" value]        ; optional value
  175. attr            =       token
  176. value           =       word
  177. word            =       token | quoted-string
  178.  
  179. Attributes (names) (attr) are case-insensitive.  White space is
  180. permitted between tokens.  Note that while the above syntax description
  181. shows value as optional, most attrs require them.
  182.  
  183. NOTE: The syntax above allows whitespace between the attribute and the =
  184. sign.
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 3]
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  203.  
  204.  
  205.  
  206. 4.2  Origin Server Role
  207.  
  208. 4.2.1  General  The origin server initiates a session, if it so desires.
  209. (Note that "session" here does not refer to a persistent network
  210. connection but to a logical session created from HTTP requests and
  211. responses.  The presence or absence of a persistent connection should
  212. have no effect on the use of cookie-derived sessions).  To initiate a
  213. session, the origin server returns an extra response header to the
  214. client, Set-Cookie2.  (The details follow later.)
  215.  
  216. A user agent returns a Cookie request header (see below) to the origin
  217. server if it chooses to continue a session.  The origin server may
  218. ignore it or use it to determine the current state of the session.  It
  219. may send back to the client a Set-Cookie2 response header with the same
  220. or different information, or it may send no Set-Cookie2 header at all.
  221. The origin server effectively ends a session by sending the client a
  222. Set-Cookie2 header with Max-Age=0.
  223.  
  224. Servers may return Set-Cookie2 response headers with any response.  User
  225. agents should send Cookie request headers, subject to other rules
  226. detailed below, with every request.
  227.  
  228. An origin server may include multiple Set-Cookie2 headers in a response.
  229. Note that an intervening gateway could fold multiple such headers into a
  230. single header.
  231.  
  232. 4.2.2  Set-Cookie2 Syntax  The syntax for the Set-Cookie2 response
  233. header is
  234.  
  235. set-cookie      =       "Set-Cookie2:" cookies
  236. cookies         =       1#cookie
  237. cookie          =       NAME "=" VALUE *(";" cookie-av)
  238. NAME            =       attr
  239. VALUE           =       value
  240. cookie-av       =       "Comment" "=" value
  241.                 |       "Discard"
  242.                 |       "Domain" "=" value
  243.                 |       "Max-Age" "=" value
  244.                 |       "Path" "=" value
  245.                 |       "Port" [ "=" <"> 1#port-list <"> ]
  246.                 |       "Secure"
  247.                 |       "Version" "=" 1*DIGIT
  248. port-list       |       1#DIGIT
  249.  
  250. Informally, the Set-Cookie2 response header comprises the token Set-
  251. Cookie2:, followed by a comma-separated list of one or more cookies.
  252. Each cookie begins with a NAME=VALUE pair, followed by zero or more
  253. semi-colon-separated attribute-value pairs.  The syntax for attribute-
  254. value pairs was shown earlier.  The specific attributes and the
  255. semantics of their values follows.  The NAME=VALUE attribute-value pair
  256. must come first in each cookie.  The others, if present, can occur in
  257.  
  258.  
  259.  
  260. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 4]
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  269.  
  270.  
  271.  
  272. any order.  If an attribute appears more than once in a cookie, the
  273. behavior is undefined.
  274.  
  275. NAME=VALUE
  276.      Required.  The name of the state information (``cookie'') is NAME,
  277.      and its value is VALUE.  NAMEs that begin with $ are reserved for
  278.      other uses and must not be used by applications.
  279.  
  280.      The VALUE is opaque to the user agent and may be anything the
  281.      origin server chooses to send, possibly in a server-selected
  282.      printable ASCII encoding.  ``Opaque'' implies that the content is
  283.      of interest and relevance only to the origin server.  The content
  284.      may, in fact, be readable by anyone that examines the Set-Cookie2
  285.      header.
  286.  
  287. Comment=comment
  288.      Optional.  Because cookies can contain private information about a
  289.      user, the Comment attribute allows an origin server to document how
  290.      it intends to use the cookie.  The user can inspect the information
  291.      to decide whether to initiate or continue a session with this
  292.      cookie.
  293.  
  294. Discard
  295.      Optional.  The Discard attribute instructs the user agent to
  296.      discard the cookie unconditionally when the user agent terminates.
  297.  
  298. Domain=domain
  299.      Optional.  The Domain attribute specifies the domain for which the
  300.      cookie is valid.  An explicitly specified domain must always start
  301.      with a dot.
  302.  
  303. Max-Age=delta-seconds
  304.      Optional.  The Max-Age attribute defines the lifetime of the
  305.      cookie, in seconds.  The delta-seconds value is a decimal non-
  306.      negative integer.  After delta-seconds seconds elapse, the client
  307.      should discard the cookie.  A value of zero means the cookie should
  308.      be discarded immediately.
  309.  
  310. Path=path
  311.      Optional.  The Path attribute specifies the subset of URLs on the
  312.      origin server to which this cookie applies.
  313.  
  314. Port[="port-list"]
  315.      Optional.  The Port attribute restricts the port to which a cookie
  316.      may be returned in a Cookie request header.
  317.  
  318. Secure
  319.      Optional.  The Secure attribute (with no value) directs the user
  320.      agent to use only (unspecified) secure means to contact the origin
  321.      server whenever it sends back this cookie, to protect the
  322.      confidentially and authenticity of the information in the cookie.
  323.  
  324.  
  325.  
  326. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 5]
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  335.  
  336.  
  337.  
  338.      The user agent (possibly under the user's control) may determine
  339.      what level of security it considers appropriate for ``secure''
  340.      cookies.  The Secure attribute should be considered security advice
  341.      from the server to the user agent, indicating that it is in the
  342.      session's interest to protect the cookie contents.  When it sends a
  343.      "secure" cookie back to a server, the user agent should use no less
  344.      than the same level of security as was used when it received the
  345.      cookie from the server.
  346.  
  347. Version=version
  348.      Required.  The Version attribute, a decimal integer, identifies to
  349.      which version of the state management specification the cookie
  350.      conforms.  For this specification, Version=1 applies.
  351.  
  352. 4.2.3  Controlling Caching  An origin server must be cognizant of the
  353. effect of possible caching of both the returned resource and the Set-
  354. Cookie2 header.  Caching ``public'' documents is desirable.  For
  355. example, if the origin server wants to use a public document such as a
  356. ``front door'' page as a sentinel to indicate the beginning of a session
  357. for which a Set-Cookie2 response header must be generated, the page
  358. should be stored in caches ``pre-expired'' so that the origin server
  359. will see further requests.  ``Private documents,'' for example those
  360. that contain information strictly private to a session, should not be
  361. cached in shared caches.
  362.  
  363. If the cookie is intended for use by a single user, the Set-Cookie2
  364. header should not be cached.  A Set-Cookie2 header that is intended to
  365. be shared by multiple users may be cached.
  366.  
  367. The origin server should send the following additional HTTP/1.1 response
  368. headers, depending on circumstances:
  369.  
  370.    * To suppress caching of the Set-Cookie2 header: Cache-control: no-
  371.      cache="set-cookie2".
  372.  
  373. and one of the following:
  374.  
  375.    * To suppress caching of a private document in shared caches: Cache-
  376.      control: private.
  377.  
  378.    * To allow caching of a document and require that it be validated
  379.      before returning it to the client: Cache-Control: must-revalidate,
  380.      max-age=0.
  381.  
  382.    * To allow caching of a document, but to require that proxy caches
  383.      (not user agent caches) validate it before returning it to the
  384.      client: Cache-Control: proxy-revalidate, max-age=0.
  385.  
  386.    * To allow caching of a document and request that it be validated
  387.      before returning it to the client (by ``pre-expiring'' it): Cache-
  388.      control: max-age=0.  Not all caches will revalidate the document in
  389.  
  390.  
  391.  
  392. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 6]
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  401.  
  402.  
  403.  
  404.      every case.
  405.  
  406. HTTP/1.1 servers must send Expires: old-date (where old-date is a date
  407. long in the past) on responses containing Set-Cookie2 response headers
  408. unless they know for certain (by out of band means) that there are no
  409. upstream HTTP/1.0 proxies.  HTTP/1.1 servers may send other Cache-
  410. Control directives that permit caching by HTTP/1.1 proxies in addition
  411. to the Expires: old-date directive; the Cache-Control directive will
  412. override the Expires: old-date for HTTP/1.1 proxies.
  413.  
  414. 4.3  User Agent Role
  415.  
  416. 4.3.1  Interpreting Set-Cookie2  The user agent keeps separate track of
  417. state information that arrives via Set-Cookie2 response headers from
  418. each origin server (as distinguished by name or IP address and port).
  419. The user agent must ignore attribute-values pairs whose attribute it
  420. does not recognize.  The user agent applies these defaults for optional
  421. attributes that are missing:
  422.  
  423. DiscardThe default behavior is dictated by the presence or absence of a
  424.        Max-Age attribute.
  425.  
  426. Domain Defaults to the request-host.  (Note that there is no dot at the
  427.        beginning of request-host.)
  428.  
  429. Max-AgeThe default behavior is to discard the cookie when the user agent
  430.        exits.
  431.  
  432. Path   Defaults to the path of the request URL that generated the Set-
  433.        Cookie2 response, up to, but not including, the right-most /.
  434.  
  435. Port   The default behavior is that a cookie may be returned only to its
  436.        request-port.
  437.  
  438. Secure If absent, the user agent may send the cookie over an insecure
  439.        channel.
  440.  
  441. 4.3.2  Rejecting Cookies  To prevent possible security or privacy
  442. violations, a user agent rejects a cookie (shall not store its
  443. information) if any of the following is true of the attributes
  444. explicitly present in the Set-Cookie2 response header:
  445.  
  446.    * The value for the Path attribute is not a prefix of the request-
  447.      URI.
  448.  
  449.    * The value for the Domain attribute contains no embedded dots or
  450.      does not start with a dot.
  451.  
  452.    * The value for the request-host does not domain-match the Domain
  453.      attribute.
  454.  
  455.  
  456.  
  457.  
  458. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 7]
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  467.  
  468.  
  469.  
  470.    * The request-host is a FQDN (not IP address) and has the form HD,
  471.      where D is the value of the Domain attribute, and H is a string
  472.      that contains one or more dots.
  473.  
  474.    * The Port attribute has a "port-list", and the request-port was not
  475.      in the list.
  476.  
  477. Examples:
  478.  
  479.    * A Set-Cookie2 from request-host y.x.foo.com for Domain=.foo.com
  480.      would be rejected, because H is y.x and contains a dot.
  481.  
  482.    * A Set-Cookie2 from request-host x.foo.com for Domain=.foo.com would
  483.      be accepted.
  484.  
  485.    * A Set-Cookie2 with Domain=.com or Domain=.com., will always be
  486.      rejected, because there is no embedded dot.
  487.  
  488.    * A Set-Cookie2 with Domain=ajax.com will be rejected because the
  489.      value for Domain does not begin with a dot.
  490.  
  491.    * A Set-Cookie2 with Port="80,8000" will be accepted if the request
  492.      was made to port 80 or 8000 and will be rejected otherwise.
  493.  
  494. 4.3.3  Cookie Management  If a user agent receives a Set-Cookie2
  495. response header whose NAME is the same as a pre-existing cookie, and
  496. whose Domain and Path attribute values exactly (string) match those of a
  497. pre-existing cookie, the new cookie supersedes the old.  However, if the
  498. Set-Cookie2 has a value for Max-Age of zero, the (old and new) cookie is
  499. discarded.  Otherwise a cookie persists (resources permitting) until
  500. whichever happens first, then gets discarded: its Max-Age lifetime is
  501. exceeded; or, if the Discard attribute is set, the user agent terminates
  502. the session,
  503.  
  504. Because user agents have finite space in which to store cookies, they
  505. may also discard older cookies to make space for newer ones, using, for
  506. example, a least-recently-used algorithm, along with constraints on the
  507. maximum number of cookies that each origin server may set.
  508.  
  509. If a Set-Cookie2 response header includes a Comment attribute, the user
  510. agent should store that information in a human-readable form with the
  511. cookie and should display the comment text as part of a cookie
  512. inspection user interface.
  513.  
  514. User agents should allow the user to control cookie destruction, but
  515. they must not extend the cookie's lifetime beyond that controlled by the
  516. Discard and Max-Age attributes.  An infrequently-used cookie may
  517. function as a ``preferences file'' for network applications, and a user
  518. may wish to keep it even if it is the least-recently-used cookie.  One
  519. possible implementation would be an interface that allows the permanent
  520. storage of a cookie through a checkbox (or, conversely, its immediate
  521.  
  522.  
  523.  
  524. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 8]
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  533.  
  534.  
  535.  
  536. destruction).
  537.  
  538. Privacy considerations dictate that the user have considerable control
  539. over cookie management.  The PRIVACY section contains more information.
  540.  
  541. 4.3.4  Sending Cookies to the Origin Server  When it sends a request to
  542. an origin server, the user agent sends a Cookie request header to the
  543. origin server if it has cookies that are applicable to the request,
  544. based on
  545.  
  546.    * the request-host and port;
  547.  
  548.    * the request-URI;
  549.  
  550.    * the cookie's age.
  551.  
  552. The syntax for the header is:
  553.  
  554. cookie          =       "Cookie:" cookie-version 1*((";" | ",") cookie-value)
  555. cookie-value    =       NAME "=" VALUE [";" path] [";" domain]
  556. cookie-version  =       "$Version" "=" value
  557. NAME            =       attr
  558. VALUE           =       value
  559. path            =       "$Path" "=" value
  560. domain          =       "$Domain" "=" value
  561.  
  562. The value of the cookie-version attribute must be the value from the
  563. Version attribute of the corresponding Set-Cookie2 response header.
  564. Otherwise the value for cookie-version is 0.  The value for the path
  565. attribute must be the value from the Path attribute, if any, of the
  566. corresponding Set-Cookie2 response header.  Otherwise the attribute
  567. should be omitted from the Cookie request header.  The value for the
  568. domain attribute must be the value from the Domain attribute, if any, of
  569. the corresponding Set-Cookie2 response header.  Otherwise the attribute
  570. should be omitted from the Cookie request header.
  571.  
  572. Note that there is no Comment attribute in the Cookie request header
  573. corresponding to the one in the Set-Cookie2 response header.  The user
  574. agent does not return the comment information to the origin server.
  575.  
  576. The user agent applies the following rules to choose applicable cookie-
  577. values to send in Cookie request headers from among all the cookies it
  578. has received.
  579.  
  580. Domain Selection
  581.      The origin server's fully-qualified host name must domain-match the
  582.      Domain attribute of the cookie.
  583.  
  584. Port Selection
  585.      There are three possible behaviors, depending on the Port attribute
  586.      in the Set-Cookie2 response header:
  587.  
  588.  
  589.  
  590. Kristol           draft-ietf-http-state-man-mec-01.txt          [Page 9]
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  599.  
  600.  
  601.  
  602.        1.  By default (no Port attribute), the cookie may be sent to any
  603.            port.
  604.  
  605.        2.  If the attribute is present but has no value (e.g., Port),
  606.            the cookie must only be sent to its request port.
  607.  
  608.        3.  If the attribute has a port-list, the cookie must only be
  609.            returned if the new request-port is one of those listed in
  610.            port-list.
  611.  
  612. Path Selection
  613.      The Path attribute of the cookie must match a prefix of the
  614.      request-URI.
  615.  
  616. Max-Age Selection
  617.      Cookies that have expired should have been discarded and thus are
  618.      not forwarded to an origin server.
  619.  
  620. If multiple cookies satisfy the criteria above, they are ordered in the
  621. Cookie header such that those with more specific Path attributes precede
  622. those with less specific.  Ordering with respect to other attributes
  623. (e.g., Domain) is unspecified.
  624.  
  625. Note: For backward compatibility, the separator in the Cookie header is
  626. semi-colon (;) everywhere.  A server should also accept comma (,) as the
  627. separator between cookie-values for future compatibility.
  628.  
  629. 4.3.5  Sending Cookies in Unverifiable Transactions  Users must have
  630. control over sessions in order to ensure privacy.  (See PRIVACY section
  631. below.)  To simplify implementation and to prevent an additional layer
  632. of complexity where adequate safeguards exist, however, this document
  633. distinguishes between transactions that are verifiable and those that
  634. are unverifiable.  A transaction is verifiable if the user, or a user-
  635. designated agent, has the option to review the request-URI prior to its
  636. use in the transaction.  A transaction is unverifiable if the user does
  637. not have that option.  Unverifiable transactions typically arise when a
  638. user agent automatically requests inlined or embedded entities or when
  639. it resolves redirection (3xx) responses from an origin server.
  640. Typically the origin transaction, the transaction that the user
  641. initiates, is verifiable, and that transaction may directly or
  642. indirectly induce the user agent to make unverifiable transactions.
  643.  
  644. When it makes an unverifiable transaction, a user agent must enable a
  645. session only if a cookie with a domain attribute D was sent or accepted
  646. in its origin transaction, such that the host name in the Request-URI of
  647. the unverifiable transaction domain-matches D.
  648.  
  649. This restriction prevents a malicious service author from using
  650. unverifiable transactions to induce a user agent to start or continue a
  651. session with a server in a different domain.  The starting or
  652. continuation of such sessions could be contrary to the privacy
  653.  
  654.  
  655.  
  656. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 10]
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  665.  
  666.  
  667.  
  668. expectations of the user, and could also be a security problem.
  669.  
  670. User agents may offer configurable options that allow the user agent, or
  671. any autonomous programs that the user agent executes, to ignore the
  672. above rule, so long as these override options default to ``off.''
  673.  
  674. Many current user agents already provide a review option that would
  675. render many links verifiable.  For instance, some user agents display
  676. the URL that would be referenced for a particular link when the mouse
  677. pointer is placed over that link.  The user can therefore determine
  678. whether to visit that site before causing the browser to do so.  (Though
  679. not implemented on current user agents, a similar technique could be
  680. used for a button used to submit a form -- the user agent could display
  681. the action to be taken if the user were to select that button.)
  682. However, even this would not make all links verifiable; for example,
  683. links to automatically loaded images would not normally be subject to
  684. ``mouse pointer'' verification.
  685.  
  686. Many user agents also provide the option for a user to view the HTML
  687. source of a document, or to save the source to an external file where it
  688. can be viewed by another application.  While such an option does provide
  689. a crude review mechanism, some users might not consider it acceptable
  690. for this purpose.
  691.  
  692. 4.4  How an Origin Server Interprets the Cookie Header
  693.  
  694. A user agent returns much of the information in the Set-Cookie2 header
  695. to the origin server when the Path attribute matches that of a new
  696. request.  When it receives a Cookie header, the origin server should
  697. treat cookies with NAMEs whose prefix is $ specially, as an attribute
  698. for the cookie.
  699.  
  700. 4.5  Caching Proxy Role
  701.  
  702. One reason for separating state information from both a URL and document
  703. content is to facilitate the scaling that caching permits.  To support
  704. cookies, a caching proxy must obey these rules already in the HTTP
  705. specification:
  706.  
  707.    * Honor requests from the cache, if possible, based on cache validity
  708.      rules.
  709.  
  710.    * Pass along a Cookie request header in any request that the proxy
  711.      must make of another server.
  712.  
  713.    * Return the response to the client.  Include any Set-Cookie2
  714.      response header.
  715.  
  716.    * Cache the received response subject to the control of the usual
  717.      headers, such as Expires, Cache-control: no-cache, and Cache-
  718.      control: private,
  719.  
  720.  
  721.  
  722. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 11]
  723.  
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  731.  
  732.  
  733.  
  734.    * Cache the Set-Cookie2 subject to the control of the usual header,
  735.      Cache-control: no-cache="set-cookie2".  (The Set-Cookie2 header
  736.      should usually not be cached.)
  737.  
  738. Proxies must not introduce Set-Cookie2 (Cookie) headers of their own in
  739. proxy responses (requests).
  740.  
  741.  
  742. 5.  EXAMPLES
  743.  
  744. 5.1  Example 1
  745.  
  746. Most detail of request and response headers has been omitted.  Assume
  747. the user agent has no stored cookies.
  748.  
  749.   1.  User Agent -> Server
  750.  
  751.       POST /acme/login HTTP/1.1
  752.       [form data]
  753.  
  754.       User identifies self via a form.
  755.  
  756.   2.  Server -> User Agent
  757.  
  758.       HTTP/1.1 200 OK
  759.       Set-Cookie2: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"
  760.  
  761.       Cookie reflects user's identity.
  762.  
  763.   3.  User Agent -> Server
  764.  
  765.       POST /acme/pickitem HTTP/1.1
  766.       Cookie: $Version="1"; Customer="WILE_E_COYOTE"; $Path="/acme"
  767.       [form data]
  768.  
  769.       User selects an item for ``shopping basket.''
  770.  
  771.   4.  Server -> User Agent
  772.  
  773.       HTTP/1.1 200 OK
  774.       Set-Cookie2: Part_Number="Rocket_Launcher_0001"; Version="1";
  775.               Path="/acme"
  776.  
  777.       Shopping basket contains an item.
  778.  
  779.   5.  User Agent -> Server
  780.  
  781.  
  782.  
  783.  
  784.  
  785.  
  786.  
  787.  
  788. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 12]
  789.  
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  797.  
  798.  
  799.  
  800.       POST /acme/shipping HTTP/1.1
  801.       Cookie: $Version="1";
  802.               Customer="WILE_E_COYOTE"; $Path="/acme";
  803.               Part_Number="Rocket_Launcher_0001"; $Path="/acme"
  804.       [form data]
  805.  
  806.       User selects shipping method from form.
  807.  
  808.   6.  Server -> User Agent
  809.  
  810.       HTTP/1.1 200 OK
  811.       Set-Cookie2: Shipping="FedEx"; Version="1"; Path="/acme"
  812.  
  813.       New cookie reflects shipping method.
  814.  
  815.   7.  User Agent -> Server
  816.  
  817.       POST /acme/process HTTP/1.1
  818.       Cookie: $Version="1";
  819.               Customer="WILE_E_COYOTE"; $Path="/acme";
  820.               Part_Number="Rocket_Launcher_0001"; $Path="/acme";
  821.               Shipping="FedEx"; $Path="/acme"
  822.       [form data]
  823.  
  824.       User chooses to process order.
  825.  
  826.   8.  Server -> User Agent
  827.  
  828.       HTTP/1.1 200 OK
  829.  
  830.       Transaction is complete.
  831.  
  832. The user agent makes a series of requests on the origin server, after
  833. each of which it receives a new cookie.  All the cookies have the same
  834. Path attribute and (default) domain.  Because the request URLs all have
  835. /acme as a prefix, and that matches the Path attribute, each request
  836. contains all the cookies received so far.
  837.  
  838. 5.2  Example 2
  839.  
  840. This example illustrates the effect of the Path attribute.  All detail
  841. of request and response headers has been omitted.  Assume the user agent
  842. has no stored cookies.
  843.  
  844. Imagine the user agent has received, in response to earlier requests,
  845. the response headers
  846.  
  847. Set-Cookie2: Part_Number="Rocket_Launcher_0001"; Version="1";
  848.         Path="/acme"
  849.  
  850. and
  851.  
  852.  
  853.  
  854. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 13]
  855.  
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  863.  
  864.  
  865.  
  866. Set-Cookie2: Part_Number="Riding_Rocket_0023"; Version="1";
  867.         Path="/acme/ammo"
  868.  
  869. A subsequent request by the user agent to the (same) server for URLs of
  870. the form /acme/ammo/...  would include the following request header:
  871.  
  872. Cookie: $Version="1";
  873.         Part_Number="Riding_Rocket_0023"; $Path="/acme/ammo";
  874.         Part_Number="Rocket_Launcher_0001"; $Path="/acme"
  875.  
  876. Note that the NAME=VALUE pair for the cookie with the more specific Path
  877. attribute, /acme/ammo, comes before the one with the less specific Path
  878. attribute, /acme.  Further note that the same cookie name appears more
  879. than once.
  880.  
  881. A subsequent request by the user agent to the (same) server for a URL of
  882. the form /acme/parts/ would include the following request header:
  883.  
  884. Cookie: $Version="1"; Part_Number="Rocket_Launcher_0001"; $Path="/acme"
  885.  
  886. Here, the second cookie's Path attribute /acme/ammo is not a prefix of
  887. the request URL, /acme/parts/, so the cookie does not get forwarded to
  888. the server.
  889.  
  890.  
  891. 6.  IMPLEMENTATION CONSIDERATIONS
  892.  
  893. Here we speculate on likely or desirable details for an origin server
  894. that implements state management.
  895.  
  896. 6.1  Set-Cookie2 Content
  897.  
  898. An origin server's content should probably be divided into disjoint
  899. application areas, some of which require the use of state information.
  900. The application areas can be distinguished by their request URLs.  The
  901. Set-Cookie2 header can incorporate information about the application
  902. areas by setting the Path attribute for each one.
  903.  
  904. The session information can obviously be clear or encoded text that
  905. describes state.  However, if it grows too large, it can become
  906. unwieldy.  Therefore, an implementor might choose for the session
  907. information to be a key to a server-side resource.  Of course, using a
  908. database creates some problems that this state management specification
  909. was meant to avoid, namely:
  910.  
  911.   1.  keeping real state on the server side;
  912.  
  913.   2.  how and when to garbage-collect the database entry, in case the
  914.       user agent terminates the session by, for example, exiting.
  915.  
  916.  
  917.  
  918.  
  919.  
  920. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 14]
  921.  
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  929.  
  930.  
  931.  
  932. 6.2  Stateless Pages
  933.  
  934. Caching benefits the scalability of WWW.  Therefore it is important to
  935. reduce the number of documents that have state embedded in them
  936. inherently.  For example, if a shopping-basket-style application always
  937. displays a user's current basket contents on each page, those pages
  938. cannot be cached, because each user's basket's contents would be
  939. different.  On the other hand, if each page contains just a link that
  940. allows the user to ``Look at My Shopping Basket,'' the page can be
  941. cached.
  942.  
  943. 6.3  Implementation Limits
  944.  
  945. Practical user agent implementations have limits on the number and size
  946. of cookies that they can store.  In general, user agents' cookie support
  947. should have no fixed limits.  They should strive to store as many
  948. frequently-used cookies as possible.  Furthermore, general-use user
  949. agents should provide each of the following minimum capabilities
  950. individually, although not necessarily simultaneously:
  951.  
  952.    * at least 300 cookies
  953.  
  954.    * at least 4096 bytes per cookie (as measured by the size of the
  955.      characters that comprise the cookie non-terminal in the syntax
  956.      description of the Set-Cookie2 header)
  957.  
  958.    * at least 20 cookies per unique host or domain name
  959.  
  960. User agents created for specific purposes or for limited-capacity
  961. devices should provide at least 20 cookies of 4096 bytes, to ensure that
  962. the user can interact with a session-based origin server.
  963.  
  964. The information in a Set-Cookie2 response header must be retained in its
  965. entirety.  If for some reason there is inadequate space to store the
  966. cookie, it must be discarded, not truncated.
  967.  
  968. Applications should use as few and as small cookies as possible, and
  969. they should cope gracefully with the loss of a cookie.
  970.  
  971. 6.3.1  Denial of Service Attacks  User agents may choose to set an upper
  972. bound on the number of cookies to be stored from a given host or domain
  973. name or on the size of the cookie information.  Otherwise a malicious
  974. server could attempt to flood a user agent with many cookies, or large
  975. cookies, on successive responses, which would force out cookies the user
  976. agent had received from other servers.  However, the minima specified
  977. above should still be supported.
  978.  
  979.  
  980.  
  981.  
  982.  
  983.  
  984.  
  985.  
  986. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 15]
  987.  
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  995.  
  996.  
  997.  
  998. 7.  PRIVACY
  999.  
  1000. 7.1  User Agent Control
  1001.  
  1002. An origin server could create a Set-Cookie2 header to track the path of
  1003. a user through the server.  Users may object to this behavior as an
  1004. intrusive accumulation of information, even if their identity is not
  1005. evident.  (Identity might become evident if a user subsequently fills
  1006. out a form that contains identifying information.)  This state
  1007. management specification therefore requires that a user agent give the
  1008. user control over such a possible intrusion, although the interface
  1009. through which the user is given this control is left unspecified.
  1010. However, the control mechanisms provided shall at least allow the user
  1011.  
  1012.    * to completely disable the sending and saving of cookies.
  1013.  
  1014.    * to determine whether a stateful session is in progress.
  1015.  
  1016.    * to control the saving of a cookie on the basis of the cookie's
  1017.      Domain attribute.
  1018.  
  1019. Such control could be provided by, for example, mechanisms
  1020.  
  1021.    * to notify the user when the user agent is about to send a cookie to
  1022.      the origin server, offering the option not to begin a session.
  1023.  
  1024.    * to display a visual indication that a stateful session is in
  1025.      progress.
  1026.  
  1027.    * to let the user decide which cookies, if any, should be saved when
  1028.      the user concludes a window or user agent session.
  1029.  
  1030.    * to let the user examine the contents of a cookie at any time.
  1031.  
  1032. A user agent usually begins execution with no remembered state
  1033. information.  It should be possible to configure a user agent never to
  1034. send Cookie headers, in which case it can never sustain state with an
  1035. origin server.  (The user agent would then behave like one that is
  1036. unaware of how to handle Set-Cookie2 response headers.)
  1037.  
  1038. When the user agent terminates execution, it should let the user discard
  1039. all state information.  Alternatively, the user agent may ask the user
  1040. whether state information should be retained; the default should be
  1041. ``no.''  If the user chooses to retain state information, it would be
  1042. restored the next time the user agent runs.
  1043.  
  1044. NOTE: User agents should probably be cautious about using files to store
  1045. cookies long-term.  If a user runs more than one instance of the user
  1046. agent, the cookies could be commingled or otherwise corrupted.
  1047.  
  1048.  
  1049.  
  1050.  
  1051.  
  1052. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 16]
  1053.  
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  1061.  
  1062.  
  1063.  
  1064. 7.2  Protocol Design
  1065.  
  1066. The restrictions on the value of the Domain attribute, and the rules
  1067. concerning unverifiable transactions, are meant to reduce the ways that
  1068. cookies can ``leak'' to the ``wrong'' site.  The intent is to restrict
  1069. cookies to one, or a closely related set of hosts.  Therefore a
  1070. request-host is limited as to what values it can set for Domain.  We
  1071. consider it acceptable for hosts host1.foo.com and host2.foo.com to
  1072. share cookies, but not a.com and b.com.
  1073.  
  1074. Similarly, a server can only set a Path for cookies that are related to
  1075. the request-URI.
  1076.  
  1077.  
  1078. 8.  SECURITY CONSIDERATIONS
  1079.  
  1080. 8.1  Clear Text
  1081.  
  1082. The information in the Set-Cookie2 and Cookie headers is unprotected.
  1083. Two consequences are:
  1084.  
  1085.   1.  Any sensitive information that is conveyed in them is exposed to
  1086.       intruders.
  1087.  
  1088.   2.  A malicious intermediary could alter the headers as they travel in
  1089.       either direction, with unpredictable results.
  1090.  
  1091. These facts imply that information of a personal and/or financial nature
  1092. should only be sent over a secure channel.  For less sensitive
  1093. information, or when the content of the header is a database key, an
  1094. origin server should be vigilant to prevent a bad Cookie value from
  1095. causing failures.
  1096.  
  1097. 8.2  Cookie Spoofing
  1098.  
  1099. Proper application design can avoid spoofing attacks from related
  1100. domains.  Consider:
  1101.  
  1102.   1.  User agent makes request to victim.cracker.edu, gets back cookie
  1103.       session_id="1234" and sets the default domain victim.cracker.edu.
  1104.  
  1105.   2.  User agent makes request to spoof.cracker.edu, gets back cookie
  1106.       session-id="1111", with Domain=".cracker.edu".
  1107.  
  1108.   3.  User agent makes request to victim.cracker.edu again, and passes
  1109.  
  1110.       Cookie: $Version="1"; session_id="1234",
  1111.               $Version="1"; session_id="1111"; $Domain=".cracker.edu"
  1112.  
  1113.       The server at victim.cracker.edu should detect that the second
  1114.       cookie was not one it originated by noticing that the Domain
  1115.  
  1116.  
  1117.  
  1118. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 17]
  1119.  
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  1127.  
  1128.  
  1129.  
  1130.       attribute is not for itself and ignore it.
  1131.  
  1132. 8.3  Unexpected Cookie Sharing
  1133.  
  1134. A user agent should make every attempt to prevent the sharing of session
  1135. information between hosts that are in different domains.  Embedded or
  1136. inlined objects may cause particularly severe privacy problems if they
  1137. can be used to share cookies between disparate hosts.  For example, a
  1138. malicious server could embed cookie information for host a.com in a URI
  1139. for a CGI on host b.com.  User agent implementors are strongly
  1140. encouraged to prevent this sort of exchange whenever possible.
  1141.  
  1142.  
  1143. 9.  OTHER, SIMILAR, PROPOSALS
  1144.  
  1145. Apart from RFC 2109, three other proposals have been made to accomplish
  1146. similar goals.  This specification is an amalgam of Kristol's State-Info
  1147. proposal and Netscape's Cookie proposal.
  1148.  
  1149. Brian Behlendorf proposed a Session-ID header that would be user-agent-
  1150. initiated and could be used by an origin server to track
  1151. ``clicktrails.''  It would not carry any origin-server-defined state,
  1152. however.  Phillip Hallam-Baker has proposed another client-defined
  1153. session ID mechanism for similar purposes.
  1154.  
  1155. While both session IDs and cookies can provide a way to sustain stateful
  1156. sessions, their intended purpose is different, and, consequently, the
  1157. privacy requirements for them are different.  A user initiates session
  1158. IDs to allow servers to track progress through them, or to distinguish
  1159. multiple users on a shared machine.  Cookies are server-initiated, so
  1160. the cookie mechanism described here gives users control over something
  1161. that would otherwise take place without the users' awareness.
  1162. Furthermore, cookies convey rich, server-selected information, whereas
  1163. session IDs comprise user-selected, simple information.
  1164.  
  1165.  
  1166. 10.  HISTORICAL
  1167.  
  1168. 10.1  Compatibility with Existing Implementations
  1169.  
  1170. Existing cookie implementations, based on a Netscape specification, use
  1171. Set-Cookie (not Set-Cookie2) and Cookie headers.  User agents that
  1172. receive both a Set-Cookie and Set-Cookie2 response header in the same
  1173. response must combine the Set-Cookie (``old'' cookie) and Set-Cookie2
  1174. (``new'' cookie) information as described below.  Furthermore, a user
  1175. agent must assume, if it received a Set-Cookie2 response header, that
  1176. the sending server complies with this document and will understand
  1177. Cookie request headers that also follow this specification.
  1178.  
  1179. New cookies must replace both equivalent old and new cookies.  That is,
  1180. if a user agent that follows both this specification and Netscape's
  1181.  
  1182.  
  1183.  
  1184. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 18]
  1185.  
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  1193.  
  1194.  
  1195.  
  1196. original specification receives a Set-Cookie2 response header, and the
  1197. NAME and the Domain and Path attributes match (per the Cookie Management
  1198. section) a Netscape-style cookie, the Netscape-style cookie must be
  1199. discarded, and the user agent must retain only the cookie adhering to
  1200. this specification.
  1201.  
  1202. An origin server that supports user agents that are compatible both with
  1203. Netscape's original proposal and this one must, for a transition period,
  1204. send two response headers.  Set-Cookie contains the ``old'' cookie
  1205. information.  Set-Cookie2 contains the cookie information that is new to
  1206. this specification.  The rules below ensure that the two pieces get
  1207. combined correctly.  Eventually, when the majority of user agents follow
  1208. this specification, the Set-Cookie response header can be phased out,
  1209. and all cookie information can be carried in the Set-Cookie2 response
  1210. header.
  1211.  
  1212. Older user agents that do not understand this specification, but that do
  1213. understand Netscape's original specification, will not recognize the
  1214. Set-Cookie2 response header and will receive and send old cookies.
  1215.  
  1216. Once a server receives a new cookie from a client, it may continue a
  1217. session by sending only Set-Cookie2 response headers.
  1218.  
  1219. 10.1.1  Combining Set-Cookie and Set-Cookie2  Because it may not be sure
  1220. whether a user agent understands new cookies, an origin server should
  1221. send both a Set-Cookie and Set-Cookie2 header.  The user agent
  1222. interprets the combined headers as follows.  First, it must establish a
  1223. one-to-one correspondence between the cookies in the Set-Cookie and
  1224. Set-Cookie2 headers.  It then combines the corresponding parts (as
  1225. separated by a comma) into (the equivalent of) a single Set-Cookie2
  1226. header, adding a semi-colon separator, if necessary, between the
  1227. attributes in the Set-Cookie header and the attributes in the
  1228. corresponding Set-Cookie2 header.  Finally, the user agent interprets
  1229. the resulting Set-Cookie2 header according to this specification.  (Note
  1230. that in this case the Set-Cookie2 response header that the origin server
  1231. sends does not, by itself, conform to this specification.)
  1232.  
  1233. For example, assume the origin server sends n cookies.  After header
  1234. folding (to simplify the explanation), the user agent sees:
  1235.  
  1236.         Set-Cookie:  O1, O2, ..., On
  1237.         Set-Cookie2: N1, N2, ..., Nn
  1238.  
  1239. where each Oi is an old cookie and each Ni is (attributes of) a new
  1240. cookie.  The user agent must treat these two headers as if only
  1241.  
  1242.         Set-Cookie2: O1; N1, O2; N2, ..., On; Nn
  1243.  
  1244. had been sent.  (Obviously the Set-Cookie and Set-Cookie2 headers must
  1245. both contain the same number of cookies.)
  1246.  
  1247.  
  1248.  
  1249.  
  1250. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 19]
  1251.  
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  1259.  
  1260.  
  1261.  
  1262. The Expires attribute (part of Netscape's specification) requires
  1263. special care.
  1264.  
  1265.   1.  Because the Expires attribute is defined as a date whose format
  1266.       has a comma embedded in it, user agents must be careful to turn
  1267.       the value for Expires into a quoted string.  Otherwise the comma
  1268.       could be interpreted as a separator between successive cookies.
  1269.  
  1270.   2.  If a Max-Age attribute is present in the Set-Cookie2 header, it
  1271.       must override any Expires attribute in the Set-Cookie header.
  1272.  
  1273.   3.  A user agent may choose to honor the Expires attribute if there is
  1274.       no Max-Age attribute.
  1275.  
  1276. 10.1.2  An Example  Suppose an origin server sends the following
  1277. response headers:
  1278.  
  1279. Set-Cookie: Customer="WILE_E_COYOTE"; Path="/acme"
  1280. Set-Cookie2: Version="1"
  1281. Set-Cookie: Part_Number="Rocket_Launcher_0001+price=USD1000";
  1282.         Path="/acme"; Expires=Thu, 01-May-97 00:00:00 GMT
  1283. Set-Cookie2:    Max-Age=604800; Version="1"
  1284.  
  1285. After folding like headers together and quoting Expires, these become:
  1286.  
  1287. Set-Cookie: Customer="WILE_E_COYOTE"; Path="/acme",
  1288.         Part_Number="Rocket_Launcher_0001+price=USD1000";
  1289.         Path="/acme"; Expires="Thu, 01-May-97 00:00:00 GMT"
  1290. Set-Cookie2: Version="1",
  1291.         Max-Age=604800; Version="1"
  1292.  
  1293. After matching up and combining corresponding attributes of cookies, and
  1294. inserting semi-colons, these become:
  1295.  
  1296. Set-Cookie2: Customer="WILE_E_COYOTE"; Path="/acme"; Version="1",
  1297.         Part_Number="Rocket_Launcher_0001+price=USD1000";
  1298.         Path="/acme"; Expires="Thu, 01-May-97 00:00:00 GMT";
  1299.         Max-Age=604800; Version="1"
  1300.  
  1301. Thus, there are two cookies to be interpreted according to this
  1302. specification, one named Customer and the other named Part_Number.  The
  1303. latter has both an Expires and a Max-Age attribute; Expires must be
  1304. ignored.
  1305.  
  1306. 10.2  Caching and HTTP/1.0
  1307.  
  1308. Some caches, such as those conforming to HTTP/1.0, will inevitably cache
  1309. the Set-Cookie2 and Set-Cookie headers, because there was no mechanism
  1310. to suppress caching of headers prior to HTTP/1.1.  This caching can lead
  1311. to security problems.  Documents transmitted by an origin server along
  1312. with Set-Cookie2 and Set-Cookie headers usually either will be
  1313.  
  1314.  
  1315.  
  1316. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 20]
  1317.  
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. INTERNET DRAFT   HTTP State Management Mechanism (Rev1)      May 5, 1997
  1325.  
  1326.  
  1327.  
  1328. uncachable, or will be ``pre-expired.''  As long as caches obey
  1329. instructions not to cache documents (following Expires: <a date in the
  1330. past> or Pragma: no-cache (HTTP/1.0), or Cache-control: no-cache
  1331. (HTTP/1.1)) uncachable documents present no problem.  However, pre-
  1332. expired documents may be stored in caches.  They require validation (a
  1333. conditional GET) on each new request, but some cache operators loosen
  1334. the rules for their caches, and sometimes serve expired documents
  1335. without first validating them.  This combination of factors can lead to
  1336. cookies meant for one user later being sent to another user.  The Set-
  1337. Cookie2 and Set-Cookie headers are stored in the cache, and, although
  1338. the document is stale (expired), the cache returns the document in
  1339. response to later requests, including cached headers.
  1340.  
  1341.  
  1342. 11.  ACKNOWLEDGEMENTS
  1343.  
  1344. This document really represents the collective efforts of the following
  1345. people, in addition to the authors: Roy Fielding, Yaron Goland, Marc
  1346. Hedlund, Ted Hardie, Koen Holtman, Shel Kaphan, Rohit Khare.
  1347.  
  1348.  
  1349. 12.  AUTHORS' ADDRESSES
  1350.  
  1351. David M. Kristol
  1352. Bell Laboratories, Lucent Technologies
  1353. 600 Mountain Ave.  Room 2A-227
  1354. Murray Hill, NJ  07974
  1355.  
  1356. Phone: (908) 582-2250
  1357. FAX: (908) 582-5809
  1358. Email: dmk@bell-labs.com
  1359.  
  1360. Lou Montulli
  1361. Netscape Communications Corp.
  1362. 501 E. Middlefield Rd.
  1363. Mountain View, CA  94043
  1364.  
  1365. Phone: (415) 528-2600
  1366. Email: montulli@netscape.com
  1367.  
  1368.  
  1369.  
  1370.  
  1371.                                                 Expires November 5, 1997
  1372.  
  1373.  
  1374.  
  1375.  
  1376.  
  1377.  
  1378.  
  1379.  
  1380.  
  1381.  
  1382. Kristol           draft-ietf-http-state-man-mec-01.txt         [Page 21]
  1383.  
  1384.  
  1385.  
  1386.  
  1387.