Replace any multiple slash sequence by a single slash character for PATH_INFO.
This commit is contained in:
@@ -169,7 +169,6 @@ feature -- Request processing
|
||||
if p > 0 then
|
||||
l_path_info.keep_head (p - 1)
|
||||
end
|
||||
env.force (enc.decoded_utf_8_string (l_path_info), "PATH_INFO")
|
||||
env.force (l_base, "SCRIPT_NAME")
|
||||
else
|
||||
-- This should not happen, this means the `base' is not correctly set.
|
||||
@@ -183,9 +182,11 @@ feature -- Request processing
|
||||
else
|
||||
l_path_info := l_request_uri.string
|
||||
end
|
||||
env.force (enc.decoded_utf_8_string (l_path_info), "PATH_INFO")
|
||||
env.force ("", "SCRIPT_NAME")
|
||||
end
|
||||
--| Strip multiple slashes "////abc/def///end////" to "/abc/def/end/" ?
|
||||
convert_multiple_slashes_to_single (l_path_info)
|
||||
env.force (enc.decoded_utf_8_string (l_path_info), "PATH_INFO")
|
||||
end
|
||||
|
||||
callback.process_request (env, a_handler.request_header, a_socket)
|
||||
@@ -213,6 +214,35 @@ feature -- Request processing
|
||||
end
|
||||
end
|
||||
|
||||
feature {NONE} -- Implementation
|
||||
|
||||
convert_multiple_slashes_to_single (s: STRING_8)
|
||||
-- Replace multiple slashes sequence by a single slash character.
|
||||
local
|
||||
i,n: INTEGER
|
||||
do
|
||||
from
|
||||
i := 1
|
||||
n := s.count
|
||||
until
|
||||
i > n
|
||||
loop
|
||||
if s[i] = '/' then
|
||||
-- Remove following slashes '/'.
|
||||
from
|
||||
i := i + 1
|
||||
until
|
||||
i > n or s[i] /= '/'
|
||||
loop
|
||||
s.remove (i)
|
||||
n := n - 1
|
||||
end
|
||||
else
|
||||
i := i + 1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
note
|
||||
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Eiffel Software and others"
|
||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||
|
||||
@@ -387,11 +387,8 @@ feature {NONE} -- Element change: CGI meta parameter related to PATH_INFO
|
||||
end
|
||||
l_request_uri := s8
|
||||
end
|
||||
--| FIXME: should it strip "////abc/def" to "/abc/def" ?
|
||||
--| Not sure why this was done before.
|
||||
-- l_request_uri := single_slash_starting_string (l_request_uri)
|
||||
request_uri := l_request_uri
|
||||
set_meta_string_variable ({WGI_META_NAMES}.request_uri, l_request_uri)
|
||||
request_uri := l_request_uri
|
||||
end
|
||||
|
||||
set_orig_path_info (s: READABLE_STRING_8)
|
||||
@@ -418,6 +415,7 @@ feature {NONE} -- Element change: CGI meta parameter related to PATH_INFO
|
||||
l_path_info: STRING
|
||||
do
|
||||
l_path_info := path_info
|
||||
|
||||
--| Warning
|
||||
--| on IIS: we might have PATH_INFO = /sample.exe/foo/bar
|
||||
--| on apache: PATH_INFO = /foo/bar
|
||||
|
||||
Reference in New Issue
Block a user