Fixed Webrick to escape + characters in URL's the same way that lighttpd and apache do #1397 [Nicholas Seckar]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1433 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
5b3bc3139a
commit
a32303e0fc
@ -1,5 +1,7 @@
|
|||||||
*SVN*
|
*SVN*
|
||||||
|
|
||||||
|
* Fixed Webrick to escape + characters in URL's the same way that lighttpd and apache do #1397 [Nicholas Seckar]
|
||||||
|
|
||||||
* Added -e/--environment option to script/runner #1408 [fbeausoleil@ftml.net]
|
* Added -e/--environment option to script/runner #1408 [fbeausoleil@ftml.net]
|
||||||
|
|
||||||
* Modernize the scaffold generator to use the simplified render and test methods and to change style from @params["id"] to params[:id]. #1367
|
* Modernize the scaffold generator to use the simplified render and test methods and to change style from @params["id"] to params[:id]. #1367
|
||||||
|
@ -43,28 +43,26 @@ def service(req, res)
|
|||||||
|
|
||||||
def handle_file(req, res)
|
def handle_file(req, res)
|
||||||
begin
|
begin
|
||||||
add_dot_html(req)
|
req = req.dup
|
||||||
|
|
||||||
|
path = req.path.dup
|
||||||
|
|
||||||
|
# Add .html if the last path piece has no . in it
|
||||||
|
path << '.html' if path != '/' && (%r{(^|/)[^./]+$} =~ path)
|
||||||
|
path.gsub!('+', ' ') # Unescape + since FileHandler doesn't do so.
|
||||||
|
|
||||||
|
req.instance_variable_set(:@path_info, path) # Set the modified path...
|
||||||
|
|
||||||
@file_handler.send(:service, req, res)
|
@file_handler.send(:service, req, res)
|
||||||
remove_dot_html(req)
|
|
||||||
return true
|
return true
|
||||||
rescue HTTPStatus::PartialContent, HTTPStatus::NotModified => err
|
rescue HTTPStatus::PartialContent, HTTPStatus::NotModified => err
|
||||||
res.set_error(err)
|
res.set_error(err)
|
||||||
return true
|
return true
|
||||||
rescue => err
|
rescue => err
|
||||||
return false
|
return false
|
||||||
ensure
|
|
||||||
remove_dot_html(req)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def add_dot_html(req)
|
|
||||||
if /^([^.]+)$/ =~ req.path && req.path != "/" then req.instance_variable_set(:@path_info, "#{$1}.html") end
|
|
||||||
end
|
|
||||||
|
|
||||||
def remove_dot_html(req)
|
|
||||||
if /^([^.]+).html$/ =~ req.path && req.path != "/" then req.instance_variable_set(:@path_info, $1) end
|
|
||||||
end
|
|
||||||
|
|
||||||
def handle_dispatch(req, res, origin = nil)
|
def handle_dispatch(req, res, origin = nil)
|
||||||
env = req.meta_vars.clone
|
env = req.meta_vars.clone
|
||||||
env.delete "SCRIPT_NAME"
|
env.delete "SCRIPT_NAME"
|
||||||
|
Loading…
Reference in New Issue
Block a user