lib/nitro/adapter/webrick.rb in nitro-0.24.0 vs lib/nitro/adapter/webrick.rb in nitro-0.25.0
- old
+ new
@@ -132,11 +132,12 @@
req.header.each { |h, v| context.headers[h.upcase] = v.first }
context.headers.update(req.meta_vars)
# gmosx: make compatible with fastcgi.
context.headers['REQUEST_URI'].slice!(/http:\/\/(.*?)\//)
- context.headers['REQUEST_URI'] << '/'
+ # context.headers['REQUEST_URI'] << '/'
+ context.headers['REQUEST_URI'] = '/' + context.headers['REQUEST_URI']
Cgi.parse_params(context)
Cgi.parse_cookies(context)
context.render(path)
@@ -159,27 +160,28 @@
alias do_POST handle
# Try to rewrite the path to a filename.
def rewrite(req)
- if req.path == '/'
+ if req.path_info == '/'
req.instance_variable_set(:@path_info, '/index.html')
- elsif req.path =~ /^([^.]+)$/
+ elsif req.path_info =~ /^([^.]+)$/
req.instance_variable_set(:@path_info, "#{$1}/index.html")
end
end
# Rewrite back to the original path.
def unrewrite(req)
- if req.path == '/'
+ if req.path_info == '/index.html'
req.instance_variable_set(:@path_info, '/')
- elsif req.path =~ /^([^.]+).html$/
+ elsif req.path_info =~ /^([^.]+)\/index.html$/
req.instance_variable_set(:@path_info, $1)
end
end
end
end
# * George Moschovitis <gm@navel.gr>
# * Guillaume Pierronnet <guillaume.pierronnet@laposte.net>
+# * Bryan Soto <bryan.a.soto@gmail.com>
\ No newline at end of file