⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc2965.txt

📁 著名的RFC文档,其中有一些文档是已经翻译成中文的的.
💻 TXT
📖 第 1 页 / 共 4 页
字号:
   Set-Cookie2 header.  Caching "public" documents is desirable.  For   example, if the origin server wants to use a public document such as   a "front door" page as a sentinel to indicate the beginning of a   session for which a Set-Cookie2 response header must be generated,   the page SHOULD be stored in caches "pre-expired" so that the origin   server will see further requests.  "Private documents", for example   those that contain information strictly private to a session, SHOULD   NOT be cached in shared caches.   If the cookie is intended for use by a single user, the Set-Cookie2   header SHOULD NOT be cached.  A Set-Cookie2 header that is intended   to be shared by multiple users MAY be cached.   The origin server SHOULD send the following additional HTTP/1.1   response headers, depending on circumstances:      *  To suppress caching of the Set-Cookie2 header:         Cache-control: no-cache="set-cookie2"   and one of the following:      *  To suppress caching of a private document in shared caches:         Cache-control: privateKristol & Montulli          Standards Track                     [Page 7]RFC 2965            HTTP State Management Mechanism         October 2000      *  To allow caching of a document and require that it be validated         before returning it to the client:         Cache-Control: must-revalidate, max-age=0      *  To allow caching of a document, but to require that proxy         caches (not user agent caches) validate it before returning it         to the client:         Cache-Control: proxy-revalidate, max-age=0      *  To allow caching of a document and request that it be validated         before returning it to the client (by "pre-expiring" it):         Cache-control: max-age=0         Not all caches will revalidate the document in every case.   HTTP/1.1 servers MUST send Expires: old-date (where old-date is a   date long in the past) on responses containing Set-Cookie2 response   headers unless they know for certain (by out of band means) that   there are no HTTP/1.0 proxies in the response chain.  HTTP/1.1   servers MAY send other Cache-Control directives that permit caching   by HTTP/1.1 proxies in addition to the Expires: old-date directive;   the Cache-Control directive will override the Expires: old-date for   HTTP/1.1 proxies.3.3  User Agent Role   3.3.1  Interpreting Set-Cookie2  The user agent keeps separate track   of state information that arrives via Set-Cookie2 response headers   from each origin server (as distinguished by name or IP address and   port).  The user agent MUST ignore attribute-value pairs whose   attribute it does not recognize.  The user agent applies these   defaults for optional attributes that are missing:   Discard The default behavior is dictated by the presence or absence           of a Max-Age attribute.   Domain  Defaults to the effective request-host.  (Note that because           there is no dot at the beginning of effective request-host,           the default Domain can only domain-match itself.)   Max-Age The default behavior is to discard the cookie when the user           agent exits.   Path    Defaults to the path of the request URL that generated the           Set-Cookie2 response, up to and including the right-most /.Kristol & Montulli          Standards Track                     [Page 8]RFC 2965            HTTP State Management Mechanism         October 2000   Port    The default behavior is that a cookie MAY be returned to any           request-port.   Secure  If absent, the user agent MAY send the cookie over an           insecure channel.   3.3.2  Rejecting Cookies  To prevent possible security or privacy   violations, a user agent rejects a cookie according to rules below.   The goal of the rules is to try to limit the set of servers for which   a cookie is valid, based on the values of the Path, Domain, and Port   attributes and the request-URI, request-host and request-port.   A user agent rejects (SHALL NOT store its information) if the Version   attribute is missing.  Moreover, a user agent rejects (SHALL NOT   store its information) if any of the following is true of the   attributes explicitly present in the Set-Cookie2 response header:      *  The value for the Path attribute is not a prefix of the         request-URI.      *  The value for the Domain attribute contains no embedded dots,         and the value is not .local.      *  The effective host name that derives from the request-host does         not domain-match the Domain attribute.      *  The request-host is a HDN (not IP address) and has the form HD,         where D is the value of the Domain attribute, and H is a string         that contains one or more dots.      *  The Port attribute has a "port-list", and the request-port was         not in the list.   Examples:      *  A Set-Cookie2 from request-host y.x.foo.com for Domain=.foo.com         would be rejected, because H is y.x and contains a dot.      *  A Set-Cookie2 from request-host x.foo.com for Domain=.foo.com         would be accepted.      *  A Set-Cookie2 with Domain=.com or Domain=.com., will always be         rejected, because there is no embedded dot.      *  A Set-Cookie2 with Domain=ajax.com will be accepted, and the         value for Domain will be taken to be .ajax.com, because a dot         gets prepended to the value.Kristol & Montulli          Standards Track                     [Page 9]RFC 2965            HTTP State Management Mechanism         October 2000      *  A Set-Cookie2 with Port="80,8000" will be accepted if the         request was made to port 80 or 8000 and will be rejected         otherwise.      *  A Set-Cookie2 from request-host example for Domain=.local will         be accepted, because the effective host name for the request-         host is example.local, and example.local domain-matches .local.   3.3.3  Cookie Management  If a user agent receives a Set-Cookie2   response header whose NAME is the same as that of a cookie it has   previously stored, the new cookie supersedes the old when: the old   and new Domain attribute values compare equal, using a case-   insensitive string-compare; and, the old and new Path attribute   values string-compare equal (case-sensitive).  However, if the Set-   Cookie2 has a value for Max-Age of zero, the (old and new) cookie is   discarded.  Otherwise a cookie persists (resources permitting) until   whichever happens first, then gets discarded: its Max-Age lifetime is   exceeded; or, if the Discard attribute is set, the user agent   terminates the session.   Because user agents have finite space in which to store cookies, they   MAY also discard older cookies to make space for newer ones, using,   for example, a least-recently-used algorithm, along with constraints   on the maximum number of cookies that each origin server may set.   If a Set-Cookie2 response header includes a Comment attribute, the   user agent SHOULD store that information in a human-readable form   with the cookie and SHOULD display the comment text as part of a   cookie inspection user interface.   If a Set-Cookie2 response header includes a CommentURL attribute, the   user agent SHOULD store that information in a human-readable form   with the cookie, or, preferably, SHOULD allow the user to follow the   http_URL link as part of a cookie inspection user interface.   The cookie inspection user interface may include a facility whereby a   user can decide, at the time the user agent receives the Set-Cookie2   response header, whether or not to accept the cookie.  A potentially   confusing situation could arise if the following sequence occurs:      *  the user agent receives a cookie that contains a CommentURL         attribute;      *  the user agent's cookie inspection interface is configured so         that it presents a dialog to the user before the user agent         accepts the cookie;Kristol & Montulli          Standards Track                    [Page 10]RFC 2965            HTTP State Management Mechanism         October 2000      *  the dialog allows the user to follow the CommentURL link when         the user agent receives the cookie; and,      *  when the user follows the CommentURL link, the origin server         (or another server, via other links in the returned content)         returns another cookie.   The user agent SHOULD NOT send any cookies in this context.  The user   agent MAY discard any cookie it receives in this context that the   user has not, through some user agent mechanism, deemed acceptable.   User agents SHOULD allow the user to control cookie destruction, but   they MUST NOT extend the cookie's lifetime beyond that controlled by   the Discard and Max-Age attributes.  An infrequently-used cookie may   function as a "preferences file" for network applications, and a user   may wish to keep it even if it is the least-recently-used cookie. One   possible implementation would be an interface that allows the   permanent storage of a cookie through a checkbox (or, conversely, its   immediate destruction).   Privacy considerations dictate that the user have considerable   control over cookie management.  The PRIVACY section contains more   information.   3.3.4  Sending Cookies to the Origin Server  When it sends a request   to an origin server, the user agent includes a Cookie request header   if it has stored cookies that are applicable to the request, based on      * the request-host and request-port;      * the request-URI;      * the cookie's age.   The syntax for the header is:cookie          =  "Cookie:" cookie-version 1*((";" | ",") cookie-value)cookie-value    =  NAME "=" VALUE [";" path] [";" domain] [";" port]cookie-version  =  "$Version" "=" valueNAME            =  attrVALUE           =  valuepath            =  "$Path" "=" valuedomain          =  "$Domain" "=" valueport            =  "$Port" [ "=" <"> value <"> ]   The value of the cookie-version attribute MUST be the value from the   Version attribute of the corresponding Set-Cookie2 response header.   Otherwise the value for cookie-version is 0.  The value for the pathKristol & Montulli          Standards Track                    [Page 11]RFC 2965            HTTP State Management Mechanism         October 2000   attribute MUST be the value from the Path attribute, if one was   present, of the corresponding Set-Cookie2 response header.  Otherwise   the attribute SHOULD be omitted from the Cookie request header.  The   value for the domain attribute MUST be the value from the Domain   attribute, if one was present, of the corresponding Set-Cookie2   response header.  Otherwise the attribute SHOULD be omitted from the   Cookie request header.   The port attribute of the Cookie request header MUST mirror the Port   attribute, if one was present, in the corresponding Set-Cookie2   response header.  That is, the port attribute MUST be present if the   Port attribute was present in the Set-Cookie2 header, and it MUST   have the same value, if any.  Otherwise, if the Port attribute was   absent from the Set-Cookie2 header, the attribute likewise MUST be   omitted from the Cookie request header.   Note that there is neither a Comment nor a CommentURL attribute in   the Cookie request header corresponding to the ones in the Set-   Cookie2 response header.  The user agent does not return the comment   information to the origin server.   The user agent applies the following rules to choose applicable   cookie-values to send in Cookie request headers from among all the   cookies it has received.   Domain Selection      The origin server's effective host name MUST domain-match the      Domain attribute of the cookie.   Port Selection      There are three possible behaviors, depending on the Port      attribute in the Set-Cookie2 response header:      1. By default (no Port attribute), the cookie MAY be sent to any         port.      2. If the attribute is present but has no value (e.g., Port), the         cookie MUST only be sent to the request-port it was received         from.      3. If the attribute has a port-list, the cookie MUST only be         returned if the new request-port is one of those listed in         port-list.   Path Selection      The request-URI MUST path-match the Path attribute of the cookie.Kristol & Montulli          Standards Track                    [Page 12]RFC 2965            HTTP State Management Mechanism         October 2000   Max-Age Selection      Cookies that have expired should have been discarded and thus are      not forwarded to an origin server.   If multiple cookies satisfy the criteria above, they are ordered in   the Cookie header such that those with more specific Path attributes   precede those with less specific.  Ordering with respect to other   attributes (e.g., Domain) is unspecified.   Note: For backward compatibility, the separator in the Cookie header   is semi-colon (;) everywhere.  A server SHOULD also accept comma (,)   as the separator between cookie-values for future compatibility.   3.3.5  Identifying What Version is Understood:  Cookie2  The Cookie2   request header facilitates interoperation between clients and servers   that understand different versions of the cookie specification.  When   the client sends one or more cookies to an origin server, if at least   one of those cookies contains a $Version attribute whose value is   different from the version that the client understands, then the   client MUST also send a Cookie2 request header, the syntax for which   is   cookie2 =       "Cookie2:" cookie-version   Here the value for cookie-version is the highest version of cookie   specification (currently 1) that the client understands.  The client   needs to send at most one such request header per request.   3.3.6  Sending Cookies in Unverifiable Transactions  Users MUST have   control over sessions in order to ensure privacy.  (See PRIVACY   section below.)  To simplify implementation and to prevent an   additional layer of complexity where adequate safeguards exist,   however, this document distinguishes between transactions that are   verifiable and those that are unverifiable.  A transaction is   verifiable if the user, or a user-designated agent, has the option to   review the request-URI prior to its use in the transaction.  A   transaction is unverifiable if the user does not have that option.   Unverifiable transactions typically arise when a user agent   automatically requests inlined or embedded entities or when it   resolves redirection (3xx) responses from an origin server.   Typically the origin transaction, the transaction that the user   initiates, is verifiable, and that transaction may directly or   indirectly induce the user agent to make unverifiable transactions.   An unverifiable transaction is to a third-party host if its request-   host U does not domain-match the reach R of the request-host O in the   origin transaction.Kristol & Montulli          Standards Track                    [Page 13]

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -