Merge remote-tracking branch 'upstream/master' into cors

This commit is contained in:
Olivier Ligot
2013-03-15 14:54:43 +01:00
73 changed files with 3203 additions and 1023 deletions

View File

@@ -58,11 +58,11 @@ feature -- Access
end
end
values: HASH_TABLE [WSF_VALUE, READABLE_STRING_32]
values: HASH_TABLE [WSF_VALUE, STRING_32]
value (k: READABLE_STRING_32): detachable WSF_VALUE
value (k: READABLE_STRING_GENERAL): detachable WSF_VALUE
do
Result := values.item (k)
Result := values.item (k.to_string_32)
end
count: INTEGER
@@ -169,11 +169,11 @@ feature -- Conversion
feature -- Element change
add_value (a_value: WSF_VALUE; k: READABLE_STRING_32)
add_value (a_value: WSF_VALUE; k: READABLE_STRING_GENERAL)
require
same_name: a_value.name.same_string (name) or else (a_value.name.starts_with (name) and then a_value.name.item (name.count + 1) = '[')
do
values.force (a_value, k)
values.force (a_value, k.to_string_32)
end
feature -- Traversing
@@ -217,7 +217,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

@@ -27,6 +27,9 @@ create
feature {NONE} -- Initialization
make_from_response (res: WSF_RESPONSE)
-- Initialize from `res' (assumed to be a GET response).
require
res_attached: res /= Void
do
wsf_response := res
make_from_wgi (res.wgi_response)
@@ -65,10 +68,12 @@ feature -- Output operation
end
invariant
transfered_content_length_is_zero: transfered_content_length = 0
wsf_response_attached: wsf_response /= Void
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

@@ -411,6 +411,48 @@ feature -- Access: global variables
Result.keep_head (n - 1)
end
table_item (a_name: READABLE_STRING_GENERAL; f: detachable FUNCTION [ANY, TUPLE [READABLE_STRING_GENERAL], detachable WSF_VALUE]): detachable WSF_VALUE
-- Return value associated with table for flat name `a_name'.
-- Use function `f' to get the item, this could be agent of `form_parameter' or `query_parameter', ...
-- By default, this uses `items'
-- For instance "foo[bar]" will return item "bar" from table item "foo" if it exists.
-- Note: we could add this flexible behavior directly to `query_parameter' and related ..
local
p,q: INTEGER
n,k: READABLE_STRING_GENERAL
v: like table_item
val: detachable WSF_VALUE
do
if f /= Void then
Result := f.item ([a_name])
else
Result := item (a_name)
end
if Result = Void then
p := a_name.index_of_code (91, 1) -- 91 '['
if p > 0 then
q := a_name.index_of_code (93, p + 1) -- 93 ']'
if q > p then
n := a_name.substring (1, p - 1)
k := a_name.substring (p + 1, q - 1)
if f /= Void then
val := f.item ([n])
else
val := item (n)
end
if attached {WSF_TABLE} val as tb then
v := tb.value (k)
if q = a_name.count then
Result := v
else
end
end
end
end
end
end
feature -- Helpers: global variables
items_as_string_items: ITERABLE [TUPLE [name: READABLE_STRING_32; value: detachable READABLE_STRING_32]]