HTTP State Management Mechanism

RFC 2109 / RFC 2965 HTTP State Management Mechanism

[2966] RFC 2109, RFC 2965RFC 6265 により廃止されています。

HTTP State Management Mechanism

Status of this Memo

This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited.

この文書IETF が発行した RFC の翻訳文を含んでいます。 翻訳は規定の一部ではありません。

原文:

Copyright Notice

Copyright (C) The Internet Society (2000). All Rights Reserved.

IESG Note

The IESG notes that this mechanism makes use of the .local top-level domain (TLD) internally when handling host names that don't contain any dots, and that this mechanism might not work in the expected way should an actual .local TLD ever be registered.

1. ABSTRACT Abstract

This document specifies a way to create a stateful session with HTTP requests and responses. It describes two new headers, Cookie and Set-Cookie, which carry state information between participating origin servers and user agents. The method described here differs from Netscape's Cookie proposal, but it can interoperate with HTTP/1.0 user agents that use Netscape's method. (See the HISTORICAL section.)

Hypertext Transfer Protocol (HTTP) requests and responses. It describes three new headers, Cookie, Cookie2, and Set-Cookie2, which carry state information between participating origin servers and user agents. The method described here differs from Netscape's Cookie proposal [Netscape], but it can interoperate with HTTP/1.0 user agents that use Netscape's method. (See the HISTORICAL section.)

This document reflects implementation experience with RFC 2109 and obsoletes it.

2. 1. TERMINOLOGY

-   The terms user agent, client, server, proxy, and origin server have
-   the same meaning as in the HTTP/1.0 specification.
+   The terms user agent, client, server, proxy, origin server, and
+   http_URL have the same meaning as in the HTTP/1.1 specification
+   [RFC2616].  The terms abs_path and absoluteURI have the same meaning
+   as in the URI Syntax specification [RFC2396].
 
-   Fully-qualified host name (FQHN) means either the fully-qualified
-   domain name (FQDN) of a host (i.e., a completely specified domain
-   name ending in a top-level domain such as .com or .uk), or the
-   numeric Internet Protocol (IP) address of a host.  The fully
-   qualified domain name is preferred; use of numeric IP addresses is
-   strongly discouraged.
+   Host name (HN) means either the host domain name (HDN) or the numeric
+   Internet Protocol (IP) address of a host.  The fully qualified domain
+   name is preferred; use of numeric IP addresses is strongly
+   discouraged.
 
    The terms request-host and request-URI refer to the values the client
    would send to the server as, respectively, the host (but not port)
    and abs_path portions of the absoluteURI (http_URL) of the HTTP
-   request line.  Note that request-host must be a FQHN.
+   request line.  Note that request-host is a HN.
 
-   Hosts names can be specified either as an IP address or a FQHN
-   string.  Sometimes we compare one host name with another.  Host A's
-   name domain-matches host B's if
+   The term effective host name is related to host name.  If a host name
+   contains no dots, the effective host name is that name with the
+   string .local appended to it.  Otherwise the effective host name is
+   the same as the host name.  Note that all effective host names
+   contain at least one dot.
 
-   * both host names are IP addresses and their host name strings match
-     exactly; or
+   The term request-port refers to the port portion of the absoluteURI
+   (http_URL) of the HTTP request line.  If the absoluteURI has no
+   explicit port, the request-port is the HTTP default, 80.  The
+   request-port of a cookie is the request-port of the request in which
+   a Set-Cookie2 response header was returned to the user agent.
 
-   * both host names are FQDN strings and their host name strings match
-     exactly; or
+   Host names can be specified either as an IP address or a HDN string.
+   Sometimes we compare one host name with another.  (Such comparisons
+   SHALL be case-insensitive.)  Host A's name domain-matches host B's if
 
-   * A is a FQDN string and has the form NB, where N is a non-empty name
-     string, B has the form .B', and B' is a FQDN string.  (So, x.y.com
-     domain-matches .y.com but not y.com.)
+      *  their host name strings string-compare equal; or
+
+      * A is a HDN string and has the form NB, where N is a non-empty
+         name string, B has the form .B', and B' is a HDN string.  (So,
+         x.y.com domain-matches .Y.com but not Y.com.)
 
    Note that domain-match is not a commutative operation: a.b.c.com
    domain-matches .c.com, but not the reverse.
 
