Subject: [core] When are two requests equivalent?

From: Klaus Hartke <[email-masked]>
Date: Sun, 21 Nov 2010 23:39:29 +0100

Again, a caching-related issue that is largely an implementation
detail, but IMO should have some bits clarified in the draft.

Say a client sends a request with a critical option unknown to the server:

C: GET coap://server/resource (99=0x00)
S: 602 (maxage=60s) "Unknown critical option 99."

Since responses to GET are cacheable, the client caches the response
for 60 seconds. From coap-03 section 5.1.:

> When a client reads the response from a GET request, it should cache the resource representation for the cache lifetime as specified by the Max-Age header. During the cache lifetime, the client SHOULD use its cached version and avoid performing additional GETs for the resource.

Then the client wants to repeat the request without the unknown
option. Since it has a cached version of the resource, it avoids
performing the GET and ends up with a 602 response.

So, what exactly are the rules for determining if a cached response
can be used to avoid a GET request? Checking if the cache stores a
response for the given URI is not enough.

Klaus

---

From: Zach Shelby <[email-masked]>
Date: Tue, 23 Nov 2010 10:20:05 +0200

>> When a client reads the response from a GET request, it should cache the resource representation for the cache lifetime as specified by the Max-Age header. During the cache lifetime, the client SH…

When we cache something, we are caching the representation of a resource identified by that URI. Thus it would make no sense to cache an error response.  The text in Section 5.1 should specify that only successful responses are to be cached (it was assumed). In practice that means only if the response code is "200 OK". Would that be a reasonable ticket to solve the issue Klaus?

Zach

-- 
Zach Shelby, Chief Nerd, Sensinode Ltd.
http://zachshelby.org  - My blog "On the Internet of Things"
http://6lowpan.net - My book "6LoWPAN: The Wireless Embedded Internet"
Mobile: +358 40 7796297