plataformatec/faraday-http-cache — pull request #12 by erichmachado (2013-04-17 21:03:30+00:00)
Title: Update HTTP headers of cached response on conditional GET

I had an issue when using [faraday-http-cache](https://github.com/plataformatec/faraday-http-cache) on our application when a cached response timestamp expired. When this happened, the response no longer became fresh, even when I validated it and sent a new expiration time, date or cache-control headers, thus making [faraday](https://github.com/lostisland/faraday) validate the response on each request after the expiration.

So I checked faraday-http-cache code and found that the issue was due to the relevant headers not being updated in the cached entry when a response was validated. So I wrote this small patch and tested it on my systems with positive results. These are the resources that I used when validating the solution, listed in order of relevance:

[Stack Overflow - Should HTTP 304 Not Modified-responses contain cache-control headers?](http://stackoverflow.com/questions/1587667/should-http-304-not-modified-responses-contain-cache-control-headers)
[RFC 2616 - Section 10.3.5](http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.3.5)
[RFC 2616 - Section 13.5.3](http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.5.3)
[Subbu Allamaraju's blog - Vary Header for RESTful Applications](http://www.subbu.org/blog/2007/12/vary-header-for-restful-applications)

BTW, thanks for putting the effort in writing this gem. It certainly helps to manage HTTP caching on the client side with much less burden.