Fixed potential issue related to PATH_INFO, and percent_encoded_path_info computing , when script name is in different path.
This commit is contained in:
@@ -833,6 +833,7 @@ feature -- Access: CGI meta parameters - 1.1
|
|||||||
local
|
local
|
||||||
l_result: like internal_percent_encoded_path_info
|
l_result: like internal_percent_encoded_path_info
|
||||||
r: READABLE_STRING_8
|
r: READABLE_STRING_8
|
||||||
|
pi: READABLE_STRING_32
|
||||||
i,m,n,spos: INTEGER
|
i,m,n,spos: INTEGER
|
||||||
do
|
do
|
||||||
l_result := internal_percent_encoded_path_info
|
l_result := internal_percent_encoded_path_info
|
||||||
@@ -844,7 +845,19 @@ feature -- Access: CGI meta parameters - 1.1
|
|||||||
else
|
else
|
||||||
l_result := r.string
|
l_result := r.string
|
||||||
end
|
end
|
||||||
if attached script_name as s then
|
pi := path_info
|
||||||
|
i := 0
|
||||||
|
if pi.is_valid_as_string_8 then
|
||||||
|
i := l_result.substring_index (pi.to_string_8, 1)
|
||||||
|
if i > 0 then
|
||||||
|
-- Path info is included in REQUEST_URI
|
||||||
|
-- so let's get the percent encoded path info from request uri.
|
||||||
|
l_result := l_result.substring (i, l_result.count)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
--| here "i = 0" means request_uri does not start with `path_info',
|
||||||
|
--| thus let's compute it from `script_name'.
|
||||||
|
if i = 0 and attached script_name as s then
|
||||||
if l_result.starts_with (s) then
|
if l_result.starts_with (s) then
|
||||||
l_result := l_result.substring (s.count + 1, l_result.count)
|
l_result := l_result.substring (s.count + 1, l_result.count)
|
||||||
else
|
else
|
||||||
@@ -2083,7 +2096,7 @@ invariant
|
|||||||
wgi_request.content_type /= Void implies content_type /= Void
|
wgi_request.content_type /= Void implies content_type /= Void
|
||||||
|
|
||||||
note
|
note
|
||||||
copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
copyright: "2011-2016, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
|
||||||
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
Reference in New Issue
Block a user