Skip to content

Instantly share code, notes, and snippets.

@nurse
Created May 24, 2012 07:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nurse/2779978 to your computer and use it in GitHub Desktop.
Save nurse/2779978 to your computer and use it in GitHub Desktop.
chkbuild用config.ru for sqale
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