diff --git a/library/server/ewsgi/specification/request/value/wgi_multiple_string_value.e b/library/server/ewsgi/specification/request/value/wgi_multiple_string_value.e index 9654cbb5..4285f965 100644 --- a/library/server/ewsgi/specification/request/value/wgi_multiple_string_value.e +++ b/library/server/ewsgi/specification/request/value/wgi_multiple_string_value.e @@ -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) diff --git a/library/server/ewsgi/src/request/wgi_request_from_table.e b/library/server/ewsgi/src/request/wgi_request_from_table.e index ec6fdb0d..31c0d4ff 100644 --- a/library/server/ewsgi/src/request/wgi_request_from_table.e +++ b/library/server/ewsgi/src/request/wgi_request_from_table.e @@ -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_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)