Skip to content

Commit

Permalink
Fix stale responses with no Last-Modified.
Browse files Browse the repository at this point in the history
When caching a request with headers like this:

    Cache-Control: max-age=300, public
    ETag: "5c564d692c85b70068fd76ea25f2be2f"

Everything works fine while fresh, but once stale, an error is being
raised from within `Net::HTTP`, since there's no `Last-Modified` header.

Resolves rtomayko#85.
  • Loading branch information
tylerhunt committed Sep 19, 2013
1 parent d00e6e4 commit e25b24a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/rack/cache/context.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def validate(entry)
@env['REQUEST_METHOD'] = 'GET'

# add our cached last-modified validator to the environment
@env['HTTP_IF_MODIFIED_SINCE'] = entry.last_modified
@env['HTTP_IF_MODIFIED_SINCE'] = entry.last_modified if entry.last_modified

# Add our cached etag validator to the environment.
# We keep the etags from the client to handle the case when the client
Expand Down

0 comments on commit e25b24a

Please sign in to comment.