Fixing issue with experimental WGI_MULTIPLE_STRING_VALUE

Fixed issue with RAW_POST_DATA
This commit is contained in:
Jocelyn Fiat
2011-09-23 18:21:57 +02:00
parent e7fd7af2c5
commit 668847f8e8
2 changed files with 35 additions and 3 deletions

View File

@@ -14,6 +14,7 @@ inherit
create
make_with_value,
make_with_array,
make_with_string
feature {NONE} -- Initialization
@@ -25,6 +26,26 @@ feature {NONE} -- Initialization
add_value (a_value)
end
make_with_array (arr: ARRAY [WGI_VALUE])
require
arr_not_empty: not arr.is_empty
all_same_name: across arr as c all c.item.name.same_string (arr[arr.lower].name) end
local
i,up: INTEGER
do
up := arr.upper
i := arr.lower
make_with_value (arr[i])
from
i := i + 1
until
i > up
loop
add_value (arr[i])
i := i + 1
end
end
make_with_string (a_name: like name; a_string: READABLE_STRING_32)
do
make_with_value (create {WGI_STRING_VALUE}.make (a_name, a_string))
@@ -75,7 +96,7 @@ feature -- Helper
across
string_values as c
loop
if Result.count = 1 then
if Result.count > 1 then
Result.append_character (',')
end
Result.append_string (c.item)

View File

@@ -448,6 +448,7 @@ feature {NONE} -- Query parameters: implementation
n, p, i, j: INTEGER
s: STRING
l_name,l_value: STRING_32
v: WGI_VALUE
do
if a_content = Void then
create Result.make (0)
@@ -479,7 +480,17 @@ feature {NONE} -- Query parameters: implementation
l_name := url_encoder.decoded_string (l_name)
l_value := url_encoder.decoded_string (l_value)
end
Result.force (new_string_value (l_name, l_value), l_name)
v := new_string_value (l_name, l_value)
if Result.has_key (l_name) and then attached Result.found_item as l_existing_value then
if attached {WGI_MULTIPLE_STRING_VALUE} l_existing_value as l_multi then
l_multi.add_value (v)
else
Result.force (create {WGI_MULTIPLE_STRING_VALUE}.make_with_array (<<l_existing_value, v>>), l_name)
check replaced: Result.found and then Result.found_item ~ l_existing_value end
end
else
Result.force (v, l_name)
end
end
end
end
@@ -515,7 +526,7 @@ feature {NONE} -- Form fields and related
vars := urlencoded_parameters (s, True)
end
if raw_post_data_recorded then
vars.force (new_string_value ("RAW_POST_DATA", s), "RAW_POST_DATA")
set_meta_string_variable ("RAW_POST_DATA", s)
end
else
create vars.make (0)