+   The reach R of a host name H is defined as follows:
+
+      *  If
+
+         -  H is the host domain name of a host; and,
+
+         -  H has the form A.B; and
+
+         -  A has no embedded (that is, interior) dots; and
+
+         -  B has at least one embedded dot, or B is the string "local".
+            then the reach of H is .B.
+
+      *  Otherwise, the reach of H is H.
+
+   For two strings that represent paths, P1 and P2, P1 path-matches P2
+   if P2 is a prefix of P1 (including the case where P1 and P2 string-
+   compare equal).  Thus, the string /tec/waldo path-matches /tec.

Because it was used in Netscape's original implementation of state management, we will use the term cookie to refer to the state information that passes between an origin server and user agent, and that gets stored by the user agent.

1.1 Requirements

The key words "MAY", "MUST", "MUST NOT", "OPTIONAL", "RECOMMENDED", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT" in this document are to be interpreted as described in RFC 2119 [RFC2119].

3. 2. STATE AND SESSIONS

[4]

This document describes a way to create stateful sessions with HTTP requests and responses. Currently, HTTP servers respond to each client request without relating that request to previous or subsequent requests; the technique the state management mechanism allows clients and servers that wish to exchange state information to place HTTP requests and responses within a larger context, which we term a "session". This context might be used to create, for example, a "shopping cart", in which user selections can be aggregated before purchase, or a magazine browsing system, in which a user's previous reading affects which offerings are presented.

この文書は HTTP要求応答状態を持ったセッション (stateful session) を作る方法を説明します。 現在、HTTP クライアント要求それぞれに対して、 以前や以後の要求と関連付けすることなく応答しています。 この技術この状態管理機構によって、 状態 (state) 情報を交換したいと思うクライアントは、 HTTP要求応答の群をより大きな文脈 (context) に配置できるようになります。 この文脈をセッション (session) と呼びます。 この文脈は例えば「買い物籠」といって利用者が選択したものを購入前に集めておくために使うことができますし、 雑誌閲覧システムで利用者の閲覧履歴に基づきどの雑誌を候補として提示するかを決めるために使うこともできます。

There are, of course, many different potential contexts and thus many different potential types of session. The designers' paradigm for sessions created by the exchange of cookies has these key attributes:

  1. Each session has a beginning and an end.
  2. Each session is relatively short-lived.
  3. Either the user agent or the origin server may terminate a session.
  4. The session is implicit in the exchange of state information.

もちろん文脈となり得るものは色々ありますし、ひいてはセッションの種類も色々となるでしょう。 Cookie の交換によって作られるセッションの設計者のパラダイムにはいくつか鍵となる属性がありmさう。

  1. セッションには始まりと終わりがあります。
  2. セッションは比較的短期間で終わります。
  3. 利用者エージェント起源鯖のどちらがセッションを終了させても構いません。
  4. セッション状態情報の交換の中に暗示的に存在します。

Neither clients nor servers are required to support cookies. A server MAY refuse to provide content to a client that does not return the cookies it sends.

クライアントのいずれも、Cookie への対応は必須ではありません。 は、自身が送信した Cookie を返さないクライアント内容を提供することを拒んでも構いません

4. OUTLINE 3. DESCRIPTION

-   We outline here a way for an origin server to send state information
+   We describe here a way for an origin server to send state information
    to the user agent, and for the user agent to return the state
    information to the origin server.  The goal is to have a minimal
+   impact on HTTP and user agents.
-   impact on HTTP and user agents.  Only origin servers that need to
-   maintain sessions would suffer any significant impact, and that
-   impact can largely be confined to Common Gateway Interface (CGI)
-   programs, unless the server provides more sophisticated state
-   management support.  (See Implementation Considerations, below.)

4.1 3.1 Syntax: General

The two state management headers, Set-Cookie2 and Cookie, have common syntactic properties involving attribute-value pairs. The following grammar uses the notation, and tokens DIGIT (decimal digits), and token (informally, a sequence of non-special, non-white space characters), and http_URL from the HTTP/1.1 specification [RFC 2068] [RFC2616] to describe their syntax.

2つの状態管理頭、 Set-Cookie Set-Cookie2Cookie は、両方共構文的に同じ属性と値の組を使っています。 次の文法は、構文を説明するために HTTP/1.1 仕様書の記法と字句 DIGIT (十進数字)、 token (簡単に言えば特殊でない空白でない文字の列)http_URL を使います。

  • av-pairs = av-pair *(";" av-pair)
  • av-pair = attr ["=" value] ; optional value
  • attr = token
  • value = word
  • word = token | quoted-string
  • value = token | quoted-string

