Fixed compilation
This commit is contained in:
@@ -36,21 +36,24 @@ feature {NONE} -- Initialization
|
||||
|
||||
feature -- Status writing
|
||||
|
||||
put_status_line (a_code: INTEGER)
|
||||
-- Put status code line for `a_code'
|
||||
--| Note this is a default implementation, and could be redefined
|
||||
--| for instance in relation to NPH NULL script
|
||||
put_status_line (a_code: INTEGER; a_reason_phrase: detachable READABLE_STRING_8)
|
||||
-- <Precursor>
|
||||
local
|
||||
s: STRING
|
||||
m: detachable READABLE_STRING_8
|
||||
do
|
||||
if a_code /= 200 then
|
||||
create s.make (16)
|
||||
s.append ("Status:")
|
||||
s.append_character (' ')
|
||||
s.append_integer (a_code)
|
||||
if attached http_status_code_message (a_code) as l_status_message then
|
||||
m := a_reason_phrase
|
||||
if m = Void then
|
||||
m := http_status_code_message (a_code)
|
||||
end
|
||||
if m /= Void then
|
||||
s.append_character (' ')
|
||||
s.append_string (l_status_message)
|
||||
s.append_string (m)
|
||||
end
|
||||
put_header_line (s)
|
||||
end
|
||||
|
||||
@@ -23,8 +23,8 @@ feature {NONE} -- Initialization
|
||||
|
||||
execute (req: WGI_REQUEST; res: WGI_RESPONSE)
|
||||
do
|
||||
res.set_status_code (200)
|
||||
res.put_header_lines (<<["Content-Type", "text/plain"]>>)
|
||||
res.set_status_code (200, Void)
|
||||
res.put_header_text ("Content-Type: text/plain%R%N")
|
||||
res.put_string ("Hello World!%N")
|
||||
end
|
||||
|
||||
|
||||
@@ -82,6 +82,7 @@ feature -- Header output operation
|
||||
-- It should not contain the ending CR LF CR LF
|
||||
-- since it is the duty of `put_header_text' to write it.
|
||||
require
|
||||
a_text_has_single_ending_crlf: a_text.count > 2 implies not a_text.substring (a_text.count - 2, a_text.count).same_string ("%R%N")
|
||||
a_text_does_not_has_ending_crlf_crlf: a_text.count > 4 implies not a_text.substring (a_text.count - 4, a_text.count).same_string ("%R%N%R%N")
|
||||
status_set: status_is_set
|
||||
header_not_committed: not header_committed
|
||||
|
||||
@@ -100,14 +100,16 @@ feature -- Status setting
|
||||
|
||||
feature -- Header output operation
|
||||
|
||||
put_header_text (a_headers: READABLE_STRING_8)
|
||||
-- Sent `a_headers' and just before send the status code
|
||||
put_header_text (a_text: READABLE_STRING_8)
|
||||
-- Sent `a_text' and just before send the status code
|
||||
require
|
||||
status_set: status_is_set
|
||||
header_not_committed: not header_committed
|
||||
a_text_ends_with_single_crlf: a_text.count > 2 implies not a_text.substring (a_text.count - 2, a_text.count).same_string ("%R%N")
|
||||
a_text_does_not_end_with_double_crlf: a_text.count > 4 implies not a_text.substring (a_text.count - 4, a_text.count).same_string ("%R%N%R%N")
|
||||
do
|
||||
wgi_response.set_status_code (status_code, status_reason_phrase)
|
||||
wgi_response.put_header_text (a_headers)
|
||||
wgi_response.put_header_text (a_text)
|
||||
ensure
|
||||
status_set: status_is_set
|
||||
status_committed: status_committed
|
||||
|
||||
Reference in New Issue
Block a user