http support for caching & replication. conditional requests server executes conditional...

10
HTTP support for caching & replication

Upload: russell-horn

Post on 05-Jan-2016

214 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

HTTP support for caching & replication

Page 2: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Conditional requests

• Server executes conditional request.

• Responds with a message body only if the condition is true.

• Condition false: 304 Not Modified

• Servers provide meta-information through last-modified and ETag.

• Example ETag: MD5

Page 3: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Conditional Headers (caching)

• If-modified since (execute request if requested object updated since last-modified date).

• IMS requests.

• If-none-match (execute request if ETag of requested object is different).

Page 4: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Conditional Headers (replication)

• Conditional headers to be used with update requests.

• If-unmodified-since (execute request if the object’s last-modified date matches the supplied date).

• If-match (execute request if the object’s ETag matches the supplied ETag).

• If-match ≠ if-not-match, if-modified-since ≠ if-unmodified-since.

Page 5: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Age and Expiration of cached objects

• HTTP server: explicit time to live with expires and max-age headers.

• Expires: data up to which the cached object may be considered valid.

• Max-age: max age the object may reach before validation.

• Expires: absolute value of TTL. Max-age: specifies the TTL relative to the time the object left.

Page 6: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Request redirection

• 300 Multiple Choices (choices are provided in entity body).

• 301 Moved permanently (location header)

• 302 Found (location header)

• 303 See other (location header)

• 305 use proxy (location header)

• 307 Temporary redirect (location header)

Page 7: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Range Requests

• Range header: byte range of the entity being retrieved.

• Status line: 206 Partial content

Page 8: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Cache-control header

• The cache-control header contains multiple directives that control the use of all the caches between the client and the origin server.

• Cache-control: present in requests and responses (general header).

Page 9: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Cache-control in requests

• No-cache: cached objects cannot be used to satisfy the request.

• No-store: the response cannot be stored in a cache.• Max-age: only younger cached objects can be used to

satisfy the request.• Min-fresh: only cached objects that will not expire for a

specified time can be used.• Max-stale: cached objects that expired up to the

specified time ago can be used.• No-transform: only the precise response as provided by

the origin server can be user.• Only-if-cached: a proxy should not forward the request

on a cache miss.

Page 10: HTTP support for caching & replication. Conditional requests Server executes conditional request. Responds with a message body only if the condition is

Cache-control in responses

• No-cache: response cannot be cached.• No-store: response cannot be stored in any client.• Private: the response can be reused only for the client

that originally requested it.• Public: the response can be cached and shared among

different clients.• Must-revalidate: a cache must always validate the

cached object.• Proxy-revalidation: same as must-revalidate but applies

to proxy caches only.• Max-age: a cache must validate this object before

serving it once the object age reaches specified value.