Fixed issues in WGI_REQUEST's invariant

Fixed issues with guessing the default format for REST handling
Fixed issue with .._ROUTING_.. component.
This commit is contained in:
Jocelyn Fiat
2011-09-16 20:59:06 +02:00
parent 111812c4e9
commit b3ef7c846b
5 changed files with 17 additions and 15 deletions

View File

@@ -96,6 +96,16 @@ feature -- Access: CGI meta variables
deferred deferred
end end
meta_string_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
-- Environment variable related to `a_name'
require
a_name_valid: a_name /= Void and then not a_name.is_empty
do
if attached meta_variable (a_name) as val then
Result := val.as_string
end
end
meta_variables: ITERATION_CURSOR [WGI_VALUE] meta_variables: ITERATION_CURSOR [WGI_VALUE]
-- These variables are specific to requests made with HTTP. -- These variables are specific to requests made with HTTP.
-- Interpretation of these variables may depend on the value of -- Interpretation of these variables may depend on the value of
@@ -687,10 +697,10 @@ invariant
query_string_attached: query_string /= Void query_string_attached: query_string /= Void
remote_addr_attached: remote_addr /= Void remote_addr_attached: remote_addr /= Void
same_orig_path_info: orig_path_info ~ meta_variable ({WGI_META_NAMES}.orig_path_info) same_orig_path_info: orig_path_info ~ meta_string_variable ({WGI_META_NAMES}.orig_path_info)
same_path_info: path_info ~ meta_variable ({WGI_META_NAMES}.path_info) same_path_info: path_info ~ meta_string_variable ({WGI_META_NAMES}.path_info)
path_info_identical: path_info ~ meta_variable ({WGI_META_NAMES}.path_info) path_info_identical: path_info ~ meta_string_variable ({WGI_META_NAMES}.path_info)
note note
copyright: "2011-2011, Eiffel Software and others" copyright: "2011-2011, Eiffel Software and others"

View File

@@ -185,14 +185,6 @@ feature -- Access: CGI meta parameters
Result := meta_variables_table.item (a_name) Result := meta_variables_table.item (a_name)
end end
meta_string_variable (a_name: READABLE_STRING_GENERAL): detachable READABLE_STRING_32
-- CGI meta variable related to `a_name'
do
if attached meta_variables_table.item (a_name) as val then
Result := val.as_string
end
end
meta_string_variable_or_default (a_name: READABLE_STRING_GENERAL; a_default: READABLE_STRING_32; use_default_when_empty: BOOLEAN): READABLE_STRING_32 meta_string_variable_or_default (a_name: READABLE_STRING_GENERAL; a_default: READABLE_STRING_32; use_default_when_empty: BOOLEAN): READABLE_STRING_32
-- Value for meta parameter `a_name' -- Value for meta parameter `a_name'
-- If not found, return `a_default' -- If not found, return `a_default'
@@ -325,8 +317,6 @@ feature -- Access: HTTP_* CGI meta parameters - 1.1
-- Contents of the Host: header from the current request, if there is one. -- Contents of the Host: header from the current request, if there is one.
do do
Result := meta_string_variable ({WGI_META_NAMES}.http_host) Result := meta_string_variable ({WGI_META_NAMES}.http_host)
ensure
Result /= Void
end end
http_referer: detachable READABLE_STRING_32 http_referer: detachable READABLE_STRING_32

View File

@@ -31,7 +31,7 @@ feature -- Execution
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
do do
Precursor {REST_REQUEST_HANDLER} (ctx, req, res) Precursor {REQUEST_URI_ROUTING_HANDLER_I} (ctx, req, res)
end end
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)

View File

@@ -38,7 +38,7 @@ feature -- Execution
execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)
do do
Precursor {REST_REQUEST_HANDLER} (ctx, req, res) Precursor {REQUEST_URI_TEMPLATE_ROUTING_HANDLER_I} (ctx, req, res)
end end
execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) execute_application (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER)

View File

@@ -98,6 +98,8 @@ feature -- Query
end end
i := i + 1 i := i + 1
end end
else
Result := s
end end
l_accept_lst.forth l_accept_lst.forth
end end