diff --git a/library/server/ewsgi/connectors/cgi/cgi-safe.ecf b/library/server/ewsgi/connectors/cgi/cgi-safe.ecf index 8d0eaded..cdeca882 100644 --- a/library/server/ewsgi/connectors/cgi/cgi-safe.ecf +++ b/library/server/ewsgi/connectors/cgi/cgi-safe.ecf @@ -1,5 +1,5 @@ - + @@ -12,6 +12,7 @@ + diff --git a/library/server/ewsgi/connectors/cgi/cgi.ecf b/library/server/ewsgi/connectors/cgi/cgi.ecf index c8df2ee7..df9c6f5b 100644 --- a/library/server/ewsgi/connectors/cgi/cgi.ecf +++ b/library/server/ewsgi/connectors/cgi/cgi.ecf @@ -12,6 +12,7 @@ + diff --git a/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e index 4be8f8eb..34b0fbcf 100644 --- a/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e +++ b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e @@ -9,6 +9,10 @@ class inherit WGI_CONNECTOR + SHARED_HTML_ENCODER + + SHARED_EXECUTION_ENVIRONMENT + feature -- Access Name: STRING_8 = "CGI" @@ -27,27 +31,14 @@ feature -- Execution rescued: BOOLEAN do if not rescued then - create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {WGI_CGI_INPUT_STREAM}.make, Current) + create req.make (execution_environment.starting_environment, create {WGI_CGI_INPUT_STREAM}.make, Current) create res.make (create {WGI_CGI_OUTPUT_STREAM}.make, create {WGI_CGI_ERROR_STREAM}.make) create {G} exec.make (req, res) exec.execute - res.flush res.push exec.clean 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.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) - end - if res.message_writable then - res.put_string ("
")
-							res.put_string (l_trace)
-							res.put_string ("
") - end - res.push - end - end + process_rescue (res) if exec /= Void then exec.clean end @@ -59,6 +50,23 @@ feature -- Execution end end + process_rescue (res: detachable WGI_RESPONSE) + do + if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.trace as l_trace then + if res /= Void then + if not res.status_is_set then + res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) + end + if res.message_writable then + res.put_string ("
")
+						res.put_string (html_encoder.encoded_string (l_trace))
+						res.put_string ("
") + end + res.push + end + end + end + note copyright: "2011-2013, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/library/server/ewsgi/connectors/httpd/httpd-safe.ecf b/library/server/ewsgi/connectors/httpd/httpd-safe.ecf index cd28afb9..0213ebef 100644 --- a/library/server/ewsgi/connectors/httpd/httpd-safe.ecf +++ b/library/server/ewsgi/connectors/httpd/httpd-safe.ecf @@ -16,55 +16,7 @@ - - - - - - - - - - - - - - - - - /ssl$ - /EIFGENs$ - /no_ssl$ - /concurrency$ - - - - - - - - - - - - - - - - - - - - - - - - - - - + /httpd$ diff --git a/library/server/ewsgi/connectors/httpd/src/httpd/httpd-safe.ecf b/library/server/ewsgi/connectors/httpd/src/httpd/httpd-safe.ecf index d6691fca..83338d1e 100644 --- a/library/server/ewsgi/connectors/httpd/src/httpd/httpd-safe.ecf +++ b/library/server/ewsgi/connectors/httpd/src/httpd/httpd-safe.ecf @@ -10,9 +10,8 @@ - + - diff --git a/library/server/ewsgi/connectors/httpd/src/wgi_httpd_connector.e b/library/server/ewsgi/connectors/httpd/src/wgi_httpd_connector.e index 639f6e21..5f5f0b06 100644 --- a/library/server/ewsgi/connectors/httpd/src/wgi_httpd_connector.e +++ b/library/server/ewsgi/connectors/httpd/src/wgi_httpd_connector.e @@ -46,7 +46,7 @@ feature {NONE} -- Initialization set_base (a_base) end - set_factory_connector (conn: detachable separate WGI_CONNECTOR; fac: separate WGI_HTTPD_REQUEST_HANDLER_FACTORY [G]) + set_factory_connector (conn: detachable separate WGI_HTTPD_CONNECTOR [G]; fac: separate WGI_HTTPD_REQUEST_HANDLER_FACTORY [G]) do fac.set_connector (conn) end @@ -129,8 +129,15 @@ feature -- Element change end set_max_concurrent_connections (nb: INTEGER) + require + nb_positive_or_zero: nb >= 0 do + set_max_concurrent_connections_on_configuration (nb, configuration) + end + set_is_verbose (b: BOOLEAN) + do + set_is_verbose_on_configuration (b, configuration) end feature {NONE} -- Implementation @@ -145,6 +152,11 @@ feature {NONE} -- Implementation cfg.set_max_concurrent_connections (nb) end + set_is_verbose_on_configuration (b: BOOLEAN; cfg: like configuration) + do + cfg.set_is_verbose (b) + end + feature -- Server launch diff --git a/library/server/ewsgi/connectors/httpd/src/wgi_httpd_request_handler.e b/library/server/ewsgi/connectors/httpd/src/wgi_httpd_request_handler.e index f0bdc24a..de6863ad 100644 --- a/library/server/ewsgi/connectors/httpd/src/wgi_httpd_request_handler.e +++ b/library/server/ewsgi/connectors/httpd/src/wgi_httpd_request_handler.e @@ -14,6 +14,8 @@ inherit REFACTORING_HELPER + SHARED_HTML_ENCODER + create make, make_with_connector @@ -26,7 +28,21 @@ feature {NONE} -- Initialization connector := conn end - connector: detachable separate WGI_CONNECTOR + connector: detachable separate WGI_HTTPD_CONNECTOR [G] + + base: detachable IMMUTABLE_STRING_8 + do + if attached connector as conn then + if attached connector_base (conn) as l_base then + create Result.make_from_separate (l_base) + end + end + end + + connector_base (conn: separate WGI_HTTPD_CONNECTOR [G]): detachable separate READABLE_STRING_8 + do + Result := conn.base + end feature -- Request processing @@ -53,23 +69,10 @@ feature -- Request processing create {G} exec.make (req, res) exec.execute - res.flush res.push exec.clean 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.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) - end - if res.message_writable then - res.put_string ("
")
-							res.put_string (l_trace)
-							res.put_string ("
") - end - res.push - end - end + process_rescue (res) if exec /= Void then exec.clean end @@ -81,10 +84,21 @@ feature -- Request processing end end - base: detachable READABLE_STRING_8 + process_rescue (res: detachable WGI_RESPONSE) do - --TODO - to_implement ("Base url support") + if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.trace as l_trace then + if res /= Void then + if not res.status_is_set then + res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) + end + if res.message_writable then + res.put_string ("
")
+						res.put_string (html_encoder.encoded_string (l_trace))
+						res.put_string ("
") + end + res.push + end + end end httpd_environment (a_socket: HTTPD_STREAM_SOCKET): STRING_TABLE [READABLE_STRING_8] @@ -93,6 +107,7 @@ feature -- Request processing l_request_uri, l_script_name, l_query_string, l_path_info: STRING l_server_name, l_server_port: detachable STRING l_headers_map: HASH_TABLE [STRING, STRING] + l_base: detachable READABLE_STRING_8 vn: STRING e: EXECUTION_ENVIRONMENT @@ -189,7 +204,11 @@ feature -- Request processing set_environment_variable ({HTTPD_CONFIGURATION}.Server_details, "SERVER_SOFTWARE", Result) --| Apply `base' value - if attached base as l_base and then l_request_uri /= Void then + l_base := base + if l_base = Void then + l_base := "" + end + if l_request_uri /= Void then if l_request_uri.starts_with (l_base) then l_path_info := l_request_uri.substring (l_base.count + 1, l_request_uri.count) p := l_path_info.index_of ('?', 1) diff --git a/library/server/ewsgi/connectors/httpd/src/wgi_httpd_request_handler_factory.e b/library/server/ewsgi/connectors/httpd/src/wgi_httpd_request_handler_factory.e index c2b2d5ef..f69d0893 100644 --- a/library/server/ewsgi/connectors/httpd/src/wgi_httpd_request_handler_factory.e +++ b/library/server/ewsgi/connectors/httpd/src/wgi_httpd_request_handler_factory.e @@ -12,7 +12,7 @@ inherit feature -- Access - connector: detachable separate WGI_CONNECTOR + connector: detachable separate WGI_HTTPD_CONNECTOR [G] feature -- Element change diff --git a/library/server/ewsgi/connectors/libfcgi/libfcgi-safe.ecf b/library/server/ewsgi/connectors/libfcgi/libfcgi-safe.ecf index 689dcbf5..7cc2a211 100644 --- a/library/server/ewsgi/connectors/libfcgi/libfcgi-safe.ecf +++ b/library/server/ewsgi/connectors/libfcgi/libfcgi-safe.ecf @@ -1,5 +1,5 @@ - + @@ -13,6 +13,7 @@ + diff --git a/library/server/ewsgi/connectors/libfcgi/libfcgi.ecf b/library/server/ewsgi/connectors/libfcgi/libfcgi.ecf index a95e88d0..80279ae1 100644 --- a/library/server/ewsgi/connectors/libfcgi/libfcgi.ecf +++ b/library/server/ewsgi/connectors/libfcgi/libfcgi.ecf @@ -13,6 +13,7 @@ + diff --git a/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e index 1b994d85..2bd68609 100644 --- a/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e +++ b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e @@ -14,11 +14,16 @@ inherit default_create end + SHARED_HTML_ENCODER + redefine + default_create + end + feature {NONE} -- Initialization default_create do - Precursor + Precursor {WGI_CONNECTOR} create fcgi.make create input.make (fcgi) create output.make (fcgi) @@ -63,23 +68,10 @@ feature -- Execution create res.make (a_output, a_output) create {G} exec.make (req, res) exec.execute - res.flush res.push exec.clean 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.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) - end - if res.message_writable then - res.put_string ("
")
-							res.put_string (l_trace)
-							res.put_string ("
") - end - res.push - end - end + process_rescue (res) if exec /= Void then exec.clean end @@ -90,6 +82,23 @@ feature -- Execution retry end end + + process_rescue (res: detachable WGI_RESPONSE) + do + if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.trace as l_trace then + if res /= Void then + if not res.status_is_set then + res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) + end + if res.message_writable then + res.put_string ("
")
+						res.put_string (html_encoder.encoded_string (l_trace))
+						res.put_string ("
") + end + res.push + end + end + end feature -- Input/Output diff --git a/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e index 7543a0df..524659ac 100644 --- a/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e @@ -9,18 +9,18 @@ class inherit WGI_CONNECTOR + SHARED_HTML_ENCODER + create make, make_with_base feature {NONE} -- Initialization - make --(a_service: like service) + make local cfg: HTTP_SERVER_CONFIGURATION do --- service := a_service - create cfg.make create server.make (cfg) @@ -45,11 +45,6 @@ feature -- Access version: STRING_8 = "0.1" -- Version of Current connector ---feature {NONE} -- Access - --- service: WGI_SERVICE --- -- Gateway Service - feature -- Access server: HTTP_SERVER @@ -142,23 +137,10 @@ feature -- Server create {G} exec.make (req, res) exec.execute - res.flush res.push exec.clean 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.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) - end - if res.message_writable then - res.put_string ("
")
-							res.put_string (l_trace)
-							res.put_string ("
") - end - res.push - end - end + process_rescue (res) if exec /= Void then exec.clean end @@ -170,6 +152,23 @@ feature -- Server end end + process_rescue (res: detachable WGI_RESPONSE) + do + if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.trace as l_trace then + if res /= Void then + if not res.status_is_set then + res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void) + end + if res.message_writable then + res.put_string ("
")
+						res.put_string (html_encoder.encoded_string (l_trace))
+						res.put_string ("
") + end + res.push + end + end + end + note copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/library/server/ewsgi/specification/connector/wgi_execution.e b/library/server/ewsgi/specification/connector/wgi_execution.e index 204be494..deb0734c 100644 --- a/library/server/ewsgi/specification/connector/wgi_execution.e +++ b/library/server/ewsgi/specification/connector/wgi_execution.e @@ -30,7 +30,15 @@ feature -- Execution -- Execute the request based on `request' and `response'. deferred ensure - status_is_set: response.status_is_set + is_valid_end_of_execution: is_valid_end_of_execution + end + +feature -- Status report + + is_valid_end_of_execution: BOOLEAN + -- Last `execute' completed in valid state? + do + Result := True end feature -- Cleaning @@ -40,6 +48,11 @@ feature -- Cleaning do end +invariant + + wgi_request_set: request /= Void + wgi_response_set: response /= Void + note copyright: "2011-2015, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" diff --git a/library/server/wsf/connector/httpd/wsf_httpd_service_launcher.e b/library/server/wsf/connector/httpd/wsf_httpd_service_launcher.e index 4644ae61..6738c80f 100644 --- a/library/server/wsf/connector/httpd/wsf_httpd_service_launcher.e +++ b/library/server/wsf/connector/httpd/wsf_httpd_service_launcher.e @@ -79,7 +79,7 @@ feature {NONE} -- Initialization feature -- Execution - update_configuration (cfg: separate HTTPD_CONFIGURATION) + update_configuration (cfg: like connector.configuration) do if single_threaded then cfg.set_force_single_threaded (True) diff --git a/library/server/wsf/router/support/uri/helpers/wsf_uri_routed_service.e b/library/server/wsf/router/support/uri/helpers/wsf_uri_routed_service.e deleted file mode 100644 index 4575190a..00000000 --- a/library/server/wsf/router/support/uri/helpers/wsf_uri_routed_service.e +++ /dev/null @@ -1,27 +0,0 @@ -note - description: "Summary description for {WSF_URI_ROUTED_SERVICE}." - author: "" - date: "$Date$" - revision: "$Revision$" - -deferred class - WSF_URI_ROUTED_SERVICE - -obsolete "Inherit from WSF_ROUTED_SERVICE and WSF_URI_HELPER_FOR_ROUTED_SERVICE [2013-mar-19]" - -inherit - WSF_ROUTED_SERVICE - - WSF_URI_HELPER_FOR_ROUTED_SERVICE - -note - copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_routed_service.e b/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_routed_service.e deleted file mode 100644 index 91052448..00000000 --- a/library/server/wsf/router/support/uri_template/helpers/wsf_uri_template_routed_service.e +++ /dev/null @@ -1,27 +0,0 @@ -note - description: "Summary description for {WSF_URI_TEMPLATE_ROUTED_SERVICE}." - author: "" - date: "$Date$" - revision: "$Revision$" - -deferred class - WSF_URI_TEMPLATE_ROUTED_SERVICE - -obsolete "Inherit from WSF_ROUTED_SERVICE and WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE [2013-mar-19]" - -inherit - WSF_ROUTED_SERVICE - - WSF_URI_TEMPLATE_HELPER_FOR_ROUTED_SERVICE - -note - copyright: "2011-2013, Jocelyn Fiat, Javier Velilla, Olivier Ligot, 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 diff --git a/library/server/wsf/src/service/wsf_response_service.e b/library/server/wsf/src/service/wsf_response_service.e index 383d9cdd..5b375e19 100644 --- a/library/server/wsf/src/service/wsf_response_service.e +++ b/library/server/wsf/src/service/wsf_response_service.e @@ -8,7 +8,7 @@ note revision: "$Revision$" deferred class - WSF_RESPONSE_SERVICE + WSF_RESPONSE_SERVICE [G -> WSF_EXECUTION create make end] inherit WSF_SERVICE @@ -29,7 +29,7 @@ feature -- Execution end note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + copyright: "2011-2015, 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 diff --git a/library/server/wsf/src/service/wsf_service_launcher.e b/library/server/wsf/src/service/wsf_service_launcher.e index 5ac1ed97..2568a5e0 100644 --- a/library/server/wsf/src/service/wsf_service_launcher.e +++ b/library/server/wsf/src/service/wsf_service_launcher.e @@ -34,9 +34,6 @@ note deferred class WSF_SERVICE_LAUNCHER [G -> WSF_EXECUTION create make end] -inherit - WSF_TO_WGI_SERVICE - feature {NONE} -- Initialization frozen make (a_options: like options) diff --git a/library/server/wsf/src/wsf_execution.e b/library/server/wsf/src/wsf_execution.e index 9af7db08..ea559543 100644 --- a/library/server/wsf/src/wsf_execution.e +++ b/library/server/wsf/src/wsf_execution.e @@ -15,7 +15,8 @@ inherit redefine make, execute, - clean + clean, + is_valid_end_of_execution end --create @@ -47,8 +48,24 @@ feature {NONE} -- Access response: WSF_RESPONSE -- Access to output stream, back to the client. +feature -- Execution + + execute + -- Execute Current `request', + -- getting data from `request' + -- and response to client via `response'. + deferred + end + feature -- Status report + is_valid_end_of_execution: BOOLEAN + -- + do + --| Note: overwrite precursor implementation + Result := Precursor and response.status_is_set + end + message_writable: BOOLEAN do Result := response.message_writable @@ -77,16 +94,6 @@ feature -- Helpers response.put_error (err) end -feature -- Execution - - execute - -- Execute Current `request', - -- getting data from `request' - -- and response to client via `response'. - deferred - ensure then - status_is_set: response.status_is_set - end feature -- Cleaning @@ -97,6 +104,11 @@ feature -- Cleaning request.destroy end +invariant + + wsf_request_set: request /= Void + wsf_response_set: response /= Void + note copyright: "2011-2015, 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)"