Attributes (names) (attr) are case-insensitive. White space is permitted between tokens. Note that while the above syntax description shows value as optional, most attrs require them.

属性(名) (attr) は大文字・小文字を区別しません。 字句の間に空白が認められます。この構文記述は値を省略可能としていますが、 ほとんどの attr では必須であることに注意して下さい。

NOTE: The syntax above allows whitespace between the attribute and the = sign.

注意: この構文は属性と = 記号の間に空白を認めています。

4.2 3.2 Origin Server Role

4.2.1 3.2.1 General

The origin server initiates a session, if it so desires. (Note that "session" here does not refer to a persistent network connection but to a logical session created from HTTP requests and responses. The presence or absence of a persistent connection should have no effect on the use of cookie-derived sessions). To initiate a session do so, the origin server it returns an extra response header to the client, Set-Cookie Set-Cookie2. (The details follow later.)

起源鯖は必要ならセッションを初期化します。 (ここでセッションは持続的なネットワーク接続を指すのではなく、 HTTP要求応答によって論理的に作られるセッションを指すことに注意。持続的接続であるか否かは cookie によるセッションの使用と無関係であるべきです。) セッションを初期化するために起源鯖クライアントSet-Cookie Set-Cookie2 という応答頭を付け加えます。 (詳細は後述します。)

A user agent returns a Cookie request header (see below) to the origin server if it chooses to continue a session. The origin server may MAY ignore it or use it to determine the current state of the session. It may MAY send back to the client a Set-Cookie Set-Cookie2 response header with the same or different information, or it may MAY send no Set-Cookie Set-Cookie2 header at all. The origin server effectively ends a session by sending the client a Set-Cookie Set-Cookie2 header with Max-Age=0.

利用者エージェントセッションを継続したければ起源鯖Cookie 要求頭 (後述) を返します。起源鯖はこれを無視しても構いませんし、 セッションの現在の状態を決定するために使っても構いません起源鯖クライアントに同じ情報でも異なる情報でも Set-Cookie Set-Cookie2 要求頭を送り返して構いませんし、まったく Set-Cookie Set-Cookie2 頭を送らなくても構いません起源鯖クライアントMax-Age=0Set-Cookie Set-Cookie2 を送ることによって実効的にセッションを終了させることができます。

Servers may MAY return a Set-Cookie Set-Cookie2 response headers with any response. User agents should SHOULD send Cookie request headers, subject to other rules detailed below, with every request.

は任意の応答Set-Cookie Set-Cookie2 応答頭を返して構いません利用者エージェントは後で詳述する規則に従って各要求において Cookie 要求頭を送るべきです

An origin server may MAY include multiple Set-Cookie Set-Cookie2 headers in a response. Note that an intervening gateway could fold multiple such headers into a single header.

起源鯖は一つの応答に複数の Set-Cookie Set-Cookie2 頭を含めて構いません。仲介する関門が複数の頭を一つの頭に畳むかもしれないことに注意して下さい。

5. 4. EXAMPLES

-5.1  Example 1
+4.1  Example 1
 
    Most detail of request and response headers has been omitted.  Assume
    the user agent has no stored cookies.
 
      1.  User Agent -> Server
 
          POST /acme/login HTTP/1.1
          [form data]
 
          User identifies self via a form.

      2.  Server -> User Agent
 
          HTTP/1.1 200 OK
-         Set-Cookie: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"
+        Set-Cookie2: Customer="WILE_E_COYOTE"; Version="1"; Path="/acme"
 
          Cookie reflects user's identity.
 
      3.  User Agent -> Server
 
          POST /acme/pickitem HTTP/1.1
          Cookie: $Version="1"; Customer="WILE_E_COYOTE"; $Path="/acme"
          [form data]

User selects an item for "shopping basket".

      4.  Server -> User Agent
 
          HTTP/1.1 200 OK
-         Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";
+        Set-Cookie2: Part_Number="Rocket_Launcher_0001"; Version="1";
                  Path="/acme"
 
          Shopping basket contains an item.

      5.  User Agent -> Server
 
          POST /acme/shipping HTTP/1.1
          Cookie: $Version="1";
                  Customer="WILE_E_COYOTE"; $Path="/acme";
                  Part_Number="Rocket_Launcher_0001"; $Path="/acme"
          [form data]
 
          User selects shipping method from form.
 
      6.  Server -> User Agent
 
          HTTP/1.1 200 OK
