Created
May 24, 2012 07:07
-
-
Save nurse/2779978 to your computer and use it in GitHub Desktop.
chkbuild用config.ru for sqale
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Rack::File | |
alias _serving serving | |
def serving(env) | |
_serving(env).tap do |status, headers, body| | |
path = env['PATH_INFO'] | |
if path.end_with?('/rss') | |
headers["Content-Type"] = 'application/rss+xml' | |
elsif path.end_with?('.gz') | |
headers["Content-Type"] = Rack::Mime.mime_type(::File.extname(path[0..-4]), 'text/plain') | |
headers["Content-Encoding"] = 'gzip' | |
end | |
end | |
end | |
end | |
run Rack::Directory.new(File.expand_path('../../tmp/public_html', __FILE__)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment