rack-cache
rack-cache copied to clipboard
Stale responses fail when Last-Modified is missing
I'm running into an issue caching responses with headers like this:
Cache-Control: max-age=300, public
ETag: "5c564d692c85b70068fd76ea25f2be2f"
While fresh, this works fine, but once stale, Net::HTTP
is raising this error:
NoMethodError: undefined method `strip' for nil:NilClass
from ~/.rbenv/versions/1.9.3-p448/lib/ruby/1.9.1/net/http.rb:1436:in `block in initialize_http_header'
The issue appears to be in lib/rack/cache/context.rb
. This change fixes it:
197c197
< @env['HTTP_IF_MODIFIED_SINCE'] = entry.last_modified
---
> @env['HTTP_IF_MODIFIED_SINCE'] = entry.last_modified if entry.last_modified
I am also seeing this error. A similar work around by-passed the issue.
@tylerhunt Why don't you submit a Pull Request since you've already included a patch in your original Issue?