From c3f5376ef5ae7c3dddf990999ceab496b40b7246 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 14 Oct 2011 14:27:54 +0200 Subject: [PATCH] fixed cgi and libfcgi connectors due to recent changes from WGI_APPLICATION --- .../connectors/cgi/src/ewf_cgi_connector.e | 27 +++++++++++++++---- .../libfcgi/src/ewf_libfcgi_connector.e | 25 ++++++++++++++--- 2 files changed, 43 insertions(+), 9 deletions(-) diff --git a/library/server/ewsgi/connectors/cgi/src/ewf_cgi_connector.e b/library/server/ewsgi/connectors/cgi/src/ewf_cgi_connector.e index 3a665d43..c87daa75 100644 --- a/library/server/ewsgi/connectors/cgi/src/ewf_cgi_connector.e +++ b/library/server/ewsgi/connectors/cgi/src/ewf_cgi_connector.e @@ -18,13 +18,30 @@ feature -- Execution launch local req: WGI_REQUEST_FROM_TABLE - res: WGI_RESPONSE_STREAM_BUFFER + res: detachable WGI_RESPONSE_STREAM_BUFFER + rescued: BOOLEAN do - create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {EWF_CGI_INPUT_STREAM}.make) - create res.make (create {EWF_CGI_OUTPUT_STREAM}.make) - application.process (req, res) + if not rescued then + create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {EWF_CGI_INPUT_STREAM}.make) + create res.make (create {EWF_CGI_OUTPUT_STREAM}.make) + application.execute (req, res) + else + if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then + if res /= Void then + if not res.status_is_set then + res.write_header ({HTTP_STATUS_CODE}.internal_server_error, Void) + end + if res.message_writable then + res.write_string ("
" + l_trace + "
") + end + end + end + end + rescue + rescued := True + retry end - + note copyright: "2011-2011, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_connector.e b/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_connector.e index 7354ad6d..48310630 100644 --- a/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_connector.e +++ b/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_connector.e @@ -47,11 +47,28 @@ feature -- Execution process_fcgi_request (vars: HASH_TABLE [STRING, STRING]; a_input: like input; a_output: like output) local req: WGI_REQUEST_FROM_TABLE - res: WGI_RESPONSE_STREAM_BUFFER + res: detachable WGI_RESPONSE_STREAM_BUFFER + rescued: BOOLEAN do - create req.make (vars, a_input) - create res.make (a_output) - application.process (req, res) + if not rescued then + create req.make (vars, a_input) + create res.make (a_output) + application.execute (req, res) + else + if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then + if res /= Void then + if not res.status_is_set then + res.write_header ({HTTP_STATUS_CODE}.internal_server_error, Void) + end + if res.message_writable then + res.write_string ("
" + l_trace + "
") + end + end + end + end + rescue + rescued := True + retry end feature -- Input/Output