| only for RuBoard - do not distribute or recompile |
HTCP messages are built on a simple hierarchy of data types. I'll start with the most simple and finish with the complex ones.
A COUNTSTR is a string of ISO8859-1 (Latin-1)
00 05 43 61 63 68 65
5 C a c h e
A SPECIFIER, shown in Figure D-5, encodes an HTTP request using four COUNTSTRs. It is used in TST, SET, and CLR
Figure D-6 shows the DETAIL type, which is used in TST response messages. It provides the information about a cached response. These are all HTTP-style headers with CRLF line termination. RESP-HDRS is the set of HTTP response headers, as defined in Section 6.2 of RFC 2616. These include
Etag
,
Age
, and others. ENTITY-HDRS is the set of HTTP headers defined in Section 7.1 of RFC 2616. These include
Expires
,
Last-modified
, and others. CACHE-HDRS, on the other hand, are defined by HTCP, rather than HTTP. They are used to
As you can see in Figure D-7, IDENTITY is just a combination of SPECIFIER and DETAIL. It is used for the MON and SET opcodes.
| only for RuBoard - do not distribute or recompile |
| only for RuBoard - do not distribute or recompile |
HTCP/0.0 defines five opcodes: NOP, TST, MON, SET, and CLR. Note that ICP has different opcodes for queries and replies ”for example, ICP_OP_QUERY and ICP_OP_MISS. HTCP, however, uses the same opcode for both messages. The previously described RR flag indicates whether a given message is a request or a response. The following sections describe each opcode, including how each one uses the OP-DATA field.
The NOP (null operation) opcode is similar to an ICMP echo or a "ping" message. It can be used to measure network delays between caches, as well as simply to find out if they are
There is no OP-DATA for either NOP queries or responses, and the RESPONSE code is always zero.
The TST (test) opcode is similar to the ICP query operation. It tests for the existence of a cached response in a neighbor cache.
For a TST request, the OP-DATA is a SPECIFIER. Recall that a SPECIFIER includes the HTTP request method, URI, HTTP version, and the client's request headers. The request headers are important because the client may have certain freshness requirements ( Cache-control : max-age or max-stale ).
Table D-2 shows the RESPONSE codes defined for a TST response when F1 is not set.
| Code | Description |
|---|---|
|
Entity is present in
|
|
| 1 | Entity is not present in responder's cache. |
Note that the RESPONSE code indicates only the presence or absence of the object and says nothing about its freshness. If the cached object is stale, the server may set the RESPONSE code to either 1 or 0. Setting RESPONSE to 1 forces the client to predict a cache miss for the request. Setting it to 0, however, causes the client to make its own hit/
When the RESPONSE code is 0, the TST response OP-DATA is a DETAIL that describes the cached response. In particular, it includes the HTTP entity headers (
Expires
,
Last-modified
,
Content-length
, etc.) and the HTTP response headers (
Age
,
Vary
, etc.). The HTCP client must check the entity headers for freshness information. It may want to collect a number of responses and then choose the cache that has the most recent copy of the object. The DETAIL may also include various cache headers, which are
When the RESPONSE code is 1, the TST response OP-DATA consists of CACHE-HDRS (a COUNTSTR) only. Even though the other cache doesn't have a copy of the resource, it might have information that can help to minimize the time to fetch the object.
The MON (monitor) opcode allows caches to
The monitoring feature has the potential to expose private information about a cache to third parties. Imagine a clever person being able to find out which web sites the cache users visit. Although authentication is optional with HTCP/0.0,
The MON request message initiates a monitoring session with another cache. That is, the sender asks the receiver to send back a stream of MON responses for some amount of time.
The MON request OP-DATA is simply a one-octet (8 bits) time field. It specifies the duration, in seconds, for the monitoring session. Given the
Table D-3 lists the two possible RESPONSE codes for a MON response.
| Code | Description |
|---|---|
| Request accepted; the OP-DATA field contains useful data. | |
| 1 |
Request
|
When the RESPONSE code is 0, the OP-DATA field has the structure shown in Figure D-8.
These are the
TIME is the number of seconds remaining for the current monitoring session (identified by the MSG-ID field).
ACTION is a numeric code that indicates the action taken on the given object. The valid ACTION codes are given in Table D-4.
| Code | Description |
|---|---|
|
The object has been added to the cache. |
|
| 1 |
The object in the cache has been refreshed. This corresponds to receiving a 304 Not Modified reply from a validation request. |
| 2 |
The object in the cache has been
|
| 3 |
An entity in the cache has been deleted. |
A numeric code that indicates the reason for the ACTION taking place. The valid reason codes are shown in Table D-5.
| Code | Description |
|---|---|
| A reason not covered by any of the other REASON codes. | |
| 1 |
A proxy client
|
| 2 |
A proxy client requested this resource, but caching is
|
| 3 | The proxy prefetched this resource. |
| 4 |
The resource
|
| 5 | The resource was purged because of the cache's storage limits. |
The SET opcode allows one cache to push certain updates to another. For example, when a cache issues a validation request and receives a 304 (Not Modified) response, some of the reply headers (
Age
,
Expires
) are updated. Pushing these updated headers to neighbor caches with a SET message obviates the need for the neighbors to issue validation
SET requests must be handled
The OP-DATA for a SET request is an IDENTITY structure, which is simply a SPECIFIER and a DETAIL. The SPECIFIER holds information such as the request method, URI, and request headers. The DETAIL contains the updated reply headers.
If the F1 flag is not set, the receiver must not send back a response.
SET requests should be generated due to HTTP transactions only. Caches should not pass SET requests on to their own neighbors due to the strong possibility of flooding a hierarchy with HTCP messages.
A SET response is very simple since it does not include any OP-DATA. Only the RESPONSE code is significant. Table D-6 lists the defined SET response codes.
| Code | Description |
|---|---|
| IDENTITY was accepted. | |
| 1 | IDENTITY was ignored; no reason given. |
The CLR (clear) opcode is used to suggest that a neighbor remove an object from its cache storage. This feature may be useful if one cache determines that an object has been updated or removed at the origin server.
As with SET, the CLR opcode is dangerous because it modifies the cache storage. In the worst case, a malicious person could delete most or all of the objects stored in a cache. An HTCP agent may choose to ignore any CLR request for any reason. CLR requests without valid AUTH sections should definitely be ignored.
A CLR request has the OP-DATA structure shown in Figure D-9. REASON is a 4-bit numeric code that explains why the sender wants the object (specified by the SPECIFIER) to be removed. The allowed reason codes are shown in Table D-7.
| Code | Description |
|---|---|
| Some reason not better specified by another code. | |
| 1 | The origin server says the object no longer exists. |
The CLR response also does not include an OP-DATA section. Only the RESPONSE code is important. Table D-8 describes the defined values and their meanings.
| Code | Description |
|---|---|
| I had the object, and I just deleted it. | |
| 1 | I have the object, and I'm not deleting it. |
| 2 | I don't have the object. |
| only for RuBoard - do not distribute or recompile |