From 446c692f97b251fd9837cf2c8800ddf5196a32d1 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Tue, 1 Jul 2014 19:59:08 +0200 Subject: [PATCH] Various changes related to new WSF_DEBUG_INFORMATION and WSF_DEBUG_HANDLER. --- examples/debug/src/ewf_debug_server.e | 3 +- .../wsf/extension/handler/wsf_debug_handler.e | 2 + .../wsf/extension/wsf_debug_information.e | 61 ++++++++++++++++++- 3 files changed, 63 insertions(+), 3 deletions(-) diff --git a/examples/debug/src/ewf_debug_server.e b/examples/debug/src/ewf_debug_server.e index 8900d2a7..3725bfc9 100644 --- a/examples/debug/src/ewf_debug_server.e +++ b/examples/debug/src/ewf_debug_server.e @@ -25,7 +25,7 @@ feature {NONE} -- Initialization -- Initialize current service. do Precursor - set_service_option ("verbose", True) +-- set_service_option ("verbose", True) set_service_option ("port", 9090) -- set_service_option ("base", "/www-debug/debug_service.fcgi/") end @@ -34,6 +34,7 @@ feature {NONE} -- Initialization local dbg: WSF_DEBUG_HANDLER do + res.put_error ("DEBUG" + req.request_uri + "%N") create dbg.make dbg.execute_starts_with ("", req, res) end diff --git a/library/server/wsf/extension/handler/wsf_debug_handler.e b/library/server/wsf/extension/handler/wsf_debug_handler.e index 3bc35bf5..00a6437a 100644 --- a/library/server/wsf/extension/handler/wsf_debug_handler.e +++ b/library/server/wsf/extension/handler/wsf_debug_handler.e @@ -52,6 +52,7 @@ feature -- Access p: WSF_PAGE_RESPONSE l_len: INTEGER dbg: WSF_DEBUG_INFORMATION + utf: UTF_CONVERTER do create s.make (2048) s.append ("= EWF DEBUG =") @@ -59,6 +60,7 @@ feature -- Access create dbg.make dbg.set_is_verbose (True) + dbg.append_cgi_variables_to (req, res, s) dbg.append_information_to (req, res, s) s.append ("= END =") diff --git a/library/server/wsf/extension/wsf_debug_information.e b/library/server/wsf/extension/wsf_debug_information.e index 6869443d..1b9b2180 100644 --- a/library/server/wsf/extension/wsf_debug_information.e +++ b/library/server/wsf/extension/wsf_debug_information.e @@ -135,7 +135,7 @@ feature -- Execution append_meta_variables_to (req, res, a_output) if is_verbose then append_execution_variables_to (req, res, a_output) - append_environment_variables_to (req, res, a_output) +-- append_environment_variables_to (req, res, a_output) end end @@ -292,7 +292,11 @@ feature {NONE} -- Implementation a_output.append_character ('}') end a_output.append_character ('=') - s := c.item.string_representation + if attached {WSF_STRING} c.item as l_str then + s := l_str.url_encoded_value + else + s := c.item.string_representation + end if s.is_valid_as_string_8 then v := s.as_string_8 else @@ -321,6 +325,59 @@ feature {NONE} -- Implementation end end + append_iterable_string_to (a_title: READABLE_STRING_8; it: detachable TABLE_ITERABLE [READABLE_STRING_8, READABLE_STRING_GENERAL]; a_output: STRING_8) + local + n: INTEGER + v: READABLE_STRING_8 + utf: UTF_CONVERTER + do + if is_verbose then + a_output.append (a_title) + a_output.append_character (':') + end + if it /= Void then + n := iterable_count (it) + if n = 0 then + if is_verbose then + a_output.append (" empty") + a_output.append (eol) + end + else + a_output.append (eol) + across + it as c + loop + a_output.append (" - ") + if c.key.is_valid_as_string_8 then + a_output.append (c.key.as_string_8) + else + a_output.append (utf.utf_32_string_to_utf_8_string_8 (c.key)) + end + a_output.append_character ('=') + v := c.item + if v.has ('%N') then + a_output.append (eol) + across + v.split ('%N') as v_cursor + loop + a_output.append (" |") + a_output.append (v_cursor.item) + a_output.append (eol) + end + else + a_output.append (v) + a_output.append (eol) + end + end + end + else + if is_verbose then + a_output.append (" none") + a_output.append (eol) + end + end + end + feature -- Constants eol: STRING = "%N"