|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ESI Language Specification Edge Architecture Specification ESI Invalidation Protocol JESI Tag Library Specification |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
ESI Invalidation Protocol 1.0
©2001 Oracle Corporation. All Rights Reserved. Table of Contents:
Abstract
This specification defines the ESI Invalidation Protocol, to allow for tight coherence between origin serves and surrogates (also know as "Reverse Proxies"). This document describes invalidation protocols for doing ESI invalidation of cached page documents. An invalidation request is an XML document sent over HTTP using HTTP/1.1 POST method. The syntax for an invalidation request is dictated by WCSinvalidation.dtd, the DTD (Document Type Definition) file which is defined later. There is no official HTTP port reserved for invalidation yet, but there should be effort to petition for an official invalidation HTTP port. An implementation uses port 4001 for example. Invalidation request authentication is done by using HTTP/1.1 basic authentication. An invalidation account should be created for this purpose. In one implementation, all invalidation is done by using the identity of a special account called "invalidator". Invalidation request. The body of the invalidation is a valid XML document, in which a list of one or more invalidation objects is given. An invalidation object consists of a selector-action pair which means for all page documents that match the selector, action should be applied. An invalidation object completes successfully if the action is successfully applied to all the documents selected. An entire invalidation request is successful if all of its invalidation objects complete successfully. If no page document is selected in an invalidation object, the invalidation object is still considered successful in the sense that it is over an empty set of page documents. Invalidation response. Invalidation response is sent over HTTP as well. If the invalidation request is successful, the HTTP response code is 200, and the body of the invalidation response is a valid XML document, in which a list of invalidation object results is given-one for each corresponding invalidation object in the invalidation request. An invalidation object result consists of a selector-result pair, in which selector is the same as that of the corresponding invalidation object and result details the status of invalidation for this invalidation object. If the invalidation fails, a non-200 HTTP response code is returned. And the body of invalidation response is just an HTTP message, describing further error message. Invalidation DTD for Requests and Responses One of the goals of designing the invalidation DTD is to make it as general as possible so that it can accommodate wide range of requirements and future development. A valid invalidation message has to be a valid XML instance in the first place. Therefore, the first line of the document has to be <?xml version="1.0"?> Note that no white space is allowed before "<". Through the document, any literal use of ampersand "&", less-than "<", greater-than ">", double-quote""", and apostrophe "'" has to be escaped with "&", "<", ">", """ and "'" respectively. For more information, please refer to XML standards. The following shows the entire content of WCSinvalidation.dtd. <!-- WCSinvalidation.dtd is the DTD file that describes a valid -- Webcache invalidation XML message for request and response. --> <!-- root element for invalidation request --> <!ELEMENT INVALIDATION (SYSTEM?,OBJECT+)> <!-- VERSION is currently "WCS-1.0" without the quotes --> <!ATTLIST INVALIDATION VERSION CDATA #REQUIRED > <!ELEMENT SYSTEM (SYSTEMINFO+)> <!ELEMENT SYSTEMINFO EMPTY> <!ATTLIST SYSTEMINFO NAME CDATA #REQUIRED VALUE CDATA #IMPLIED > <!ELEMENT OBJECT ((BASICSELECTOR|ADVANCEDSELECTOR), ACTION)> <!ELEMENT BASICSELECTOR EMPTY> <!ATTLIST BASICSELECTOR URI CDATA #REQUIRED > <!ELEMENT ADVANCEDSELECTOR (COOKIE|HEADER|OTHER)*> <!ATTLIST ADVANCEDSELECTOR URIPREFIX CDATA #REQUIRED HOST CDATA #IMPLIED URIEXP CDATA #IMPLIED METHOD CDATA #IMPLIED BODYEXP CDATA #IMPLIED > <!ELEMENT COOKIE EMPTY> <!ATTLIST COOKIE NAME CDATA #REQUIRED VALUE CDATA #IMPLIED > <!ELEMENT HEADER EMPTY> <!ATTLIST HEADER NAME CDATA #REQUIRED VALUE CDATA #IMPLIED > <!ELEMENT OTHER EMPTY> <!ATTLIST OTHER TYPE CDATA #REQUIRED NAME CDATA #REQUIRED VALUE CDATA #IMPLIED > <!ELEMENT ACTION EMPTY> <!ATTLIST ACTION REMOVALTTL CDATA #IMPLIED > <!-- root element for invalidation response --> <!ELEMENT INVALIDATIONRESULT (SYSTEM?, OBJECTRESULT+)> <!-- VERSION is currently "WCS-1.0" without the quotes --> <!ATTLIST INVALIDATION VERSION CDATA #REQUIRED > <!ELEMENT OBJECTRESULT ((BASICSELECTOR|ADVANCEDSELECTOR), RESULT)> <!ELEMENT RESULT EMPTY> <!ATTLIST RESULT ID CDATA #REQUIRED STATUS CDATA #REQUIRED NUMINV CDATA #REQUIRED > The body of a valid invalidation request should begin with <?xml version="1.0" ?> <!DOCTYPE INVALIDATION SYSTEM "internal:///WCSinvalidation.dtd"> Therefore the root element for an invalidation request must be INVALIDATION, which contains a list of one or more OBJECT elements. And the body of the invalidation response begins with <?xml version="1.0"?> <!DOCTYPE INVALIDATIONRESULT SYSTEM "internal:///WCSinvalidation.dtd"> Likewise, the root element for an invalidation response must be INVALIDATIONRESULT, which contains a list of one or more OBJECTRESULT elements, each one of which matches one OBJECT element in the invalidation request. Both INVALIDATION and INVALIDATIONRESULT take VESION as attribute to denote what version the WCSinvalidation.dtd is being used as XML document type. Also note that the SYSTEM element is optional and intended for use to send system information by any implementation that supports WCSinvalidation.dtd. Each implementation can choose to use it or ignore it since it is optional. The meanings for all the elements and attributes are discussed below. An invalidation selector defines a set of page documents upon which the invalidation action is to be performed. There are two types of selectors: basic selectors and advanced selectors. Basic. A basic selector contains an exact HTTP URI, which specifies what page document to be invalidated. The definitions for URI and its comparison are found in HTTP/1.1 specification. It is easy to see that a basic selector can select either none or exactly one page object. An implementation chooses to ignore the host name in URI and only keeps the abs_path. For definition of abs_path, also refer to HTTP/1.1 specification. Advanced. An advanced selector is defined based on the following attributes and elements:
The advanced selector is more sophisticated than the basic selector. Its descriptive capability in URLs is as powerful as regular expression itself. In fact, a basic selector can be expressed in the form of the advanced selector. For example, suppose the URI in basic selector is "/p1/p2/p3/file.htm", then in the equivalent advanced selector, the URIPREFIX is "/p1/p2/p3/" and the URIEXP is "^/p1/p2/p3/file.htm$". If you choose to specify "/" for the URIPREFIX, it is still okay. Since the regular expression is done against the set of page objects containing the common URIPREFIX path prefix, it is obvious that the smaller the set, the more efficient the invalidation. An invalidation action consists of an implicit immediate expiration and an optional removal TTL (or time-to-live). The removal TTL is non-negative number in seconds. If the removal TTL is missing, then it means to remove the selected page documents on demand in the next appropriate cycle. Since in one invalidation XML message there can be more than one invalidation object, it is possible that some page documents are affected by more than one action if they are selected by more than one invalidation objects. In this situation, the earliest removal time always prevails. An invalidation result contains 3 fields and they are all of string type.
Any client that is capable of sending and receiving HTTP messages can be used to do invalidation clients. The simplest client is Telnet. Here is a walk-through of the transcript for an invalidation request and response done by using Telnet program in one invalidation implementation.
Line 1 specifies using HTTP/1.0 POST method to request "/x-invalidate". All invalidation requests must contain a URI that the implementation chooses to use. Line 2 specifies using HTTP basic authentication and "aW52YWxpZGF0b3I6aW52YWxpZGF0b3I=" really is "invalidator:invalidator" after the base64 encoding. Line 3 specifies the content length. Line 4 is the separator line. Line 5 declares the following HTTP body contains an XML document. Line 6 specifies the root element of the XML document to be INVALIDATION and its definition of document type is given by WCSinvalidation.dtd. Lines 7 ~ 12 contains one invalidation object which intends to invalidate "/cache.htm" if it is in the cache. Here is the response for a successful invalidation of "/cache.htm".
Lines 1 contains the 200 HTTP response code to denote successful invalidation. Line 2 ~ 7 are other HTTP headers. Please refer to HTTP and ESI standards for more details. Line 7 is the separator line between headers and body. Line 8 declares that the HTTP body is an XML document. Line 9 specifies the root element of the XML document to be INVALIDATIONRESULT and its definition of document type is also given by WCSinvalidation.dtd. Lines 10 ~ 15 contains one invalidation object result, which says the action specified against the selection is successful, and there is 1 match for the selection in the cache. |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
***
COPYRIGHT (C) 2001, ORACLE CORPORATION, AKAMAI TECHNOLOGIES, INC. ALL RIGHTS RESERVED. ORACLE AND AKAMAI PROVIDE THE INFORMATION ON THIS WEB SITE (THE "INFORMATION") FOR INFORMATIONAL PURPOSES ONLY, AND THE INFORMATION IS SUBJECT TO CHANGE WITHOUT NOTICE. NO LICENSES, EXPRESS OR IMPLIED, ARE GRANTED BY THE POSTING OF THE INFORMATION. YOU DO NOT ACQUIRE ANY RIGHTS, EXPRESS OR IMPLIED, TO THE INFORMATION, INCLUDING, WITHOUT LIMITATION, ANY RIGHT TO USE THE INFORMATION. ORACLE AND AKAMAI SHALL RETAIN ALL RIGHTS TO THE INFORMATION. Home | Overview | Endorsers | Specification | News | Contact Us |