Fixed various unicode issue related to query and form parameters.

(Especially for the multipart/form-data encoding.)
Factorized code related to smart parameters computing (handling list , table, ...) in WSF_VALUE_UTILITIES.
Fixed an issue with percent_encoded_path_info computation from request_uri.
Fixed issue with cookie addition having same cookie name.
Fixed unicode support for uploaded file.
WSF_STRING is reusing WSF_PERCENT_ENCODER.
Use unicode output for WSF_DEBUG_HANDLER.
Code cleaning
This commit is contained in:
2015-11-05 21:32:24 +01:00
parent dde6a0b7de
commit 50ba8ca703
14 changed files with 329 additions and 362 deletions

View File

@@ -59,6 +59,7 @@ feature -- Access
create dbg.make
dbg.set_is_verbose (True)
dbg.set_unicode_output_enabled (True)
dbg.append_cgi_variables_to (req, res, s)
dbg.append_information_to (req, res, s)

View File

@@ -42,6 +42,9 @@ feature -- Settings
is_verbose: BOOLEAN
-- Has verbose output (default: True)?
unicode_output_enabled: BOOLEAN
-- Display names and values as unicode.
feature -- Settings change
set_is_verbose (b: BOOLEAN)
@@ -50,6 +53,12 @@ feature -- Settings change
is_verbose := b
end
set_unicode_output_enabled (b: BOOLEAN)
-- if `b' then enable unicode output, otherwise disable.
do
unicode_output_enabled := b
end
feature -- Execution
append_connector_informations_to (req: WSF_REQUEST; res: WSF_RESPONSE; a_output: STRING)
@@ -232,7 +241,7 @@ feature {NONE} -- Implementation
it as c
loop
s.append (" - ")
s.append (utf.escaped_utf_32_string_to_utf_8_string_8 (c.key))
append_unicode (c.key, s)
s.append_character (' ')
if attached c.item as l_item then
s.append_character ('{')
@@ -302,7 +311,11 @@ feature {NONE} -- Implementation
it as c
loop
a_output.append (" - ")
a_output.append (c.item.url_encoded_name)
if unicode_output_enabled then
append_unicode (c.item.name, a_output)
else
a_output.append (c.item.url_encoded_name)
end
t := c.item.generating_type
if t.same_string ("WSF_STRING") then
else
@@ -313,15 +326,15 @@ feature {NONE} -- Implementation
end
a_output.append_character ('=')
if attached {WSF_STRING} c.item as l_str then
s := l_str.url_encoded_value
if unicode_output_enabled then
s := l_str.value
else
s := l_str.url_encoded_value
end
else
s := c.item.string_representation
end
if s.is_valid_as_string_8 then
v := s.as_string_8
else
v := utf.escaped_utf_32_string_to_utf_8_string_8 (s)
end
v := utf.utf_32_string_to_utf_8_string_8 (s)
if v.has ('%N') then
a_output.append (eol)
across
@@ -349,7 +362,6 @@ feature {NONE} -- Implementation
local
n: INTEGER
v: READABLE_STRING_8
utf: UTF_CONVERTER
do
if is_verbose then
a_output.append (a_title)
@@ -368,11 +380,7 @@ feature {NONE} -- Implementation
it as c
loop
a_output.append (" - ")
if c.key.is_valid_as_string_8 then
a_output.append (c.key.as_string_8)
else
a_output.append (utf.utf_32_string_to_utf_8_string_8 (c.key))
end
append_unicode (c.key, a_output)
a_output.append_character ('=')
v := c.item
if v.has ('%N') then
@@ -398,6 +406,17 @@ feature {NONE} -- Implementation
end
end
append_unicode (s: READABLE_STRING_GENERAL; a_output: STRING)
local
utf: UTF_CONVERTER
do
--if s.is_valid_as_string_8 then
--a_output.append (s.as_string_8)
--else
a_output.append (utf.utf_32_string_to_utf_8_string_8 (s))
--end
end
feature -- Constants
eol: STRING = "%N"