Method: Nitro::WebrickAdapter#handle_file
- Defined in:
- lib/nitro/adapter/webrick.rb
#handle_file(req, res) ⇒ Object
Handle a static file. Also handles cached pages.
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/nitro/adapter/webrick.rb', line 123 def handle_file(req, res) rewrite(req) # gmosx, FIXME: this is a nasty hack that fixes a really # *nasty* caching bug. Find a better solution. When hitting # the backend server, if the index method takes parameters # the dispatcher considers all static files as parameters. # If you have output caching enabled for the index page, # all your static files get corrupted. if (@handle_static_files == false) and (req.path_info =~ /\.html$/) return false end @file_handler.do_GET(req, res) return true rescue WEBrick::HTTPStatus::PartialContent, WEBrick::HTTPStatus::NotModified => err res.set_error(err) return true rescue Object => ex return false ensure unrewrite(req) end |