-         Set-Cookie: Shipping="FedEx"; Version="1"; Path="/acme"
+        Set-Cookie2: Shipping="FedEx"; Version="1"; Path="/acme"
 
          New cookie reflects shipping method.
 
      7.  User Agent -> Server
 
          POST /acme/process HTTP/1.1
          Cookie: $Version="1";
                  Customer="WILE_E_COYOTE"; $Path="/acme";
                  Part_Number="Rocket_Launcher_0001"; $Path="/acme";
                  Shipping="FedEx"; $Path="/acme"
          [form data]

          User chooses to process order.
 
      8.  Server -> User Agent
 
          HTTP/1.1 200 OK
 
          Transaction is complete.
 
    The user agent makes a series of requests on the origin server, after
    each of which it receives a new cookie.  All the cookies have the
-   same Path attribute and (default) domain.  Because the request URLs
+   same Path attribute and (default) domain.  Because the request-URIs
-   all have /acme as a prefix, and that matches the Path attribute, each
+   all path-match /acme, the Path attribute of each cookie, each request
-   request contains all the cookies received so far.
+   contains all the cookies received so far.
 
-5.2  Example 2
+4.2  Example 2
 
    This example illustrates the effect of the Path attribute.  All
    detail of request and response headers has been omitted.  Assume the
    user agent has no stored cookies.
 
    Imagine the user agent has received, in response to earlier requests,
    the response headers

-   Set-Cookie: Part_Number="Rocket_Launcher_0001"; Version="1";
+   Set-Cookie2: Part_Number="Rocket_Launcher_0001"; Version="1";
            Path="/acme"
 
    and
 
-   Set-Cookie: Part_Number="Riding_Rocket_0023"; Version="1";
+   Set-Cookie2: Part_Number="Riding_Rocket_0023"; Version="1";
            Path="/acme/ammo"
 
    A subsequent request by the user agent to the (same) server for URLs
    of the form /acme/ammo/...  would include the following request
    header:
 
    Cookie: $Version="1";
            Part_Number="Riding_Rocket_0023"; $Path="/acme/ammo";
            Part_Number="Rocket_Launcher_0001"; $Path="/acme"
 
    Note that the NAME=VALUE pair for the cookie with the more specific
    Path attribute, /acme/ammo, comes before the one with the less
    specific Path attribute, /acme.  Further note that the same cookie
    name appears more than once.
 
    A subsequent request by the user agent to the (same) server for a URL
    of the form /acme/parts/ would include the following request header:

Cookie: $Version="1"; Part_Number="Rocket_Launcher_0001"; $Path="/acme"

    Here, the second cookie's Path attribute /acme/ammo is not a prefix
    of the request URL, /acme/parts/, so the cookie does not get
    forwarded to the server.

6. 5. IMPLEMENTATION CONSIDERATIONS

-   Here we speculate on likely or desirable details for an origin server
+   Here we provide guidance on likely or desirable details for an origin
-   that implements state management.
+   server that implements state management.
 
-6.1  Set-Cookie Content
+5.1  Set-Cookie2 Content
 
    An origin server's content should probably be divided into disjoint
    application areas, some of which require the use of state
    information.  The application areas can be distinguished by their
-   request URLs.  The Set-Cookie header can incorporate information
+   request URLs.  The Set-Cookie2 header can incorporate information
    about the application areas by setting the Path attribute for each
    one.
 
    The session information can obviously be clear or encoded text that
    describes state.  However, if it grows too large, it can become
    unwieldy.  Therefore, an implementor might choose for the session
    information to be a key to a server-side resource.  Of course, using
    a database creates some problems that this state management
    specification was meant to avoid, namely:
 
      1.  keeping real state on the server side;
 
      2.  how and when to garbage-collect the database entry, in case the
          user agent terminates the session by, for example, exiting.
 
-6.2  Stateless Pages
+5.2  Stateless Pages
 
    Caching benefits the scalability of WWW.  Therefore it is important
    to reduce the number of documents that have state embedded in them
    inherently.  For example, if a shopping-basket-style application
    always displays a user's current basket contents on each page, those
    pages cannot be cached, because each user's basket's contents would
    be different.  On the other hand, if each page contains just a link
    that allows the user to "Look at My Shopping Basket", the page can be
    cached.
 
-6.3  Implementation Limits
+5.3  Implementation Limits
 
    Practical user agent implementations have limits on the number and
    size of cookies that they can store.  In general, user agents' cookie
    support should have no fixed limits.  They should strive to store as
    many frequently-used cookies as possible.  Furthermore, general-use
