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:
2016-10-12 11:19:23 +02:00
parent ed959042d7
commit 29590b1c0d

View File

@@ -833,6 +833,7 @@ feature -- Access: CGI meta parameters - 1.1
local
l_result: like internal_percent_encoded_path_info
r: READABLE_STRING_8
pi: READABLE_STRING_32
i,m,n,spos: INTEGER
do
l_result := internal_percent_encoded_path_info
@@ -844,11 +845,23 @@ feature -- Access: CGI meta parameters - 1.1
else
l_result := r.string
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
l_result := l_result.substring (s.count + 1, l_result.count)
else
--| Handle Rewrite url engine, to have clean path
--| Handle Rewrite url engine, to have clean path
from
i := 1
m := l_result.count
@@ -2083,7 +2096,7 @@ invariant
wgi_request.content_type /= Void implies content_type /= Void
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)"
source: "[
Eiffel Software