Fixed a previously character changes in WSF_REQUEST (related to safe_filename), and modified the implementation to use inspect

Fixed the request_content_type computation
Cosmetic in REQUEST_RESOURCE_HANDLER_HELPER
This commit is contained in:
Jocelyn Fiat
2011-10-27 16:00:33 +02:00
parent 8e4e7a5084
commit 0d637d478a
3 changed files with 88 additions and 37 deletions

View File

@@ -167,7 +167,7 @@ feature -- Handle responses
Result := Void
end
handle_bad_request_response (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
handle_bad_request_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
local
h : WSF_HEADER
do
@@ -182,7 +182,7 @@ feature -- Handle responses
end
handle_precondition_fail_response (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
handle_precondition_fail_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
local
h : WSF_HEADER
do
@@ -196,7 +196,7 @@ feature -- Handle responses
res.write_string (a_description)
end
handle_internal_server_error (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
handle_internal_server_error (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE )
local
h : WSF_HEADER
do
@@ -224,7 +224,7 @@ feature -- Handle responses
res.write_string (a_description)
end
handle_method_not_allowed_response (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
handle_method_not_allowed_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
local
h : WSF_HEADER
do
@@ -238,7 +238,7 @@ feature -- Handle responses
res.write_string (a_description)
end
handle_resource_not_found_response (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
handle_resource_not_found_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
local
h : WSF_HEADER
do
@@ -253,7 +253,7 @@ feature -- Handle responses
end
handle_resource_not_modified_response (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
handle_resource_not_modified_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
local
h : WSF_HEADER
do
@@ -269,7 +269,7 @@ feature -- Handle responses
end
handle_resource_conflict_response (a_description:STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
handle_resource_conflict_response (a_description: STRING; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE)
local
h : WSF_HEADER
do

View File

@@ -73,34 +73,39 @@ feature -- Query
local
s: detachable READABLE_STRING_8
i,n: INTEGER
l_accept_lst: detachable ARRAYED_LIST [READABLE_STRING_8]
do
l_accept_lst := accepted_content_types (request)
if attached request.content_type as ct then
Result := ct
else
if attached accepted_content_types (request) as l_accept_lst then
from
l_accept_lst.start
until
l_accept_lst.after or Result /= Void
loop
s := l_accept_lst.item
if content_type_supported /= Void then
from
i := content_type_supported.lower
n := content_type_supported.upper
until
i > n or Result /= Void
loop
if content_type_supported[i].same_string (s) then
Result := s
end
i := i + 1
if l_accept_lst /= Void then
l_accept_lst.put_front (ct)
else
Result := ct
end
end
if Result = Void and l_accept_lst /= Void then
from
l_accept_lst.start
until
l_accept_lst.after or Result /= Void
loop
s := l_accept_lst.item
if content_type_supported /= Void then
from
i := content_type_supported.lower
n := content_type_supported.upper
until
i > n or Result /= Void
loop
if content_type_supported[i].same_string (s) then
Result := s
end
else
Result := s
i := i + 1
end
l_accept_lst.forth
else
Result := s
end
l_accept_lst.forth
end
end
end