-   user agents should provide each of the following minimum capabilities
+   user agents SHOULD provide each of the following minimum capabilities
    individually, although not necessarily simultaneously:
 
       * at least 300 cookies
 
-      * at least 4096 bytes per cookie (as measured by the size of the
-        characters that comprise the cookie non-terminal in the syntax
-        description of the Set-Cookie header)
+      *  at least 4096 bytes per cookie (as measured by the characters
+         that comprise the cookie non-terminal in the syntax description
+         of the Set-Cookie2 header, and as received in the Set-Cookie2
+         header)
 
       * at least 20 cookies per unique host or domain name
 
    User agents created for specific purposes or for limited-capacity
-   devices should provide at least 20 cookies of 4096 bytes, to ensure
+   devices SHOULD provide at least 20 cookies of 4096 bytes, to ensure
    that the user can interact with a session-based origin server.
 
-   The information in a Set-Cookie response header must be retained in
+   The information in a Set-Cookie2 response header MUST be retained in
    its entirety.  If for some reason there is inadequate space to store
-   the cookie, it must be discarded, not truncated.
+   the cookie, it MUST be discarded, not truncated.
 
    Applications should use as few and as small cookies as possible, and
    they should cope gracefully with the loss of a cookie.
 
-6.3.1  Denial of Service Attacks
+   5.3.1  Denial of Service Attacks  User agents MAY choose to set an
+   upper bound on the number of cookies to be stored from a given host
+   or domain name or on the size of the cookie information.  Otherwise a
+   malicious server could attempt to flood a user agent with many
+   cookies, or large cookies, on successive responses, which would force
+   out cookies the user agent had received from other servers.  However,
+   the minima specified above SHOULD still be supported.
-   User agents may choose to set an upper bound on the number of cookies
-   to be stored from a given host or domain name or on the size of the
-   cookie information.  Otherwise a malicious server could attempt to
-   flood a user agent with many cookies, or large cookies, on successive
-   responses, which would force out cookies the user agent had received
-   from other servers.  However, the minima specified above should still
-   be supported.
-7.  PRIVACY
+6.  PRIVACY
 
+   Informed consent should guide the design of systems that use cookies.
+   A user should be able to find out how a web site plans to use
+   information in a cookie and should be able to choose whether or not
+   those policies are acceptable.  Both the user agent and the origin
+   server must assist informed consent.

-7.1  User Agent Control
+6.1  User Agent Control

-   An origin server could create a Set-Cookie header to track the path
+   An origin server could create a Set-Cookie2 header to track the path
    of a user through the server.  Users may object to this behavior as
    an intrusive accumulation of information, even if their identity is
-   not evident.  (Identity might become evident
+   not evident.  (Identity might become evident, for example,
if a user subsequently fills out a form that contains identifying information.)
This state management specification therefore requires that a user
agent give the user control over such a possible intrusion, although
the interface through which the user is given this control is left
-   unspecified.  However, the control mechanisms provided shall at least
+   unspecified.  However, the control mechanisms provided SHALL at least
    allow the user
 
       * to completely disable the sending and saving of cookies.
 
       * to determine whether a stateful session is in progress.
 
       * to control the saving of a cookie on the basis of the cookie's
         Domain attribute.
 
-   Such control could be provided by, for example, mechanisms
+   Such control could be provided, for example, by mechanisms
 
> *  to notify the user when the user agent is about to send a
-         cookie to the origin server, offering the option not to begin a session.
+         cookie to the origin server, to offer the option not to begin a session.
 
       * to display a visual indication that a stateful session is in
         progress.
 
       * to let the user decide which cookies, if any, should be saved
         when the user concludes a window or user agent session.
 
-      * to let the user examine the contents of a cookie at any time.
+      * to let the user examine and delete the contents of a cookie at
+         any time.
 
    A user agent usually begins execution with no remembered state
-   information.  It should be possible to configure a user agent never
+   information.  It SHOULD be possible to configure a user agent never
    to send Cookie headers, in which case it can never sustain state with
an origin server.  (The user agent would then behave like one that is
-   unaware of how to handle Set-Cookie response headers.)
+   unaware of how to handle Set-Cookie2 response headers.)

-   When the user agent terminates execution, it should let the user
+   When the user agent terminates execution, it SHOULD let the user
-   discard all state information.  Alternatively, the user agent may ask
+   discard all state information.  Alternatively, the user agent MAY ask
the user whether state information should be retained; the default
should be "no".  If the user chooses to retain state information, it
would be restored the next time the user agent runs.
 
    NOTE: User agents should probably be cautious about using files to
    store cookies long-term.  If a user runs more than one instance of
