On 5/6/12 1:24 PM, Jack Bates wrote:
Hi, do you know of any examples of parsing parameters in header field values that you can suggest to me? e.g. matching charset=UTF-8 in "Content-Type: ...; charset=UTF-8" or rel=duplicate in "Link: <...>; rel=duplicate"
No, there's not such parsing provided in the API.
Also can you suggest any examples of checking if a given URL already exists in the cache or not?
Technically, I *think* TSCcacheRead() can be used to check for the existence of an object in the HTTP cache, and perhaps even read the header for what is in cache. The caveat is that these APIs were not intended to work on the HTTP cache, but for your case, it might work. Only one way to find out.
Fwiw, the APIs TSCacheWrite(), TSCacheRead() etc. were intended for someone to store and retrieve non-HTTP cache objects. The core obviously uses the same underlying code for the HTTP cache, the complication is that it uses it in a way that is not exposed via current APIs (such that you could not get to the body of an HTTP object via these objects). There's an example protocol plugin that uses these APIs for storing content in the cache.
Cheers, -- Leif