Skip to content

Commit

Permalink
Added Cache-Control and Expires headers
Browse files Browse the repository at this point in the history
  • Loading branch information
Papipo committed May 20, 2010
1 parent 58d670a commit d61da6c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/hassle.rb
Expand Up @@ -19,7 +19,11 @@ def call(env)
# Read the contents of the stylesheet
content = File.read(stylesheet_path)
length = "".respond_to?(:bytesize) ? content.bytesize.to_s : content.size.to_s
[200, {'Content-Type' => 'text/css', 'Content-Length' => length}, [content]]
[200, {'Content-Type' => 'text/css',
'Content-Length' => length,
'Cache-Control' => "public, max-age=#{60 * 60 * 24 * 365}",
'Expires' => (Time.now + 1.hour).rfc2822}, [content]]

else
# Not a request Hassle cares about
@app.call(env)
Expand Down

0 comments on commit d61da6c

Please sign in to comment.