-   the user agent, the cookies could be commingled or otherwise messed
-   up.
+   the user agent, the cookies could be commingled or otherwise
+   corrupted.
 
+6.2  Origin Server Role
 
+   An origin server SHOULD promote informed consent by adding CommentURL
+   or Comment information to the cookies it sends.  CommentURL is
+   preferred because of the opportunity to provide richer information in
+   a multiplicity of languages.
 
-8.1  Clear Text
+6.3  Clear Text
 
-   The information in the Set-Cookie and Cookie headers is unprotected.
-   Two consequences are:
+   The information in the Set-Cookie2 and Cookie headers is unprotected.
+   As a consequence:
 
    1.  Any sensitive information that is conveyed in them is exposed
        to intruders.
 
    2.  A malicious intermediary could alter the headers as they travel
        in either direction, with unpredictable results.
 
    These facts imply that information of a personal and/or financial
    nature should only be sent over a secure channel.  For less sensitive
    information, or when the content of the header is a database key, an
    origin server should be vigilant to prevent a bad Cookie value from
    causing failures.
 
+   A user agent in a shared user environment poses a further risk.
+   Using a cookie inspection interface, User B could examine the
+   contents of cookies that were saved when User A used the machine.
 
-8.  SECURITY CONSIDERATIONS
+7.  SECURITY CONSIDERATIONS
 
-7.2  Protocol Design
+7.1  Protocol Design

> The restrictions on the value of the Domain attribute, and the rules
concerning unverifiable transactions, are meant to reduce the ways
that cookies can "leak" to the "wrong" site.  The intent is to
restrict cookies to one host, or a closely related set of hosts.
Therefore a request-host is limited as to what values it can set for
Domain.  We consider it acceptable for hosts host1.foo.com and
host2.foo.com to share cookies, but not a.com and b.com.

> Similarly, a server can only set a Path only for cookies that are related
to the request-URI.

-8.2  Cookie Spoofing
+7.2  Cookie Spoofing
 
    Proper application design can avoid spoofing attacks from related
    domains.  Consider:
 
      1.  User agent makes request to victim.cracker.edu, gets back
          cookie session_id="1234" and sets the default domain
          victim.cracker.edu.
 
-     2.  User agent makes request to spoof.cracker.edu, gets back
-         cookie session-id="1111", with Domain=".cracker.edu".
+      2. User agent makes request to spoof.cracker.edu, gets back cookie
+         session-id="1111", with Domain=".cracker.edu".
 
      3.  User agent makes request to victim.cracker.edu again, and
          passes
 
-         Cookie: $Version="1";
-                         session_id="1234";
-                         session_id="1111"; $Domain=".cracker.edu"
+         Cookie: $Version="1"; session_id="1234",
+                 $Version="1"; session_id="1111"; $Domain=".cracker.edu"
 
          The server at victim.cracker.edu should detect that the second
          cookie was not one it originated by noticing that the Domain
          attribute is not for itself and ignore it.
 
-8.3  Unexpected Cookie Sharing
+7.3  Unexpected Cookie Sharing
 
-   A user agent should make every attempt to prevent the sharing of
+   A user agent SHOULD make every attempt to prevent the sharing of
    session information between hosts that are in different domains.
    Embedded or inlined objects may cause particularly severe privacy
    problems if they can be used to share cookies between disparate
    hosts.  For example, a malicious server could embed cookie
    information for host a.com in a URI for a CGI on host b.com.  User
    agent implementors are strongly encouraged to prevent this sort of
    exchange whenever possible.
 
+7.4  Cookies For Account Information
+   While it is common practice to use them this way, cookies are not
+   designed or intended to be used to hold authentication information,
+   such as account names and passwords.  Unless such cookies are
+   exchanged over an encrypted path, the account information they
+   contain is highly vulnerable to perusal and theft.
 
-9.  OTHER, SIMILAR, PROPOSALS
+8.  OTHER, SIMILAR, PROPOSALS
-   Three other proposals have been made to accomplish similar goals.
-   This specification is an amalgam of Kristol's State-Info proposal and
-   Netscape's Cookie proposal.
+   Apart from RFC 2109, three other proposals have been made to
+   accomplish similar goals.  This specification began as an amalgam of
+   Kristol's State-Info proposal [DMK95] and Netscape's Cookie proposal
+   [Netscape].
 
