check that cookies data is valid string 8 to follow assertions.

This commit is contained in:
2014-05-14 09:53:04 +02:00
parent d158579bdc
commit bb11c24681

View File

@@ -1262,41 +1262,43 @@ feature {NONE} -- Cookies
local local
i,j,p,n: INTEGER i,j,p,n: INTEGER
l_cookies: like internal_cookies_table l_cookies: like internal_cookies_table
s32: READABLE_STRING_32
k,v,s: STRING k,v,s: STRING
do do
l_cookies := internal_cookies_table l_cookies := internal_cookies_table
if l_cookies = Void then if l_cookies = Void then
create l_cookies.make_equal (0)
if attached {WSF_STRING} meta_variable ({WSF_META_NAMES}.http_cookie) as val then if attached {WSF_STRING} meta_variable ({WSF_META_NAMES}.http_cookie) as val then
s := val.value s32 := val.value
create l_cookies.make_equal (5) if s32.is_valid_as_string_8 then
from s := s32.to_string_8
n := s.count from
p := 1 n := s.count
i := 1 p := 1
until i := 1
p < 1 until
loop p < 1
i := s.index_of ('=', p) loop
if i > 0 then i := s.index_of ('=', p)
j := s.index_of (';', i) if i > 0 then
if j = 0 then j := s.index_of (';', i)
j := n + 1 if j = 0 then
k := s.substring (p, i - 1) j := n + 1
v := s.substring (i + 1, n) k := s.substring (p, i - 1)
v := s.substring (i + 1, n)
p := 0 -- force termination p := 0 -- force termination
else else
k := s.substring (p, i - 1) k := s.substring (p, i - 1)
v := s.substring (i + 1, j - 1) v := s.substring (i + 1, j - 1)
p := j + 1 p := j + 1
end
k.left_adjust
k.right_adjust
add_value_to_table (k, v, l_cookies)
end end
k.left_adjust
k.right_adjust
add_value_to_table (k, v, l_cookies)
end end
end end
else
create l_cookies.make_equal (0)
end end
internal_cookies_table := l_cookies internal_cookies_table := l_cookies
end end
@@ -2065,7 +2067,7 @@ invariant
wgi_request.content_type /= Void implies content_type /= Void wgi_request.content_type /= Void implies content_type /= Void
note note
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others" copyright: "2011-2014, 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