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.
This commit is contained in:
Jocelyn Fiat
2013-03-22 16:06:10 +01:00
parent 665772bda2
commit c44cf5e983
4 changed files with 17 additions and 12 deletions

View File

@@ -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

View File

@@ -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
-- <Precursor>
do
Result := header_committed
end
feature -- Output operation
put_character (c: CHARACTER_8)

View File

@@ -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

View File

@@ -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