> Brian Behlendorf proposed a Session-ID header that would be 
user-agent-initiated and could be used by an origin server to track
"clicktrails".  It would not carry any origin-server-defined state,
however.  Phillip Hallam-Baker has proposed another client-defined
session ID mechanism for similar purposes.

    While both session IDs and cookies can provide a way to sustain
    stateful sessions, their intended purpose is different, and,
    consequently, the privacy requirements for them are different.  A
    user initiates session IDs to allow servers to track progress through
    them, or to distinguish multiple users on a shared machine.  Cookies
    are server-initiated, so the cookie mechanism described here gives
    users control over something that would otherwise take place without
    the users' awareness.  Furthermore, cookies convey rich, server-
    selected information, whereas session IDs comprise user-selected,
    simple information.
 
-10.  HISTORICAL
+9.  HISTORICAL

-10.1  Compatibility With Netscape's Implementation
+9.1  Compatibility with Existing Implementations

-   HTTP/1.0 clients and servers may use Set-Cookie and Cookie headers
-   that reflect Netscape's original cookie proposal.  These notes cover
-   inter-operation between "old" and "new" cookies.

-10.1.1  Extended Cookie Header

-   This proposal adds attribute-value pairs to the Cookie request header
-   in a compatible way.  An "old" client that receives a "new" cookie
-   will ignore attributes it does not understand; it returns what it
-   does understand to the origin server.  A "new" client always sends
-   cookies in the new form.
 
-   An "old" server that receives a "new" cookie will see what it thinks
-   are many cookies with names that begin with a $, and it will ignore
-   them.  (The "old" server expects these cookies to be separated by
-   semi-colon, not comma.)  A "new" server can detect cookies that have
-   passed through an "old" client, because they lack a $Version
-   attribute.
 
-10.1.2  Expires and Max-Age
-   Netscape's original proposal defined an Expires header that took a
-   date value in a fixed-length variant format in place of Max-Age:
 
-   Wdy, DD-Mon-YY HH:MM:SS GMT
 
-   Note that the Expires date format contains embedded spaces, and that
-   "old" cookies did not have quotes around values.  Clients that
-   implement to this specification should be aware of "old" cookies and
-   Expires.

-10.1.3  Punctuation
 
-   In Netscape's original proposal, the values in attribute-value pairs
-   did not accept "-quoted strings.  Origin servers should be cautious
-   about sending values that require quotes unless they know the
-   receiving user agent understands them (i.e., "new" cookies).  A
-   ("new") user agent should only use quotes around values in Cookie
-   headers when the cookie's version(s) is (are) all compliant with this
-   specification or later.

-   In Netscape's original proposal, no whitespace was permitted around
-   the = that separates attribute-value pairs.  Therefore such
-   whitespace should be used with caution in new implementations.

+   Existing cookie implementations, based on the Netscape specification,
+   use the Set-Cookie (not Set-Cookie2) header.  User agents that
+   receive in the same response both a Set-Cookie and Set-Cookie2
+   response header for the same cookie MUST discard the Set-Cookie
+   information and use only the Set-Cookie2 information.  Furthermore, a
+   user agent MUST assume, if it received a Set-Cookie2 response header,
+   that the sending server complies with this document and will
+   understand Cookie request headers that also follow this
+   specification.

+   New cookies MUST replace both equivalent old- and new-style cookies.
+   That is, if a user agent that follows both this specification and
+   Netscape's original specification receives a Set-Cookie2 response
+   header, and the NAME and the Domain and Path attributes match (per
+   the Cookie Management section) a Netscape-style cookie, the
+   Netscape-style cookie MUST be discarded, and the user agent MUST
+   retain only the cookie adhering to this specification.
 
+   Older user agents that do not understand this specification, but that
+   do understand Netscape's original specification, will not recognize
+   the Set-Cookie2 response header and will receive and send cookies
+   according to the older specification.

+   A user agent that supports both this specification and Netscape-style
+   cookies SHOULD send a Cookie request header that follows the older
+   Netscape specification if it received the cookie in a Set-Cookie
+   response header and not in a Set-Cookie2 response header.  However,
+   it SHOULD send the following request header as well:

+        Cookie2: $Version="1"
 
+   The Cookie2 header advises the server that the user agent understands
+   new-style cookies.  If the server understands new-style cookies, as
+   well, it SHOULD continue the stateful session by sending a Set-
+   Cookie2 response header, rather than Set-Cookie.  A server that does
+   not understand new-style cookies will simply ignore the Cookie2
+   request header.

