From c44cf5e983a2f5a7e126e3788c70ac29cda09bb6 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 22 Mar 2013 16:06:10 +0100 Subject: [PATCH] Fixed assertion that were broken with recent delayed header response. Changed semantic of put_header_lines and add_header_lines, Now the arguments are iterable of string (i.e the header line) The previous features were not used, and were not well named. So we removed them, and reused the names for adpated implementation. --- .../ewsgi/specification/response/wgi_response.e | 4 ++-- .../implementation/wsf_wgi_delayed_header_response.e | 11 +++++++++-- library/server/wsf/src/wsf_response.e | 11 +++++------ library/server/wsf/src/wsf_response_message.e | 3 +-- 4 files changed, 17 insertions(+), 12 deletions(-) diff --git a/library/server/ewsgi/specification/response/wgi_response.e b/library/server/ewsgi/specification/response/wgi_response.e index 11db233e..8b592f29 100644 --- a/library/server/ewsgi/specification/response/wgi_response.e +++ b/library/server/ewsgi/specification/response/wgi_response.e @@ -11,17 +11,17 @@ feature {WGI_CONNECTOR, WGI_SERVICE} -- Commit push -- Commit and push response do - commit if attached post_commit_action as act then act.call (Void) end + commit end commit -- Commit the current response deferred ensure - status_is_set: status_is_set + status_committed: status_committed header_committed: header_committed message_committed: message_committed end 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 006b67ff..9b685893 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 @@ -14,7 +14,8 @@ inherit put_string, put_substring, flush, - message_writable + message_writable, + message_committed end WSF_RESPONSE_EXPORTER @@ -36,10 +37,10 @@ feature {NONE} -- Implementation commit do - Precursor if not header_committed then process_header end + Precursor end process_header @@ -65,6 +66,12 @@ feature -- Status report message_writable: BOOLEAN = True -- Can message be written? + message_committed: BOOLEAN + -- + do + Result := header_committed + end + feature -- Output operation put_character (c: CHARACTER_8) diff --git a/library/server/wsf/src/wsf_response.e b/library/server/wsf/src/wsf_response.e index c70c1da3..cc2b6b5f 100644 --- a/library/server/wsf/src/wsf_response.e +++ b/library/server/wsf/src/wsf_response.e @@ -252,23 +252,23 @@ feature -- Header output operation: helpers message_writable: message_writable end - put_header_lines (a_lines: ITERABLE [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]) + put_header_lines (a_lines: ITERABLE [READABLE_STRING_8]) -- Put headers from `a_lines' require header_not_committed: not header_committed do across a_lines as c loop - put_header_line (c.item.name + ": " + c.item.value) + put_header_line (c.item) end end - add_header_lines (a_lines: ITERABLE [TUPLE [name: READABLE_STRING_8; value: READABLE_STRING_8]]) + add_header_lines (a_lines: ITERABLE [READABLE_STRING_8]) -- Add headers from `a_lines' require header_not_committed: not header_committed do across a_lines as c loop - add_header_line (c.item.name + ": " + c.item.value) + add_header_line (c.item) end end @@ -409,8 +409,7 @@ feature -- Response object do a_message.send_to (Current) ensure - status_committed: status_committed - header_committed: header_committed + status_committed: status_is_set end feature -- Redirect diff --git a/library/server/wsf/src/wsf_response_message.e b/library/server/wsf/src/wsf_response_message.e index 904dd425..70dfa8e2 100644 --- a/library/server/wsf/src/wsf_response_message.e +++ b/library/server/wsf/src/wsf_response_message.e @@ -26,11 +26,10 @@ feature {WSF_RESPONSE} -- Output deferred ensure res_status_set: res.status_is_set - res_header_committed: res.header_committed end note - copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Olivier Ligot, Eiffel Software and others" + 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