diff --git a/library/server/ewsgi/connectors/standalone/src/implementation/wgi_httpd_request_handler.e b/library/server/ewsgi/connectors/standalone/src/implementation/wgi_httpd_request_handler.e
index 0ddecd18..3abd5220 100644
--- a/library/server/ewsgi/connectors/standalone/src/implementation/wgi_httpd_request_handler.e
+++ b/library/server/ewsgi/connectors/standalone/src/implementation/wgi_httpd_request_handler.e
@@ -87,6 +87,7 @@ feature -- Request processing
else
l_output.set_http_version (version)
end
+ res.set_is_persistent_connection_supported ({HTTPD_SERVER}.is_persistent_connection_supported)
res.set_is_persistent_connection_requested (is_persistent_connection_requested)
req.set_meta_string_variable ("RAW_HEADER_DATA", request_header)
@@ -111,22 +112,30 @@ feature -- Request processing
end
end
+
process_rescue (res: detachable WGI_RESPONSE)
+ local
+ s: STRING
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
+ create s.make_empty
+ s.append ("
")
+ s.append (html_encoder.encoded_string (l_trace))
+ s.append ("")
+ if not res.header_committed then
+ res.put_header_text ("Content-Type: text/html%R%NContent-Length: " + s.count.out + "%R%N%R%N")
+ end
if res.message_writable then
- res.put_string ("")
- res.put_string (html_encoder.encoded_string (l_trace))
- res.put_string ("")
+ res.put_string (s)
end
res.push
end
end
- end
+ end
httpd_environment (a_socket: HTTPD_STREAM_SOCKET): STRING_TABLE [READABLE_STRING_8]
local
diff --git a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_output_stream.e b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_output_stream.e
index ed4db3c4..b3656cbb 100644
--- a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_output_stream.e
+++ b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_output_stream.e
@@ -100,7 +100,7 @@ feature -- Status report
--
-- for instance IO failure due to socket disconnection.
do
- Result := not last_target_call_succeed
+ Result := last_target_call_succeed
end
is_open_write: BOOLEAN
diff --git a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_response_stream.e b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_response_stream.e
index d4863bde..ad19d07e 100644
--- a/library/server/ewsgi/connectors/standalone/src/wgi_standalone_response_stream.e
+++ b/library/server/ewsgi/connectors/standalone/src/wgi_standalone_response_stream.e
@@ -23,6 +23,9 @@ feature -- Settings
is_http_version_1_0: BOOLEAN
-- Is associated request using HTTP/1.0 ?
+ is_persistent_connection_supported: BOOLEAN
+ -- Is persistent connection supported?
+
is_persistent_connection_requested: BOOLEAN
-- Is persistent connection requested?
@@ -34,6 +37,12 @@ feature -- Settings change
is_http_version_1_0 := True
end
+ set_is_persistent_connection_supported (b: BOOLEAN)
+ -- Set `is_persistent_connection_supported' to `b'.
+ do
+ is_persistent_connection_supported := b
+ end
+
set_is_persistent_connection_requested (b: BOOLEAN)
-- Set `is_persistent_connection_requested' to `b'.
do
@@ -53,7 +62,7 @@ feature -- Header output operation
create s.make_from_string (a_text)
i := s.substring_index ("%NConnection:", 1)
- if {HTTPD_SERVER}.is_persistent_connection_supported then
+ if is_persistent_connection_supported then
-- Current standalone support persistent connection.
-- If HTTP/1.1:
-- by default all connection are persistent
diff --git a/library/server/wsf/src/implementation/wsf_wgi_delayed_header_response.e b/library/server/wsf/src/implementation/wsf_wgi_delayed_header_response.e
index 1b65b8f7..cb920fc3 100644
--- a/library/server/wsf/src/implementation/wsf_wgi_delayed_header_response.e
+++ b/library/server/wsf/src/implementation/wsf_wgi_delayed_header_response.e
@@ -9,6 +9,7 @@ class
inherit
WGI_FILTER_RESPONSE
redefine
+ set_status_code,
commit,
put_character,
put_string,
@@ -74,6 +75,19 @@ feature {NONE} -- Implementation
header_committed: header_committed
end
+feature -- Status setting
+
+ set_status_code (a_code: INTEGER; a_reason_phrase: detachable READABLE_STRING_8)
+ -- Set response status code with custom `a_reason_phrase' if precised
+ -- Should be done before sending any data back to the client
+ do
+ if a_reason_phrase /= Void then
+ wsf_response.set_status_code_with_reason_phrase (a_code, a_reason_phrase)
+ else
+ wsf_response.set_status_code (a_code)
+ end
+ end
+
feature -- Status report
message_writable: BOOLEAN = True
@@ -116,7 +130,7 @@ feature -- Output operation
end
note
- copyright: "2011-2013, 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