10.2 9.2 Caching and HTTP/1.0

Some caches, such as those conforming to HTTP/1.0, will inevitably cache the Set-Cookie header Set-Cookie2 and Set-Cookie headers, because there was no mechanism to suppress caching of headers prior to HTTP/1.1. This caching can lead to security problems. Documents transmitted by an origin server along with Set-Cookie headers will usually either Set-Cookie2 and Set-Cookie headers usually either will be uncachable, or will be "pre-expired". As long as caches obey instructions not to cache documents (following Expires: <a date in the past> or Pragma: no-cache (HTTP/1.0), or Cache-control: no-cache (HTTP/1.1)) uncachable documents present no problem. However, pre-expired documents may be stored in caches. They require validation (a conditional GET) on each new request, but some cache operators loosen the rules for their caches, and sometimes serve expired documents without first validating them. This combination of factors can lead to cookies meant for one user later The Set-Cookie header is Set-Cookie2 and Set-Cookie headers are stored in the cache, and, although the document is stale (expired), the cache returns the document in response to later requests, including cached headers.

11. 10. ACKNOWLEDGEMENTS

This document really represents the collective efforts of the HTTP Working Group of the IETF and, particularly, the following people, in addition to the authors: Roy Fielding, Yaron Goland, Marc Hedlund, Ted Hardie, Koen Holtman, Shel Kaphan, Rohit Khare, Foteos Macrides, David W. Morris.

12. 11. AUTHORS' ADDRESSES

    David M. Kristol
    Bell Laboratories, Lucent Technologies
-   600 Mountain Ave.  Room 2A-227
+   600 Mountain Ave.  Room 2A-333
    Murray Hill, NJ  07974
 
    Phone: (908) 582-2250
-   Fax: (908) 582-5809
+   Fax: (908) 582-1239
    EMail: dmk@bell-labs.com
 
 
    Lou Montulli
-   Netscape Communications Corp.
-   501 E. Middlefield Rd.
-   Mountain View, CA  94043
+   Epinions.com, Inc.
+   2037 Landings Dr.
+   Mountain View, CA  94301
 
-   Phone: (415) 528-2600
-   EMail: montulli@netscape.com
+   EMail: lou@montulli.org
+12.  REFERENCES
+
+   [DMK95]    Kristol, D.M., "Proposed HTTP State-Info Mechanism",
+              available at http://portal.research.bell-
+              labs.com/~dmk/state-info.html>, September, 1995.
+
+   [Netscape] "Persistent Client State -- HTTP Cookies", available at
+              http://www.netscape.com/newsref/std/cookie_spec.html,
+              undated.
+
+   [RFC2109]  Kristol, D. and L. Montulli, "HTTP State Management
+              Mechanism", RFC 2109, February 1997.
+
+   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
+              Requirement Levels", BCP 14, RFC 2119, March 1997.
+
+   [RFC2279]  Yergeau, F., "UTF-8, a transformation format of Unicode
+              and ISO-10646", RFC 2279, January 1998.
+
+   [RFC2396]  Berners-Lee, T., Fielding, R. and L. Masinter, "Uniform
+              Resource Identifiers (URI): Generic Syntax", RFC 2396,
+              August 1998.
 
+   [RFC2616]  Fielding, R., Gettys, J., Mogul, J., Frystyk, H. and T.
+              Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1",
+              RFC 2616, June 1999.

+13.  Full Copyright Statement
 
+   Copyright (C) The Internet Society (2000).  All Rights Reserved.
 
+   This document and translations of it may be copied and furnished to
+   others, and derivative works that comment on or otherwise explain it
+   or assist in its implementation may be prepared, copied, published
+   and distributed, in whole or in part, without restriction of any
+   kind, provided that the above copyright notice and this paragraph are
+   included on all such copies and derivative works.  However, this
+   document itself may not be modified in any way, such as by removing
+   the copyright notice or references to the Internet Society or other
+   Internet organizations, except as needed for the purpose of
+   developing Internet standards in which case the procedures for
+   copyrights defined in the Internet Standards process must be
+   followed, or as required to translate it into languages other than
+   English.
 
+   The limited permissions granted above are perpetual and will not be
+   revoked by the Internet Society or its successors or assigns.
 
+   This document and the information contained herein is provided on an
+   "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
+   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING
+   BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION
+   HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
+   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
 
+Acknowledgement
 
+   Funding for the RFC Editor function is currently provided by the
+   Internet Society.

License

RFCのライセンス

メモ