Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make sure last_modified! works with <= rather than just equality.

  • Loading branch information...
commit aec391621b6af7af1e0ba61c993bbdd88624eac3 1 parent 5556db2
@NZKoz NZKoz authored
View
4 actionpack/lib/action_controller/base.rb
@@ -969,7 +969,9 @@ def head(*args)
# If-Modified-Since request header is <= last modified.
def last_modified!(utc_time)
response.last_modified= utc_time
- head(:not_modified) if response.last_modified == request.if_modified_since
+ if request.if_modified_since && request.if_modified_since <= utc_time
+ head(:not_modified)
+ end
end
# Sets the ETag response header. Returns 304 Not Modified if the
View
6 actionpack/test/controller/render_test.rb
@@ -1441,6 +1441,12 @@ def test_request_with_bang_obeys_last_modified
get :conditional_hello_with_bangs
assert_response :not_modified
end
+
+ def test_last_modified_works_with_less_than_too
+ @request.if_modified_since = 5.years.ago.httpdate
+ get :conditional_hello_with_bangs
+ assert_response :not_modified
+ end
end
class RenderingLoggingTest < Test::Unit::TestCase
Please sign in to comment.
Something went wrong with that request. Please try again.