Files
EWF/library/server/wsf/extension/handler/wsf_debug_handler.e
Jocelyn Fiat 425c976032 Ensure that PATH_INFO and REQUEST_URI are following the CGI specifications:
- PATH_INFO is percent decoded but still utf-8 encoded,
  this is available via WGI.path_info and WSF_REQUEST.utf_8_path_info.
- Added WSF_REQUEST.percent_encoded_path_info
- and WSF_REQUEST.path_info remains the unicode value for PATH_INFO

Added cgi_variables: WGI_REQUEST_CGI_VARIABLES to have a simple and quick view on CGI variables
Added execution_variables to be able to iterate on execution variables.
Added PERCENT_ENCODER.percent_decoded_utf_8_string
Improved the WSF_DEBUG_HANDLER to provide more information thanks to WSF_DEBUG_INFORMATION object.
2014-06-30 15:13:47 +02:00

109 lines
2.5 KiB
Plaintext

note
description: "Summary description for {WSF_DEBUG_HANDLER}."
author: ""
date: "$Date: 2013-06-28 16:14:02 +0200 (ven., 28 juin 2013) $"
revision: "$Revision: 92754 $"
class
WSF_DEBUG_HANDLER
inherit
WSF_STARTS_WITH_HANDLER
rename
execute as execute_starts_with
end
WSF_SELF_DOCUMENTED_HANDLER
create
make,
make_hidden
feature {NONE} -- Initialization
make
do
end
make_hidden
do
make
is_hidden := True
end
is_hidden: BOOLEAN
-- Current mapped handler should be hidden from self documentation
feature -- Documentation
mapping_documentation (m: WSF_ROUTER_MAPPING; a_request_methods: detachable WSF_REQUEST_METHODS): WSF_ROUTER_MAPPING_DOCUMENTATION
-- <Precursor>
do
create Result.make (m)
Result.set_is_hidden (is_hidden)
Result.add_description ("Debug handler (mainly to return request information)")
end
feature -- Access
execute_starts_with (a_path: READABLE_STRING_8; req: WSF_REQUEST; res: WSF_RESPONSE)
local
s: STRING_8
p: WSF_PAGE_RESPONSE
l_len: INTEGER
dbg: WSF_DEBUG_INFORMATION
do
create s.make (2048)
s.append ("= EWF DEBUG =")
s.append ("%N")
create dbg.make
dbg.append_information_to (req, res, s)
s.append ("= END =")
s.append ("%N")
create p.make_with_body (s)
if {PLATFORM}.is_windows and req.wgi_connector.name.is_case_insensitive_equal ("cgi") then
--| FIXME: the CGI connector add %R for any single %N character, so update the Content-Length accordingly.
-- Dirty hack to handle correctly CGI on Windows, since it seems "abc%N" will be sent as "abc%R%N"
l_len := 0
across s as ic loop
if ic.item = '%R' then
l_len := l_len + 1
ic.forth
if
not ic.after and then
ic.item = '%N'
then
l_len := l_len + 1
end
elseif ic.item = '%N' then
l_len := l_len + 2 -- %R will be added by the CGI connector...
else
l_len := l_len + 1
end
end
else
l_len := s.count
end
p.header.put_content_length (l_len)
p.header.put_content_type_utf_8_text_plain
res.send (p)
end
note
copyright: "2011-2014, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Colin Adams, Eiffel Software and others"
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
source: "[
Eiffel Software
5949 Hollister Ave., Goleta, CA 93117 USA
Telephone 805-685-1006, Fax 805-685-6869
Website http://www.eiffel.com
Customer support http://support.eiffel.com
]"
end