Better support for unicode path and values.

Added WSF_REQUEST.percent_encoded_path_info: READABLE_STRING_8
    to keep url encoded path info, as it is useful for specific component

The router is now using WSF_REQUEST.percent_encoded_path_info
    since URI_TEMPLATE are handling URI (and not IRI)
    this fixes an issue with unicode path parameters.

This should not break existing code, and this fixes various unicode related issues related
   to PATH parameter and path info
   but also any component using file names.

(required EiffelStudio >= 7.2)
This commit is contained in:
2013-06-12 18:00:55 +02:00
parent a982286dd4
commit cc4ef1a575
28 changed files with 1056 additions and 449 deletions

View File

@@ -62,7 +62,7 @@ feature -- Access
url_encoded_name: READABLE_STRING_8
-- URL encoded string of `name'.
do
Result := url_encoder.encoded_string (name)
Result := url_encoded_string (name)
end
values: LIST [WSF_STRING]

View File

@@ -50,20 +50,6 @@ feature -- Access
url_encoded_value: READABLE_STRING_8
-- URL encoded string of `value'.
frozen string: like value
obsolete
"Use value [2012-May-31]"
do
Result := value
end
frozen url_encoded_string: like url_encoded_value
obsolete
"Use url_encoded_value [2012-May-31]"
do
Result := url_encoded_value
end
feature -- Conversion
integer_value: INTEGER
@@ -137,7 +123,7 @@ feature -- Visitor
end
note
copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software

View File

@@ -36,17 +36,17 @@ feature -- Access
feature -- Status report
debug_output: STRING
debug_output: STRING_32
-- String that should be displayed in debugger to represent `Current'.
do
Result := Precursor
if
exists and then
attached tmp_name as n
attached tmp_path as p
then
Result.append_character (' ')
Result.append_character ('%"')
Result.append (n)
Result.append (p.name)
Result.append_character ('%"')
end
Result.append (" filename=%"")
@@ -108,9 +108,16 @@ feature -- Access: Uploaded File
size: INTEGER
-- Size of uploaded file
tmp_name: detachable STRING
tmp_path: detachable PATH
-- Filename of tmp file
tmp_name: detachable READABLE_STRING_GENERAL
do
if attached tmp_path as p then
Result := p.name
end
end
tmp_basename: detachable STRING
-- Basename of tmp file
@@ -237,7 +244,7 @@ feature -- Implementation
feature -- Basic operation
move_to (a_destination: STRING): BOOLEAN
move_to (a_destination: READABLE_STRING_GENERAL): BOOLEAN
-- Move current uploaded file to `a_destination'
--| Violates CQS principle.
require
@@ -246,10 +253,10 @@ feature -- Basic operation
local
f: RAW_FILE
do
if attached tmp_name as n then
create f.make (n)
if attached tmp_path as p then
create f.make_with_path (p)
if f.exists then
f.change_name (a_destination)
f.rename_file (a_destination)
Result := True
end
end
@@ -274,8 +281,8 @@ feature -- Status
local
f: PLAIN_TEXT_FILE
do
if attached tmp_name as n then
create f.make (n)
if attached tmp_path as p then
create f.make_with_path (p)
Result := f.exists
end
end
@@ -288,10 +295,19 @@ feature -- Element change
error := e
end
set_tmp_path (p: like tmp_path)
do
tmp_path := p
end
set_tmp_name (n: like tmp_name)
-- Set `tmp_name' to `n'
do
tmp_name := n
if n /= Void then
set_tmp_path (create {PATH}.make_from_string (n))
else
set_tmp_path (Void)
end
end
set_tmp_basename (n: like tmp_basename)