diff --git a/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e index efd6b78b..b379eb5c 100644 --- a/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e @@ -1,6 +1,5 @@ note description: "Summary description for {WGI_NINO_CONNECTOR}." - author: "" date: "$Date$" revision: "$Revision$" @@ -127,7 +126,7 @@ feature -- Server end note - copyright: "2011-2012, Eiffel Software and others" + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/ewsgi/connectors/nino/src/wgi_nino_response_stream.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_response_stream.e index c98789ff..782801de 100644 --- a/library/server/ewsgi/connectors/nino/src/wgi_nino_response_stream.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_response_stream.e @@ -21,19 +21,24 @@ create feature -- Header output operation put_header_text (a_text: READABLE_STRING_8) + local + o: like output do - write (a_text) + o := output + o.put_string (a_text) + -- Nino does not support persistent connection for now - write ("Connection: close") - write (crlf) + o.put_string ("Connection: close") + o.put_crlf -- end of headers - write (crlf) + o.put_crlf + header_committed := True end ;note - copyright: "2011-2012, Eiffel Software and others" + copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" source: "[ Eiffel Software diff --git a/library/server/ewsgi/specification/response/wgi_response.e b/library/server/ewsgi/specification/response/wgi_response.e index 4a03779c..e16e4244 100644 --- a/library/server/ewsgi/specification/response/wgi_response.e +++ b/library/server/ewsgi/specification/response/wgi_response.e @@ -42,14 +42,6 @@ feature -- Status report deferred end -feature {WGI_RESPONSE} -- Core output operation - - write (s: READABLE_STRING_8) - -- Send the string `s' - -- this can be used for header and body - deferred - end - feature -- Status setting status_is_set: BOOLEAN diff --git a/library/server/ewsgi/src/implementation/wgi_response_stream.e b/library/server/ewsgi/src/implementation/wgi_response_stream.e index f75861b0..bc954efd 100644 --- a/library/server/ewsgi/src/implementation/wgi_response_stream.e +++ b/library/server/ewsgi/src/implementation/wgi_response_stream.e @@ -48,15 +48,6 @@ feature -- Status report Result := status_is_set and header_committed end -feature {NONE} -- Core output operation - - write (s: READABLE_STRING_8) - -- Send the content of `s' - -- this can be used for header and body - do - output.put_string (s) - end - feature -- Status setting status_is_set: BOOLEAN @@ -81,8 +72,8 @@ feature -- Header output operation put_header_text (a_text: READABLE_STRING_8) do - write (a_text) - write (crlf) + output.put_string (a_text) + output.put_crlf header_committed := True end @@ -126,9 +117,6 @@ feature -- Output operation feature {NONE} -- Implementation: Access - crlf: STRING = "%R%N" - -- End of header - output: WGI_OUTPUT_STREAM -- Server output channel diff --git a/library/server/ewsgi/src/wgi_output_stream.e b/library/server/ewsgi/src/wgi_output_stream.e index bfa74b09..9289378e 100644 --- a/library/server/ewsgi/src/wgi_output_stream.e +++ b/library/server/ewsgi/src/wgi_output_stream.e @@ -52,7 +52,13 @@ feature -- Specific output -- Send `s' to http client as header line do put_string (s) - put_string ("%R%N") + put_crlf + end + + put_crlf + -- Send "%R%N" string + do + put_string (crlf) end feature -- Status writing @@ -80,6 +86,10 @@ feature -- Basic operations deferred end +feature -- Constant + + crlf: STRING = "%R%N" + note copyright: "2011-2012, Jocelyn Fiat, Javier Velilla, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/library/server/wsf/router/wsf_file_system_handler.e b/library/server/wsf/router/wsf_file_system_handler.e index e495b1e7..0eb12e71 100644 --- a/library/server/wsf/router/wsf_file_system_handler.e +++ b/library/server/wsf/router/wsf_file_system_handler.e @@ -185,7 +185,7 @@ feature -- Execution fres.set_status_code ({HTTP_STATUS_CODE}.ok) fres.set_answer_head_request_method (req.request_method.same_string ({HTTP_REQUEST_METHODS}.method_head)) - res.put_response (fres) + res.send (fres) end respond_not_found (uri: READABLE_STRING_8; ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) diff --git a/library/server/wsf/router/wsf_response_handler.e b/library/server/wsf/router/wsf_response_handler.e index dbd7fda9..d31b3a14 100644 --- a/library/server/wsf/router/wsf_response_handler.e +++ b/library/server/wsf/router/wsf_response_handler.e @@ -32,7 +32,7 @@ feature -- Implementation execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do - response (ctx, req).send_to (res) + res.send (response (ctx, req)) end note diff --git a/library/server/wsf/src/response/wsf_file_response.e b/library/server/wsf/src/response/wsf_file_response.e index f01e7cbb..2797b647 100644 --- a/library/server/wsf/src/response/wsf_file_response.e +++ b/library/server/wsf/src/response/wsf_file_response.e @@ -150,7 +150,7 @@ feature -- Element change update_content_length end -feature -- Basic operations +feature {WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local diff --git a/library/server/wsf/src/response/wsf_html_page_response.e b/library/server/wsf/src/response/wsf_html_page_response.e index 0f7de3a1..292c6e87 100644 --- a/library/server/wsf/src/response/wsf_html_page_response.e +++ b/library/server/wsf/src/response/wsf_html_page_response.e @@ -110,7 +110,7 @@ feature -- Element change body := b end -feature -- Output +feature {WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local diff --git a/library/server/wsf/src/response/wsf_page_response.e b/library/server/wsf/src/response/wsf_page_response.e index a6938ca6..1918ffd7 100644 --- a/library/server/wsf/src/response/wsf_page_response.e +++ b/library/server/wsf/src/response/wsf_page_response.e @@ -1,5 +1,7 @@ note - description: "Summary description for {WSF_PAGE_RESPONSE}." + description: "[ + + ]" author: "" date: "$Date$" revision: "$Revision$" @@ -77,7 +79,7 @@ feature -- Element change l_body.append (a_string) end -feature -- Output +feature {WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local diff --git a/library/server/wsf/src/response/wsf_redirection_response.e b/library/server/wsf/src/response/wsf_redirection_response.e index 80da1a9f..8115697d 100644 --- a/library/server/wsf/src/response/wsf_redirection_response.e +++ b/library/server/wsf/src/response/wsf_redirection_response.e @@ -69,7 +69,7 @@ feature -- Element change content_type := Void end -feature -- Output +feature {WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) local diff --git a/library/server/wsf/src/wsf_response.e b/library/server/wsf/src/wsf_response.e index 8214ce7f..d7766f5d 100644 --- a/library/server/wsf/src/wsf_response.e +++ b/library/server/wsf/src/wsf_response.e @@ -187,15 +187,31 @@ feature -- Output operation feature -- Response object - put_response (obj: WSF_RESPONSE_MESSAGE) - -- Set `obj' as the whole response to the client - --| `obj' is responsible to sent the status code, the header and the content + put_response (a_message: WSF_RESPONSE_MESSAGE) + -- Set `a_message' as the whole response to the client + --| `a_message' is responsible to sent the status code, the header and the content + obsolete + "[2012-Mars-19] Use `send (a_message)' " require header_not_committed: not header_committed status_not_committed: not status_committed no_message_committed: not message_committed do - obj.send_to (Current) + a_message.send_to (Current) + ensure + status_committed: status_committed + header_committed: header_committed + end + + send (a_message: WSF_RESPONSE_MESSAGE) + -- Set `a_message' as the whole response to the client + --| `a_message' is responsible to sent the status code, the header and the content + require + header_not_committed: not header_committed + status_not_committed: not status_committed + no_message_committed: not message_committed + do + a_message.send_to (Current) ensure status_committed: status_committed header_committed: header_committed diff --git a/library/server/wsf/src/wsf_response_message.e b/library/server/wsf/src/wsf_response_message.e index f2f600d2..103cfa26 100644 --- a/library/server/wsf/src/wsf_response_message.e +++ b/library/server/wsf/src/wsf_response_message.e @@ -7,10 +7,17 @@ note deferred class WSF_RESPONSE_MESSAGE -feature -- Output +feature {WSF_RESPONSE} -- Output send_to (res: WSF_RESPONSE) + require + header_not_committed: not res.header_committed + status_not_committed: not res.status_committed + no_message_committed: not res.message_committed deferred + ensure + res_status_set: res.status_is_set + res_header_committed: res.header_committed end note