Fixed WGI_HTTPD_REQUEST_HANDLER.process_rescue
Fixed WGI_STANDALONE_OUTPUT_STREAM.is_available Added WGI_STANDALONE_RESPONSE_STREAM.is_persistent_connection_supported
This commit is contained in:
@@ -87,6 +87,7 @@ feature -- Request processing
|
|||||||
else
|
else
|
||||||
l_output.set_http_version (version)
|
l_output.set_http_version (version)
|
||||||
end
|
end
|
||||||
|
res.set_is_persistent_connection_supported ({HTTPD_SERVER}.is_persistent_connection_supported)
|
||||||
res.set_is_persistent_connection_requested (is_persistent_connection_requested)
|
res.set_is_persistent_connection_requested (is_persistent_connection_requested)
|
||||||
|
|
||||||
req.set_meta_string_variable ("RAW_HEADER_DATA", request_header)
|
req.set_meta_string_variable ("RAW_HEADER_DATA", request_header)
|
||||||
@@ -111,17 +112,25 @@ feature -- Request processing
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
process_rescue (res: detachable WGI_RESPONSE)
|
process_rescue (res: detachable WGI_RESPONSE)
|
||||||
|
local
|
||||||
|
s: STRING
|
||||||
do
|
do
|
||||||
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.trace as l_trace then
|
if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.trace as l_trace then
|
||||||
if res /= Void then
|
if res /= Void then
|
||||||
if not res.status_is_set then
|
if not res.status_is_set then
|
||||||
res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void)
|
res.set_status_code ({HTTP_STATUS_CODE}.internal_server_error, Void)
|
||||||
end
|
end
|
||||||
|
create s.make_empty
|
||||||
|
s.append ("<pre>")
|
||||||
|
s.append (html_encoder.encoded_string (l_trace))
|
||||||
|
s.append ("</pre>")
|
||||||
|
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
|
if res.message_writable then
|
||||||
res.put_string ("<pre>")
|
res.put_string (s)
|
||||||
res.put_string (html_encoder.encoded_string (l_trace))
|
|
||||||
res.put_string ("</pre>")
|
|
||||||
end
|
end
|
||||||
res.push
|
res.push
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ feature -- Status report
|
|||||||
-- <Precursor>
|
-- <Precursor>
|
||||||
-- for instance IO failure due to socket disconnection.
|
-- for instance IO failure due to socket disconnection.
|
||||||
do
|
do
|
||||||
Result := not last_target_call_succeed
|
Result := last_target_call_succeed
|
||||||
end
|
end
|
||||||
|
|
||||||
is_open_write: BOOLEAN
|
is_open_write: BOOLEAN
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ feature -- Settings
|
|||||||
is_http_version_1_0: BOOLEAN
|
is_http_version_1_0: BOOLEAN
|
||||||
-- Is associated request using HTTP/1.0 ?
|
-- 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: BOOLEAN
|
||||||
-- Is persistent connection requested?
|
-- Is persistent connection requested?
|
||||||
|
|
||||||
@@ -34,6 +37,12 @@ feature -- Settings change
|
|||||||
is_http_version_1_0 := True
|
is_http_version_1_0 := True
|
||||||
end
|
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 (b: BOOLEAN)
|
||||||
-- Set `is_persistent_connection_requested' to `b'.
|
-- Set `is_persistent_connection_requested' to `b'.
|
||||||
do
|
do
|
||||||
@@ -53,7 +62,7 @@ feature -- Header output operation
|
|||||||
create s.make_from_string (a_text)
|
create s.make_from_string (a_text)
|
||||||
|
|
||||||
i := s.substring_index ("%NConnection:", 1)
|
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.
|
-- Current standalone support persistent connection.
|
||||||
-- If HTTP/1.1:
|
-- If HTTP/1.1:
|
||||||
-- by default all connection are persistent
|
-- by default all connection are persistent
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ class
|
|||||||
inherit
|
inherit
|
||||||
WGI_FILTER_RESPONSE
|
WGI_FILTER_RESPONSE
|
||||||
redefine
|
redefine
|
||||||
|
set_status_code,
|
||||||
commit,
|
commit,
|
||||||
put_character,
|
put_character,
|
||||||
put_string,
|
put_string,
|
||||||
@@ -74,6 +75,19 @@ feature {NONE} -- Implementation
|
|||||||
header_committed: header_committed
|
header_committed: header_committed
|
||||||
end
|
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
|
feature -- Status report
|
||||||
|
|
||||||
message_writable: BOOLEAN = True
|
message_writable: BOOLEAN = True
|
||||||
@@ -116,7 +130,7 @@ feature -- Output operation
|
|||||||
end
|
end
|
||||||
|
|
||||||
note
|
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)"
|
license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)"
|
||||||
source: "[
|
source: "[
|
||||||
Eiffel Software
|
Eiffel Software
|
||||||
|
|||||||
Reference in New Issue
Block a user