From 14a2c01f410c4909fe278d5859d1f1edeaf34205 Mon Sep 17 00:00:00 2001 From: Jocelyn Fiat Date: Fri, 21 Oct 2011 16:56:23 +0200 Subject: [PATCH] Applied recent changes on WGI_ and WSF_ Moved classes away from ewsgi, restructured, cleaned --- examples/hello_routed_world/hello-safe.ecf | 8 +- .../src/hello_routed_world.e | 26 +- examples/restbucks/restbucks-safe.ecf | 4 +- .../restbucks/src/resource/order_handler.e | 22 +- examples/restbucks/src/restbucks_server.e | 6 +- ext/server/nino | 2 +- .../server/ewsgi/connectors/cgi/cgi-safe.ecf | 1 + library/server/ewsgi/connectors/cgi/cgi.ecf | 1 + ...wf_cgi_connector.e => wgi_cgi_connector.e} | 8 +- ..._input_stream.e => wgi_cgi_input_stream.e} | 4 +- ...utput_stream.e => wgi_cgi_output_stream.e} | 4 +- .../common}/wgi_connector.e | 0 .../ewsgi/connectors/connector-safe.ecf | 16 + library/server/ewsgi/connectors/connector.ecf | 16 + .../ewsgi/connectors/libfcgi/libfcgi-safe.ecf | 1 + .../ewsgi/connectors/libfcgi/libfcgi.ecf | 1 + ...gi_connector.e => wgi_libfcgi_connector.e} | 8 +- ...ut_stream.e => wgi_libfcgi_input_stream.e} | 4 +- ...t_stream.e => wgi_libfcgi_output_stream.e} | 4 +- .../ewsgi/connectors/nino/nino-safe.ecf | 1 + library/server/ewsgi/connectors/nino/nino.ecf | 1 + .../nino/src}/nino_application.e | 2 +- ..._nino_connector.e => wgi_nino_connector.e} | 10 +- ...{ewf_nino_handler.e => wgi_nino_handler.e} | 4 +- ...input_stream.e => wgi_nino_input_stream.e} | 6 +- ...tput_stream.e => wgi_nino_output_stream.e} | 6 +- library/server/ewsgi/default.7z | Bin 0 -> 2082 bytes .../ewsgi/examples/hello_world/hello-safe.ecf | 1 - .../ewsgi/examples/hello_world/hello.ecf | 1 - .../hello_world_with_response/hello-safe.ecf | 28 -- .../hello_world_with_response/license.lic | 10 - .../src/hello_world.e | 48 -- .../src/hello_world_response.e | 70 --- .../specification/connector/wgi_connector.e | 44 -- .../request/obsolete/wgi_cookie.e | 76 ---- .../request/obsolete/wgi_variables.e | 80 ---- .../ewsgi/src/extra/ewf_buffered_response.e | 186 -------- .../extra/in_memory/ewf_in_memory_response.e | 151 ------- .../ewf_in_memory_response_application.e | 59 --- .../extra/response_as_result/wgi_response.e | 226 ---------- .../wgi_response_application.e | 56 --- .../src/{ => helper}/wgi_request_from_table.e | 0 .../{ => helper}/wgi_response_stream_buffer.e | 0 library/server/ewsgi/src/support/ewf_error.e | 66 --- library/server/request/rest/tests/sample.ecf | 2 +- .../gateway/cgi/rest_application_gateway.e | 6 +- .../gateway/fcgi/rest_application_gateway.e | 2 +- .../gateway/nino/rest_application_gateway.e | 2 +- .../src/handler/app_request_handler_context.e | 4 +- .../default/cgi-safe.ecf} | 9 +- .../ewsgi_cgi.ecf => wsf/default/cgi.ecf} | 9 +- .../default/cgi/default_application.e} | 8 +- .../default/nino-safe.ecf} | 9 +- .../ewsgi_nino.ecf => wsf/default/nino.ecf} | 9 +- .../default/nino/default_application.e} | 10 +- library/server/wsf/src/support/wsf_header.e | 414 +----------------- library/server/wsf/src/wsf_request.e | 2 +- .../tests/test_wsf_request.e} | 9 +- .../{ewsgi => wsf}/tests/tests-safe.ecf | 8 +- library/server/{ewsgi => wsf}/tests/tests.ecf | 6 +- library/server/wsf/wsf-safe.ecf | 4 +- library/server/wsf/wsf.ecf | 8 +- 62 files changed, 163 insertions(+), 1626 deletions(-) rename library/server/ewsgi/connectors/cgi/src/{ewf_cgi_connector.e => wgi_cgi_connector.e} (85%) rename library/server/ewsgi/connectors/cgi/src/{ewf_cgi_input_stream.e => wgi_cgi_input_stream.e} (88%) rename library/server/ewsgi/connectors/cgi/src/{ewf_cgi_output_stream.e => wgi_cgi_output_stream.e} (93%) rename library/server/ewsgi/{src/connector => connectors/common}/wgi_connector.e (100%) create mode 100644 library/server/ewsgi/connectors/connector-safe.ecf create mode 100644 library/server/ewsgi/connectors/connector.ecf rename library/server/ewsgi/connectors/libfcgi/src/{ewf_libfcgi_connector.e => wgi_libfcgi_connector.e} (90%) rename library/server/ewsgi/connectors/libfcgi/src/{ewf_libfcgi_input_stream.e => wgi_libfcgi_input_stream.e} (92%) rename library/server/ewsgi/connectors/libfcgi/src/{ewf_libfcgi_output_stream.e => wgi_libfcgi_output_stream.e} (94%) rename library/server/ewsgi/{default/nino => connectors/nino/src}/nino_application.e (98%) rename library/server/ewsgi/connectors/nino/src/{ewf_nino_connector.e => wgi_nino_connector.e} (89%) rename library/server/ewsgi/connectors/nino/src/{ewf_nino_handler.e => wgi_nino_handler.e} (99%) rename library/server/ewsgi/connectors/nino/src/{ewf_nino_input_stream.e => wgi_nino_input_stream.e} (88%) rename library/server/ewsgi/connectors/nino/src/{ewf_nino_output_stream.e => wgi_nino_output_stream.e} (91%) create mode 100644 library/server/ewsgi/default.7z delete mode 100644 library/server/ewsgi/examples/hello_world_with_response/hello-safe.ecf delete mode 100644 library/server/ewsgi/examples/hello_world_with_response/license.lic delete mode 100644 library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e delete mode 100644 library/server/ewsgi/examples/hello_world_with_response/src/hello_world_response.e delete mode 100644 library/server/ewsgi/specification/connector/wgi_connector.e delete mode 100644 library/server/ewsgi/specification/request/obsolete/wgi_cookie.e delete mode 100644 library/server/ewsgi/specification/request/obsolete/wgi_variables.e delete mode 100644 library/server/ewsgi/src/extra/ewf_buffered_response.e delete mode 100644 library/server/ewsgi/src/extra/in_memory/ewf_in_memory_response.e delete mode 100644 library/server/ewsgi/src/extra/in_memory/ewf_in_memory_response_application.e delete mode 100644 library/server/ewsgi/src/extra/response_as_result/wgi_response.e delete mode 100644 library/server/ewsgi/src/extra/response_as_result/wgi_response_application.e rename library/server/ewsgi/src/{ => helper}/wgi_request_from_table.e (100%) rename library/server/ewsgi/src/{ => helper}/wgi_response_stream_buffer.e (100%) delete mode 100644 library/server/ewsgi/src/support/ewf_error.e rename library/server/{ewsgi/default/ewsgi_cgi-safe.ecf => wsf/default/cgi-safe.ecf} (76%) rename library/server/{ewsgi/default/ewsgi_cgi.ecf => wsf/default/cgi.ecf} (75%) rename library/server/{ewsgi/default/cgi/default_wgi_application.e => wsf/default/cgi/default_application.e} (79%) rename library/server/{ewsgi/default/ewsgi_nino-safe.ecf => wsf/default/nino-safe.ecf} (78%) rename library/server/{ewsgi/default/ewsgi_nino.ecf => wsf/default/nino.ecf} (78%) rename library/server/{ewsgi/default/nino/default_wgi_application.e => wsf/default/nino/default_application.e} (82%) rename library/server/{ewsgi/tests/test_ewsgi_request.e => wsf/tests/test_wsf_request.e} (96%) rename library/server/{ewsgi => wsf}/tests/tests-safe.ecf (77%) rename library/server/{ewsgi => wsf}/tests/tests.ecf (84%) diff --git a/examples/hello_routed_world/hello-safe.ecf b/examples/hello_routed_world/hello-safe.ecf index ec8e1532..99eb92e6 100644 --- a/examples/hello_routed_world/hello-safe.ecf +++ b/examples/hello_routed_world/hello-safe.ecf @@ -1,5 +1,5 @@ - + @@ -8,14 +8,14 @@ /\.svn$ - + - + diff --git a/examples/hello_routed_world/src/hello_routed_world.e b/examples/hello_routed_world/src/hello_routed_world.e index c061f793..893022de 100644 --- a/examples/hello_routed_world/src/hello_routed_world.e +++ b/examples/hello_routed_world/src/hello_routed_world.e @@ -14,7 +14,7 @@ inherit ROUTED_APPLICATION_HELPER - DEFAULT_WGI_APPLICATION + DEFAULT_APPLICATION create make @@ -82,9 +82,9 @@ feature {NONE} -- Initialization feature -- Execution - execute_default (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + execute_default (req: WSF_REQUEST; res: WSF_RESPONSE) local - h: EWF_HEADER + h: WSF_HEADER l_url: STRING e: EXECUTION_ENVIRONMENT n: INTEGER @@ -133,7 +133,7 @@ feature -- Execution write_chunk (Void, res) end - write_chunk (s: detachable READABLE_STRING_8; res: WGI_RESPONSE_BUFFER) + write_chunk (s: detachable READABLE_STRING_8; res: WSF_RESPONSE) do if s /= Void then res.write_string (s.count.to_hex_string + {HTTP_CONSTANTS}.crlf) @@ -144,7 +144,7 @@ feature -- Execution res.flush end - execute_home (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + execute_home (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) local l_body: STRING_8 do @@ -168,10 +168,10 @@ feature -- Execution res.write_string (l_body) end - execute_hello (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; a_name: detachable READABLE_STRING_32; ctx: REQUEST_HANDLER_CONTEXT) + execute_hello (req: WSF_REQUEST; res: WSF_RESPONSE; a_name: detachable READABLE_STRING_32; ctx: REQUEST_HANDLER_CONTEXT) local l_response_content_type: detachable STRING - h: EWF_HEADER + h: WSF_HEADER content_type_supported: ARRAY [STRING] l_body: STRING_8 do @@ -207,33 +207,33 @@ feature -- Execution end end - handle_hello (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + handle_hello (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) do execute_hello (req, res, Void, ctx) end - handle_anonymous_hello (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + handle_anonymous_hello (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) do execute_hello (req, res, ctx.string_parameter ("name"), ctx) end - handle_method_any (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + handle_method_any (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) do execute_hello (req, res, req.request_method, ctx) end - handle_method_get (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + handle_method_get (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) do execute_hello (req, res, "GET", ctx) end - handle_method_post (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + handle_method_post (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) do execute_hello (req, res, "POST", ctx) end - handle_method_get_or_post (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + handle_method_get_or_post (ctx: REQUEST_URI_TEMPLATE_HANDLER_CONTEXT; req: WSF_REQUEST; res: WSF_RESPONSE) do execute_hello (req, res, "GET or POST", ctx) end diff --git a/examples/restbucks/restbucks-safe.ecf b/examples/restbucks/restbucks-safe.ecf index 4651633a..2e6df429 100644 --- a/examples/restbucks/restbucks-safe.ecf +++ b/examples/restbucks/restbucks-safe.ecf @@ -13,9 +13,9 @@ - + - + diff --git a/examples/restbucks/src/resource/order_handler.e b/examples/restbucks/src/resource/order_handler.e index 75f0fe5d..1a2cebbd 100644 --- a/examples/restbucks/src/resource/order_handler.e +++ b/examples/restbucks/src/resource/order_handler.e @@ -22,7 +22,7 @@ inherit feature -- execute - execute (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + execute (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) -- Execute request handler do execute_methods (ctx, req, res) @@ -34,7 +34,7 @@ feature -- API DOC feature -- HTTP Methods - do_get (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + do_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) -- Using GET to retrieve resource information. -- If the GET request is SUCCESS, we response with -- 200 OK, and a representation of the order @@ -53,9 +53,9 @@ feature -- HTTP Methods end end - compute_response_get (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; l_order : ORDER) + compute_response_get (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER) local - h: EWF_HEADER + h: WSF_HEADER l_msg : STRING do create h.make @@ -73,12 +73,12 @@ feature -- HTTP Methods end end - do_put (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + do_put (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) local l_post: STRING l_location : STRING l_order : detachable ORDER - h : EWF_HEADER + h : WSF_HEADER do fixme ("TODO handle an Internal Server Error") fixme ("Refactor the code, create new abstractions") @@ -111,10 +111,10 @@ feature -- HTTP Methods end end - do_delete (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + do_delete (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) local id: STRING - h : EWF_HEADER + h : WSF_HEADER do fixme ("TODO handle an Internal Server Error") fixme ("Refactor the code, create new abstractions") @@ -136,7 +136,7 @@ feature -- HTTP Methods end end - do_post (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + do_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE) -- Here the convention is the following. -- POST is used for creation and the server determines the URI -- of the created resource. @@ -158,9 +158,9 @@ feature -- HTTP Methods end end - compute_response_post (ctx: C; req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER; l_order : ORDER) + compute_response_post (ctx: C; req: WSF_REQUEST; res: WSF_RESPONSE; l_order : ORDER) local - h: EWF_HEADER + h: WSF_HEADER l_msg : STRING l_location : STRING joc : JSON_ORDER_CONVERTER diff --git a/examples/restbucks/src/restbucks_server.e b/examples/restbucks/src/restbucks_server.e index 5b01a28c..b58986a7 100644 --- a/examples/restbucks/src/restbucks_server.e +++ b/examples/restbucks/src/restbucks_server.e @@ -14,7 +14,7 @@ inherit ROUTED_APPLICATION_HELPER - DEFAULT_WGI_APPLICATION + DEFAULT_APPLICATION create make @@ -43,12 +43,12 @@ feature {NONE} -- Initialization feature -- Execution - execute_default (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + execute_default (req: WSF_REQUEST; res: WSF_RESPONSE) -- I'm using this method to handle the method not allowed response -- in the case that the given uri does not have a corresponding http method -- to handle it. local - h : EWF_HEADER + h : WSF_HEADER l_description : STRING l_api_doc : STRING do diff --git a/ext/server/nino b/ext/server/nino index 4cd1b676..7fd4cdbe 160000 --- a/ext/server/nino +++ b/ext/server/nino @@ -1 +1 @@ -Subproject commit 4cd1b676070b98be7f577bdf810719491b09d09b +Subproject commit 7fd4cdbe4462a3fade81b9d029045ef2e7584b64 diff --git a/library/server/ewsgi/connectors/cgi/cgi-safe.ecf b/library/server/ewsgi/connectors/cgi/cgi-safe.ecf index 512dd955..6ddc9af7 100644 --- a/library/server/ewsgi/connectors/cgi/cgi-safe.ecf +++ b/library/server/ewsgi/connectors/cgi/cgi-safe.ecf @@ -10,6 +10,7 @@ + diff --git a/library/server/ewsgi/connectors/cgi/cgi.ecf b/library/server/ewsgi/connectors/cgi/cgi.ecf index d6c265ec..0e8b4361 100644 --- a/library/server/ewsgi/connectors/cgi/cgi.ecf +++ b/library/server/ewsgi/connectors/cgi/cgi.ecf @@ -10,6 +10,7 @@ + diff --git a/library/server/ewsgi/connectors/cgi/src/ewf_cgi_connector.e b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e similarity index 85% rename from library/server/ewsgi/connectors/cgi/src/ewf_cgi_connector.e rename to library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e index c87daa75..5b30cc66 100644 --- a/library/server/ewsgi/connectors/cgi/src/ewf_cgi_connector.e +++ b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_connector.e @@ -1,11 +1,11 @@ note - description: "Summary description for {EWF_CGI_CONNECTOR}." + description: "Summary description for {WGI_CGI_CONNECTOR}." author: "" date: "$Date$" revision: "$Revision$" class - EWF_CGI_CONNECTOR + WGI_CGI_CONNECTOR inherit WGI_CONNECTOR @@ -22,8 +22,8 @@ feature -- Execution rescued: BOOLEAN do if not rescued then - create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {EWF_CGI_INPUT_STREAM}.make) - create res.make (create {EWF_CGI_OUTPUT_STREAM}.make) + create req.make ((create {EXECUTION_ENVIRONMENT}).starting_environment_variables, create {WGI_CGI_INPUT_STREAM}.make) + create res.make (create {WGI_CGI_OUTPUT_STREAM}.make) application.execute (req, res) else if attached (create {EXCEPTION_MANAGER}).last_exception as e and then attached e.exception_trace as l_trace then diff --git a/library/server/ewsgi/connectors/cgi/src/ewf_cgi_input_stream.e b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_input_stream.e similarity index 88% rename from library/server/ewsgi/connectors/cgi/src/ewf_cgi_input_stream.e rename to library/server/ewsgi/connectors/cgi/src/wgi_cgi_input_stream.e index 7d09236b..5659f599 100644 --- a/library/server/ewsgi/connectors/cgi/src/ewf_cgi_input_stream.e +++ b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_input_stream.e @@ -1,12 +1,12 @@ note - description: "Summary description for EWF_CGI_INPUT_STREAM." + description: "Summary description for WGI_CGI_INPUT_STREAM." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class - EWF_CGI_INPUT_STREAM + WGI_CGI_INPUT_STREAM inherit WGI_INPUT_STREAM diff --git a/library/server/ewsgi/connectors/cgi/src/ewf_cgi_output_stream.e b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_output_stream.e similarity index 93% rename from library/server/ewsgi/connectors/cgi/src/ewf_cgi_output_stream.e rename to library/server/ewsgi/connectors/cgi/src/wgi_cgi_output_stream.e index f586a548..1a714b21 100644 --- a/library/server/ewsgi/connectors/cgi/src/ewf_cgi_output_stream.e +++ b/library/server/ewsgi/connectors/cgi/src/wgi_cgi_output_stream.e @@ -1,12 +1,12 @@ note - description: "Summary description for EWF_CGI_OUTPUT_STREAM." + description: "Summary description for WGI_CGI_OUTPUT_STREAM." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class - EWF_CGI_OUTPUT_STREAM + WGI_CGI_OUTPUT_STREAM inherit WGI_OUTPUT_STREAM diff --git a/library/server/ewsgi/src/connector/wgi_connector.e b/library/server/ewsgi/connectors/common/wgi_connector.e similarity index 100% rename from library/server/ewsgi/src/connector/wgi_connector.e rename to library/server/ewsgi/connectors/common/wgi_connector.e diff --git a/library/server/ewsgi/connectors/connector-safe.ecf b/library/server/ewsgi/connectors/connector-safe.ecf new file mode 100644 index 00000000..1361b1c6 --- /dev/null +++ b/library/server/ewsgi/connectors/connector-safe.ecf @@ -0,0 +1,16 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + diff --git a/library/server/ewsgi/connectors/connector.ecf b/library/server/ewsgi/connectors/connector.ecf new file mode 100644 index 00000000..0a591f8f --- /dev/null +++ b/library/server/ewsgi/connectors/connector.ecf @@ -0,0 +1,16 @@ + + + + + + /.git$ + /EIFGENs$ + /.svn$ + + + + + + + diff --git a/library/server/ewsgi/connectors/libfcgi/libfcgi-safe.ecf b/library/server/ewsgi/connectors/libfcgi/libfcgi-safe.ecf index 875f24c0..fbc3d0ac 100644 --- a/library/server/ewsgi/connectors/libfcgi/libfcgi-safe.ecf +++ b/library/server/ewsgi/connectors/libfcgi/libfcgi-safe.ecf @@ -10,6 +10,7 @@ + diff --git a/library/server/ewsgi/connectors/libfcgi/libfcgi.ecf b/library/server/ewsgi/connectors/libfcgi/libfcgi.ecf index bf084003..5240dad5 100644 --- a/library/server/ewsgi/connectors/libfcgi/libfcgi.ecf +++ b/library/server/ewsgi/connectors/libfcgi/libfcgi.ecf @@ -10,6 +10,7 @@ + diff --git a/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_connector.e b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e similarity index 90% rename from library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_connector.e rename to library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e index 48310630..49838b2a 100644 --- a/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_connector.e +++ b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_connector.e @@ -1,12 +1,12 @@ note - description: "Summary description for {EWF_LIBFCGI_CONNECTOR}." + description: "Summary description for {WGI_LIBFCGI_CONNECTOR}." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class - EWF_LIBFCGI_CONNECTOR + WGI_LIBFCGI_CONNECTOR inherit WGI_CONNECTOR @@ -22,8 +22,8 @@ feature {NONE} -- Initialization initialize do create fcgi.make - create {EWF_LIBFCGI_INPUT_STREAM} input.make (fcgi) - create {EWF_LIBFCGI_OUTPUT_STREAM} output.make (fcgi) + create {WGI_LIBFCGI_INPUT_STREAM} input.make (fcgi) + create {WGI_LIBFCGI_OUTPUT_STREAM} output.make (fcgi) end feature -- Server diff --git a/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_input_stream.e b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_input_stream.e similarity index 92% rename from library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_input_stream.e rename to library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_input_stream.e index 494ff28e..5fc258cf 100644 --- a/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_input_stream.e +++ b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_input_stream.e @@ -1,12 +1,12 @@ note - description: "Summary description for EWF_LIBFCGI_INPUT_STREAM." + description: "Summary description for WGI_LIBFCGI_INPUT_STREAM." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class - EWF_LIBFCGI_INPUT_STREAM + WGI_LIBFCGI_INPUT_STREAM inherit WGI_INPUT_STREAM diff --git a/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_output_stream.e b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_output_stream.e similarity index 94% rename from library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_output_stream.e rename to library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_output_stream.e index 9a5c5a7c..45c6c9b3 100644 --- a/library/server/ewsgi/connectors/libfcgi/src/ewf_libfcgi_output_stream.e +++ b/library/server/ewsgi/connectors/libfcgi/src/wgi_libfcgi_output_stream.e @@ -1,12 +1,12 @@ note - description: "Summary description for {EWF_LIBFCGI_OUTPUT_STREAM}." + description: "Summary description for {WGI_LIBFCGI_OUTPUT_STREAM}." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class - EWF_LIBFCGI_OUTPUT_STREAM + WGI_LIBFCGI_OUTPUT_STREAM inherit WGI_OUTPUT_STREAM diff --git a/library/server/ewsgi/connectors/nino/nino-safe.ecf b/library/server/ewsgi/connectors/nino/nino-safe.ecf index 746f7baf..17f34c9e 100644 --- a/library/server/ewsgi/connectors/nino/nino-safe.ecf +++ b/library/server/ewsgi/connectors/nino/nino-safe.ecf @@ -10,6 +10,7 @@ + diff --git a/library/server/ewsgi/connectors/nino/nino.ecf b/library/server/ewsgi/connectors/nino/nino.ecf index 68818796..375ae126 100644 --- a/library/server/ewsgi/connectors/nino/nino.ecf +++ b/library/server/ewsgi/connectors/nino/nino.ecf @@ -10,6 +10,7 @@ + diff --git a/library/server/ewsgi/default/nino/nino_application.e b/library/server/ewsgi/connectors/nino/src/nino_application.e similarity index 98% rename from library/server/ewsgi/default/nino/nino_application.e rename to library/server/ewsgi/connectors/nino/src/nino_application.e index 51d85966..d942dd1d 100644 --- a/library/server/ewsgi/default/nino/nino_application.e +++ b/library/server/ewsgi/connectors/nino/src/nino_application.e @@ -29,7 +29,7 @@ feature {NONE} -- Implementation create connector.make_with_base (app, a_base_url) end - connector: EWF_NINO_CONNECTOR + connector: WGI_NINO_CONNECTOR -- Web server connector feature -- Status settings diff --git a/library/server/ewsgi/connectors/nino/src/ewf_nino_connector.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e similarity index 89% rename from library/server/ewsgi/connectors/nino/src/ewf_nino_connector.e rename to library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e index 91c5d2ac..d7ca04fb 100644 --- a/library/server/ewsgi/connectors/nino/src/ewf_nino_connector.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_connector.e @@ -1,11 +1,11 @@ note - description: "Summary description for {EWF_NINO_CONNECTOR}." + description: "Summary description for {WGI_NINO_CONNECTOR}." author: "" date: "$Date$" revision: "$Revision$" class - EWF_NINO_CONNECTOR + WGI_NINO_CONNECTOR inherit WGI_CONNECTOR @@ -68,7 +68,7 @@ feature -- Server local l_http_handler : HTTP_HANDLER do - create {EWF_NINO_HANDLER} l_http_handler.make_with_callback (server, "NINO_HANDLER", Current) + create {WGI_NINO_HANDLER} l_http_handler.make_with_callback (server, "NINO_HANDLER", Current) debug ("nino") if attached base as l_base then print ("Base=" + l_base + "%N") @@ -84,8 +84,8 @@ feature -- Server rescued: BOOLEAN do if not rescued then - create req.make (env, create {EWF_NINO_INPUT_STREAM}.make (a_input)) - create res.make (create {EWF_NINO_OUTPUT_STREAM}.make (a_output)) + create req.make (env, create {WGI_NINO_INPUT_STREAM}.make (a_input)) + create res.make (create {WGI_NINO_OUTPUT_STREAM}.make (a_output)) req.set_meta_string_variable ("RAW_HEADER_DATA", a_headers_text) application.execute (req, res) else diff --git a/library/server/ewsgi/connectors/nino/src/ewf_nino_handler.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_handler.e similarity index 99% rename from library/server/ewsgi/connectors/nino/src/ewf_nino_handler.e rename to library/server/ewsgi/connectors/nino/src/wgi_nino_handler.e index d6ac6d0d..2f0de156 100644 --- a/library/server/ewsgi/connectors/nino/src/ewf_nino_handler.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_handler.e @@ -5,7 +5,7 @@ note revision : "$Revision$" class - EWF_NINO_HANDLER + WGI_NINO_HANDLER inherit HTTP_CONNECTION_HANDLER @@ -23,7 +23,7 @@ feature {NONE} -- Initialization callback := a_callback end - callback: EWF_NINO_CONNECTOR + callback: WGI_NINO_CONNECTOR feature -- Access diff --git a/library/server/ewsgi/connectors/nino/src/ewf_nino_input_stream.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_input_stream.e similarity index 88% rename from library/server/ewsgi/connectors/nino/src/ewf_nino_input_stream.e rename to library/server/ewsgi/connectors/nino/src/wgi_nino_input_stream.e index 9cc0d4ec..95fb8cbd 100644 --- a/library/server/ewsgi/connectors/nino/src/ewf_nino_input_stream.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_input_stream.e @@ -1,12 +1,12 @@ note - description: "Summary description for {EWF_NINO_INPUT_STREAM}." + description: "Summary description for {WGI_NINO_INPUT_STREAM}." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class - EWF_NINO_INPUT_STREAM + WGI_NINO_INPUT_STREAM inherit WGI_INPUT_STREAM @@ -22,7 +22,7 @@ feature {NONE} -- Initialization set_nino_input (a_nino_input) end -feature {EWF_NINO_CONNECTOR, WGI_APPLICATION} -- Nino +feature {WGI_NINO_CONNECTOR, WGI_APPLICATION} -- Nino set_nino_input (i: like nino_input) do diff --git a/library/server/ewsgi/connectors/nino/src/ewf_nino_output_stream.e b/library/server/ewsgi/connectors/nino/src/wgi_nino_output_stream.e similarity index 91% rename from library/server/ewsgi/connectors/nino/src/ewf_nino_output_stream.e rename to library/server/ewsgi/connectors/nino/src/wgi_nino_output_stream.e index b3b9488d..fd13d180 100644 --- a/library/server/ewsgi/connectors/nino/src/ewf_nino_output_stream.e +++ b/library/server/ewsgi/connectors/nino/src/wgi_nino_output_stream.e @@ -1,12 +1,12 @@ note - description: "Summary description for {EWF_NINO_OUTPUT_STREAM}." + description: "Summary description for {WGI_NINO_OUTPUT_STREAM}." legal: "See notice at end of class." status: "See notice at end of class." date: "$Date$" revision: "$Revision$" class - EWF_NINO_OUTPUT_STREAM + WGI_NINO_OUTPUT_STREAM inherit WGI_OUTPUT_STREAM @@ -26,7 +26,7 @@ feature {NONE} -- Initialization set_nino_output (a_nino_output) end -feature {EWF_NINO_CONNECTOR, WGI_APPLICATION} -- Nino +feature {WGI_NINO_CONNECTOR, WGI_APPLICATION} -- Nino set_nino_output (o: like nino_output) do diff --git a/library/server/ewsgi/default.7z b/library/server/ewsgi/default.7z new file mode 100644 index 0000000000000000000000000000000000000000..74ae79123ed70781dfd65b8311d50e22ffd54d5e GIT binary patch literal 2082 zcmV+-2;KKLdc3bE8~_8jiNgcm2LJ#70000Z000000001ay=N2vHyg_C;rfEEvN^;S ziUpz}JU&diDr?!6zahT1^d{gf13C#4DQ9IfQXj6~ej;+;8{(m-6TsrQsT5mu-*=bf zeu~T?XGT~g_j~+X@MW$c#?iu!dHWWtfbijxOlmiZrJL!F4_DJ$y9{$-mFPJAj+HM| zqx3Yk27^sYxjXhj9kWXoYvduK6gP-waOwkIh{2+Huy3BAzJ(4_g70*&JxNQ1K-PRI zNFdX}o!@fWrfPf1bDx#8%(=T+(3F@szba70pF z<*Wd|X`yc9<}fUaB-r*nz$HRAY?h*}mJ&WhsbRvK06wcvtdVyb7uY{Q`V_hS#c2Cy zPUPrIDc()fadV3;>mBmSFn+p1gp@yjJ%`dg6A4jVNQb4@Ew@7hs9L=Tb|>V_mNx^c zX&IBo2hn%ShD=>-A}JP<1WZR#!VBJ3%g!^bZIf?o^sk-Mf{0ae1=BNdFzj`*Of(sG zn|4ytF&3i@J>MxjlObE@age=;e__`2dZa@djtBpbQE!0IDyZkShYbCOnwK_Z2s0kg zK$H`$>}%TtR8OaisRexzg}j0dZ7{^>_N=CP+)B6FpGX8}o=8sU^5w+gA@ag2+g#Hr zl~L!9@^;`z3}^dFNoUyvlp89U`rvzOG)^ji|9S+g0J8I02DhJ$rLB@6qDWU#p{8im z8~mw05Ql}i*N;c%y3cXYe`?@CP}~2`x=;;Px~j=z{hkuL?=+twta5hyE$=N6gbS?T zjVTfib^+Spb-YbG)(XxKlZetaY3X37x0+DJ?E>J@AGpND8b6+>mkj&5b}mGY3oIfs zhu#Npm8<-gJiJZB5HB4>xB3>ksIlv8&7Uo_V|xLJ!tHdm!&bpq8E^Y~3 zNkhODk^P+D;BbWCC zIO@mwvai-1UPTcpun4QifuQ?*i9>@>ZwU16_1XhsL==b16ddJD;6}+uqOLD>N>F@A zab^U#O)vq4Cpf>deK6DqnWKF<$MmE5Otz`t*a8e$Hs>v5D=GU=?Mb6}bzxgz2<($s zZmNWEVsu0pip?e2qrOT7sXoRuI4D>kSx~ZYE5Pw|Ec;ZD7MnZ9&+n>3WXT9JOj4JL z#zXPvH<6ao3t|hwvG|8fBK4Wt^G55q8fEZ+QLLMTN<81b6Q=FJ1YHFz0c|m5!Ol1Y z-jD2?^h#k7gF6in0&59Zk&DLeoDQ(YaCQIcxA`SQF;ybDYxTw1mDl}C9D>=XDyVQK8y8jqiu(TU8| z_og4#EFH((%3f^$N&Sfjzv#GUx?PuO{(f_tVUvW3u`_~=j{i1~UyIE3#&JE?a8|yh z+c^B80z`IJyXfWzN!z@R*MLW=igle!L3rwMrlKL>WCGl^BbsVNyYe~)B$)$=WoMHL*styTt#lLqS z(4ZzWh<^k0xNTtXt}FTD=4smWxcIaBZ&waZb!VY?R;7EI%24a?z^5MJOetc7Durnt zu9i~#X3iyUmbCBzoa<9SI{|5U(eF=OWt$`VIu>KXX%IOknn7~9(;)l%1d%W~=;3JM z$%#9efTGKSlnMtem>4`+KE;GgSQYZTp?7q!0y1p>Q#L;(6Qm6bK_%Zv^>ca`!jk-NUXv~%QFVtUvx!xL0_ks za)#OM+vkQiacTen0D&_Ht`F67S(Fzf)Bdx5FNu=AzC8-Dkh?XU8;>S2qxDG3cC&rU@b_EP!LwjX=aSaF$9T)Cp2cOS z@&Ah-L4g6vlBp}b_N6um601e&zKL7v# literal 0 HcmV?d00001 diff --git a/library/server/ewsgi/examples/hello_world/hello-safe.ecf b/library/server/ewsgi/examples/hello_world/hello-safe.ecf index aabd666f..76cdb452 100644 --- a/library/server/ewsgi/examples/hello_world/hello-safe.ecf +++ b/library/server/ewsgi/examples/hello_world/hello-safe.ecf @@ -11,7 +11,6 @@ - diff --git a/library/server/ewsgi/examples/hello_world/hello.ecf b/library/server/ewsgi/examples/hello_world/hello.ecf index 2eea409b..9d081303 100644 --- a/library/server/ewsgi/examples/hello_world/hello.ecf +++ b/library/server/ewsgi/examples/hello_world/hello.ecf @@ -11,7 +11,6 @@ - diff --git a/library/server/ewsgi/examples/hello_world_with_response/hello-safe.ecf b/library/server/ewsgi/examples/hello_world_with_response/hello-safe.ecf deleted file mode 100644 index f388706e..00000000 --- a/library/server/ewsgi/examples/hello_world_with_response/hello-safe.ecf +++ /dev/null @@ -1,28 +0,0 @@ - - - - - /EIFGENs$ - /\.git$ - /\.svn$ - - - - - - - - - - - - - - - - - - - diff --git a/library/server/ewsgi/examples/hello_world_with_response/license.lic b/library/server/ewsgi/examples/hello_world_with_response/license.lic deleted file mode 100644 index cf2d1ed9..00000000 --- a/library/server/ewsgi/examples/hello_world_with_response/license.lic +++ /dev/null @@ -1,10 +0,0 @@ -${NOTE_KEYWORD} - copyright: "2011-${YEAR}, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" diff --git a/library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e b/library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e deleted file mode 100644 index 910a9f5d..00000000 --- a/library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e +++ /dev/null @@ -1,48 +0,0 @@ -note - description : "Objects that ..." - author : "$Author$" - date : "$Date$" - revision : "$Revision$" - -class - HELLO_WORLD - -inherit - WGI_RESPONSE_APPLICATION - - DEFAULT_WGI_APPLICATION - -create - make_and_launch - -feature -- Response - - response (request: WGI_REQUEST): WGI_RESPONSE - do - if request.path_info.starts_with ("/streaming/") then - Result := streaming_response (request) - else - create Result.make - Result.set_status (200) - Result.set_header ("Content-Type", "text/html; charset=utf-8") - Result.set_message_body ("Hello World") - end - end - - streaming_response (request: WGI_REQUEST): WGI_RESPONSE - do - create {HELLO_WORLD_RESPONSE} Result.make - Result.set_status (200) - Result.set_header ("Content-Type", "text/html; charset=utf-8") - end -note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/examples/hello_world_with_response/src/hello_world_response.e b/library/server/ewsgi/examples/hello_world_with_response/src/hello_world_response.e deleted file mode 100644 index 09fde7f2..00000000 --- a/library/server/ewsgi/examples/hello_world_with_response/src/hello_world_response.e +++ /dev/null @@ -1,70 +0,0 @@ -note - description: "A streaming (non-buffered) Hello World example." - author: "Paul Cohen " - status: "Draft" - -class HELLO_WORLD_RESPONSE - -inherit - WGI_RESPONSE - redefine - make, - read_block - end - -create - make - -feature {NONE} -- Initialization - - make - do - precursor - set_ready_to_transmit - current_hello := 0 - end - -feature {NONE} -- Entity body - - read_block - -- Reads a block of 100000 lines of "Hello World". - local - i: INTEGER - do - if current_hello >= 10000 then - end_of_blocks := True - else - if current_hello = 0 then - current_block := "%N" - current_block.append ("Welcome
In progress
") - end - from - i := 0 - until - i = 1000 - loop - current_block.append ("Hello World ("+ current_hello.out +","+ i.out +")
%N") - i := i + 1 - end - current_hello := current_hello + i - current_block.append ("
In progress - "+ (100 * current_hello // 10000).out +"%%
") - if current_hello = 10000 then - current_block.append ("Bye bye..
Completed - GO TO BOTTOM
") - end_of_blocks := True - end - end - end - - current_hello: INTEGER - -;note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/specification/connector/wgi_connector.e b/library/server/ewsgi/specification/connector/wgi_connector.e deleted file mode 100644 index cfd400d3..00000000 --- a/library/server/ewsgi/specification/connector/wgi_connector.e +++ /dev/null @@ -1,44 +0,0 @@ -note - description: "Summary description for {WGI_CONNECTOR}." - author: "" - date: "$Date$" - revision: "$Revision$" - -deferred class - WGI_CONNECTOR - -feature {NONE} -- Initialization - - make (a_app: like application) - do - application := a_app - initialize - end - - initialize - -- Initialize connector - do - end - -feature {NONE} -- Access - - application: WGI_APPLICATION - -- Gateway Application - -feature -- Server - - launch - deferred - end - -note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/specification/request/obsolete/wgi_cookie.e b/library/server/ewsgi/specification/request/obsolete/wgi_cookie.e deleted file mode 100644 index d76edbbc..00000000 --- a/library/server/ewsgi/specification/request/obsolete/wgi_cookie.e +++ /dev/null @@ -1,76 +0,0 @@ -note - description: "[ - Contains all information of a rfc2109 cookie that was read from the request header - ]" - legal: "See notice at end of class." - status: "See notice at end of class." - date: "$Date$" - revision: "$Revision$" - -class - WGI_COOKIE - -create - make - -convert - value: {READABLE_STRING_8, STRING_8, READABLE_STRING_GENERAL, STRING_GENERAL} - -feature {NONE} -- Initialization - - make (a_name: STRING; a_value: STRING) - -- Creates current. - require - a_name_not_empty: a_name /= Void and then not a_name.is_empty - a_value_not_empty: a_value /= Void and then not a_value.is_empty - do - name := a_name - value := a_value - ensure - a_name_set: name = a_name - a_value_set: value = a_value - end - -feature -- Access - - name: STRING - -- Required. The name of the state information ("cookie") is NAME, - -- and its value is VALUE. NAMEs that begin with $ are reserved for - -- other uses and must not be used by applications. - - value: STRING - -- The VALUE is opaque to the user agent and may be anything the - -- origin server chooses to send, possibly in a server-selected - -- printable ASCII encoding. "Opaque" implies that the content is of - -- interest and relevance only to the origin server. The content - -- may, in fact, be readable by anyone that examines the Set-Cookie - -- header. - -feature -- Query - - variables: detachable HASH_TABLE [STRING, STRING] - -- Potential variable contained in the encoded cookie's value. - -feature -- Status report - - value_is_string (s: READABLE_STRING_GENERAL): BOOLEAN - -- Is `value' same string as `s' - do - Result := s.same_string (value) - end - -invariant - name_attached: name /= Void - value_attached: value /= Void - -note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/specification/request/obsolete/wgi_variables.e b/library/server/ewsgi/specification/request/obsolete/wgi_variables.e deleted file mode 100644 index f3da8079..00000000 --- a/library/server/ewsgi/specification/request/obsolete/wgi_variables.e +++ /dev/null @@ -1,80 +0,0 @@ -note - description : "[ - Interface to access the variable stored in a container - ]" - legal: "See notice at end of class." - status: "See notice at end of class." - date: "$Date$" - revision: "$Revision$" - -deferred class - WGI_VARIABLES [G -> STRING_GENERAL] - -inherit - ITERABLE [G] - -feature -- Status report - - has_variable (a_name: STRING): BOOLEAN - -- Has variable associated with `a_name' - require - a_name_not_empty: a_name /= Void and then not a_name.is_empty - deferred - end - -feature -- Access - - variable (a_name: STRING): detachable G - -- Value for variable associated with `a_name' - -- If not found, return Void - require - a_name_not_empty: a_name /= Void and then not a_name.is_empty - deferred - end - - variable_or_default (a_name: STRING; a_default: G; use_default_when_empty: BOOLEAN): G - -- Value for variable `a_name' - -- If not found, return `a_default' - require - a_name_not_empty: a_name /= Void and then not a_name.is_empty - do - if attached variable (a_name) as s then - if use_default_when_empty and then s.is_empty then - Result := a_default - else - Result := s - end - else - Result := a_default - end - end - -feature {WGI_REQUEST, WGI_APPLICATION, WGI_CONNECTOR} -- Element change - - set_variable (a_name: STRING; a_value: G) - require - a_name_not_empty: a_name /= Void and then not a_name.is_empty - deferred - ensure - variable_set: has_variable (a_name) and then variable (a_name) ~ a_value - end - - unset_variable (a_name: STRING) - require - a_name_not_empty: a_name /= Void and then not a_name.is_empty - deferred - ensure - variable_unset: not has_variable (a_name) - end - -note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/src/extra/ewf_buffered_response.e b/library/server/ewsgi/src/extra/ewf_buffered_response.e deleted file mode 100644 index 123dd75a..00000000 --- a/library/server/ewsgi/src/extra/ewf_buffered_response.e +++ /dev/null @@ -1,186 +0,0 @@ -note - description: "Summary description for {EWF_BUFFERED_RESPONSE}." - author: "" - date: "$Date$" - revision: "$Revision$" - -class - EWF_BUFFERED_RESPONSE - -inherit - WGI_RESPONSE_BUFFER - -create {WGI_APPLICATION} - make - -feature {NONE} -- Initialization - - make (a_res: like response_buffer; a_buffer_size: INTEGER) - do - response_buffer := a_res - buffer_capacity := a_buffer_size - create buffer.make (a_buffer_size) - end - - response_buffer: WGI_RESPONSE_BUFFER - - buffer: STRING_8 - - buffer_capacity: INTEGER - - buffer_count: INTEGER - -feature {NONE} -- Core output operation - - write (s: STRING) - -- Send the content of `s' - local - buf: like buffer - len_b, len_s: INTEGER - do - buf := buffer - len_s := s.count - len_b := buffer_count - if len_b + len_s >= buffer_capacity then - flush_buffer - if len_s >= buffer_capacity then - -- replace buffer by `s' - buffer := s - buffer_count := len_s - flush_buffer - -- restore buffer with `buf' - buffer := buf - else - buf.append (s) - buffer_count := len_s - end - else - buf.append (s) - buffer_count := len_b + len_s - end - end - -feature -- Output operation - - flush - do - flush_buffer - end - -feature {NONE} -- Implementation - - flush_buffer - require - buffer_count_match_buffer: buffer_count = buffer.count - do - response_buffer.write (buffer) - buffer_count := 0 - ensure - buffer_flushed: buffer_count = 0 and buffer.count = 0 - end - -feature {WGI_APPLICATION} -- Commit - - commit - do - flush_buffer - end - -feature -- Status report - - header_committed: BOOLEAN - -- Header committed? - - message_committed: BOOLEAN - -- Message committed? - - message_writable: BOOLEAN - -- Can message be written? - do - Result := status_is_set and header_committed - end - -feature -- Status setting - - status_is_set: BOOLEAN - -- Is status set? - do - Result := status_code /= 0 - end - - set_status_code (a_code: INTEGER) - -- Set response status code - -- Should be done before sending any data back to the client - do - status_code := a_code - response_buffer.set_status_code (a_code) - end - - status_code: INTEGER - -- Response status - -feature -- Header output operation - - write_headers_string (a_headers: STRING) - do - write (a_headers) - header_committed := True - end - - write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]]) - -- Send headers with status `a_status', and headers from `a_headers' - local - h: EWF_HEADER - i,n: INTEGER - do - set_status_code (a_status_code) - create h.make - h.put_status (a_status_code) - if a_headers /= Void then - from - i := a_headers.lower - n := a_headers.upper - until - i > n - loop - h.put_header_key_value (a_headers[i].key, a_headers[i].value) - i := i + 1 - end - end - write_headers_string (h.string) - end - -feature -- Output operation - - write_string (s: STRING) - -- Send the string `s' - do - write (s) - end - - write_substring (s: STRING; start_index, end_index: INTEGER) - -- Send the substring `start_index:end_index]' - --| Could be optimized according to the target output - do - flush_buffer - response_buffer.write_substring (s, start_index, end_index) - end - - write_file_content (fn: STRING) - -- Send the content of file `fn' - do - flush_buffer - response_buffer.write_file_content (fn) - end - -;note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/src/extra/in_memory/ewf_in_memory_response.e b/library/server/ewsgi/src/extra/in_memory/ewf_in_memory_response.e deleted file mode 100644 index d6688b0b..00000000 --- a/library/server/ewsgi/src/extra/in_memory/ewf_in_memory_response.e +++ /dev/null @@ -1,151 +0,0 @@ -note - description: "Summary description for {EWF_IN_MEMORY_RESPONSE}." - date: "$Date$" - revision: "$Revision$" - -class - EWF_IN_MEMORY_RESPONSE - -inherit - WGI_RESPONSE_BUFFER - -create {WGI_APPLICATION} - make - -feature {NONE} -- Initialization - - make (res: WGI_RESPONSE_BUFFER) - do - response_buffer := res - create header.make - create body.make (100) - end - - response_buffer: WGI_RESPONSE_BUFFER - - header: EWF_HEADER - - body: STRING_8 - -feature {WGI_APPLICATION} -- Commit - - commit - local - r: like response_buffer - do - r := response_buffer - r.set_status_code (status_code) - r.write_headers_string (header.string) - header_committed := True - r.write_string (body) - r.flush - end - -feature -- Status report - - header_committed: BOOLEAN - -- Header committed? - - message_committed: BOOLEAN - -- Message committed? - - message_writable: BOOLEAN - -- Can message be written? - do - Result := status_is_set and header_committed - end - - -feature -- Status setting - - status_is_set: BOOLEAN - -- Is status set? - do - Result := status_code /= 0 - end - - set_status_code (a_code: INTEGER) - -- Set response status code - -- Should be done before sending any data back to the client - do - status_code := a_code - end - - status_code: INTEGER - -- Response status - -feature {NONE} -- Status output - - write (s: STRING) - -- Send the content of `s' - do - body.append (s) - end - -feature -- Header output operation - - write_headers_string (a_headers: STRING) - do - write (a_headers) - header_committed := True - end - - write_header (a_status_code: INTEGER; a_headers: detachable ARRAY [TUPLE [key: STRING; value: STRING]]) - -- Send headers with status `a_status', and headers from `a_headers' - local - h: EWF_HEADER - i,n: INTEGER - do - set_status_code (a_status_code) - create h.make - if a_headers /= Void then - from - i := a_headers.lower - n := a_headers.upper - until - i > n - loop - h.put_header_key_value (a_headers[i].key, a_headers[i].value) - i := i + 1 - end - end - header := h - end - -feature -- Output operation - - write_string (s: STRING) - -- Send the string `s' - do - write (s) - end - - write_substring (s: STRING; start_index, end_index: INTEGER) - -- Send the substring `start_index:end_index]' - --| Could be optimized according to the target output - do - write_string (s.substring (start_index, end_index)) - end - - write_file_content (fn: STRING) - -- Send the content of file `fn' - do - response_buffer.write_file_content (fn) - end - - flush - do - --| Do nothing ... this is in_memory response - end - -;note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/src/extra/in_memory/ewf_in_memory_response_application.e b/library/server/ewsgi/src/extra/in_memory/ewf_in_memory_response_application.e deleted file mode 100644 index c1528e0c..00000000 --- a/library/server/ewsgi/src/extra/in_memory/ewf_in_memory_response_application.e +++ /dev/null @@ -1,59 +0,0 @@ -note - description: "Summary description for {EWF_IN_MEMORY_RESPONSE_APPLICATION}." - author: "" - date: "$Date$" - revision: "$Revision$" - -deferred class - EWF_IN_MEMORY_RESPONSE_APPLICATION - -inherit - WGI_APPLICATION - rename - execute as app_execute - end - - -feature -- Execution - - app_execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) - -- Execute the request - -- See `req.input' for input stream - -- `req.environment' for the Gateway environment - -- and `res' for output buffer - do - execute (req, new_response (req, res)) - end - -feature -- Execute - - execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) - -- Execute the request - -- See `req.input' for input stream - -- `req.environment' for the Gateway environment - -- and `res' for output buffer - require - res_status_unset: not res.status_is_set - deferred - ensure - res_status_set: res.status_is_set - end - -feature {NONE} -- Implementation - - new_response (req: WGI_REQUEST; a_res: WGI_RESPONSE_BUFFER): EWF_IN_MEMORY_RESPONSE - do - create {EWF_IN_MEMORY_RESPONSE} Result.make (a_res) - end - -note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/src/extra/response_as_result/wgi_response.e b/library/server/ewsgi/src/extra/response_as_result/wgi_response.e deleted file mode 100644 index 62cce845..00000000 --- a/library/server/ewsgi/src/extra/response_as_result/wgi_response.e +++ /dev/null @@ -1,226 +0,0 @@ -note - description: "[ - An EWSGI response. This may be used as is or specialized (subclassed) - if a developer wishes to reimplement their own version of the feature - 'read_message_body_block' for supporting a block-based message body - response. - ]" - author: "Paul Cohen " - status: "Draft" - -class WGI_RESPONSE - -create - make - -feature {NONE} -- Initialization - - make - -- Create new response object - do - is_buffered := False - ready_to_transmit := False - end_of_blocks := False - max_block_size := default_max_block_size - current_block := "" - create headers_table.make (10) - end - -feature {WGI_RESPONSE_APPLICATION} -- Response status - - transmit_to (res: WGI_RESPONSE_BUFFER) - do - res.set_status_code (status) - res.write_headers_string (headers) - from - read_block - res.write_string (last_block) --- res.flush - until - end_of_blocks - loop - read_block - res.write_string (last_block) --- res.flush - end - end - - ready_to_transmit: BOOLEAN - -- Is this response ready to be transmitted? - - set_ready_to_transmit - -- Set response to ready to transmit. - do - if is_buffered then - set_header ("Content-Length", current_block.count.out) --- elseif tmp_file /= Void then --- if tmp_file.is_open_write then --- tmp_file.close --- set_header ("Content-Length", tmp_file.count.out) --- end - end - ready_to_transmit := True - ensure - ready_to_transmit - end - -feature {WGI_RESPONSE_APPLICATION} -- Message start line and status - - status: INTEGER - -- HTTP status code - - set_status (s: INTEGER) - -- Set 'status_code'. - do - status := s - set_header ("Status", s.out) - ensure - status = s - end - - start_line: STRING - -- HTTP message start-line - do - if attached status as st then - Result := "HTTP/1.1 " + st.out + " " + status_text (st) + crlf - else - Result := "HTTP/1.1 200 " + status_text (200) + crlf - end - end - -feature {WGI_RESPONSE_APPLICATION} -- Message headers - - headers: STRING - -- HTTP message headers including trailing empty line. - local - t: HASH_TABLE [STRING, STRING] - do - Result := "" - t := headers_table - from - t.start - until - t.after - loop - Result.append (t.key_for_iteration + ": " + t.item_for_iteration + crlf) - t.forth - end - Result.append (crlf) - end - - headers_table: HASH_TABLE [STRING, STRING] - -- Hash table of HTTP headers - - set_header (key, value: STRING) - -- Set the HTTP header with the given 'key' to the given 'value'. - do - headers_table.put (value, key) - ensure - headers_table.has (key) and headers_table @ key = value - end - -feature {WGI_RESPONSE_APPLICATION} -- Message body - - read_block - -- Read a message body block. - do - if is_buffered then - end_of_blocks := True --- else --- -- File based block-based output --- -- TBD! - end - ensure ---Commented, since it is far from obvious to ensure that: --- not is_buffered implies last_block.count <= max_block_size - end - - last_block: STRING - -- Last message body block that has been read. - do - Result := current_block - end - - is_buffered: BOOLEAN - -- Is the entire entity body buffered in memory (STRING)? - - end_of_blocks: BOOLEAN - -- Has the last of the entity body blocks been read? - - set_message_body (s: STRING) - -- Set the message body to 's'. Use this for when you want a memory - -- buffered response. - do - current_block := s - is_buffered := True - set_ready_to_transmit - ensure - is_buffered - ready_to_transmit - last_block.is_equal (s) - end - - max_block_size: INTEGER - -- Maximum block size returned by message body if not buffered - - set_max_block_size (block_size: INTEGER) - -- Set 'max_block_size'. - do - max_block_size := block_size - ensure - max_block_size = block_size - end - --- write_message_block (s: STRING) --- -- Write message body block 's' to a temporary file. Us this when --- -- you want a non-buffered response. --- require --- not is_buffered --- do --- -- TBD! --- ensure --- not is_buffered --- not ready_to_transmit --- end - -feature {NONE} -- Implementation - --- tmp_file_name: STRING - --- tmp_file: detachable FILE --- -- Created with mktmp - --- position: INTEGER --- -- Current read position in tmp_file - - current_block: STRING - -- Current message body block - - default_max_block_size: INTEGER = 65536 - -- Default value of 'max_block_size' - - crlf: STRING = "%/13/%/10/" - - status_text (code: INTEGER): STRING - do - inspect code - when 500 then - Result := "Internal Server Error" - when 200 then - Result := "OK" - else - Result := "Code " + code.out - end - end - -note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/ewsgi/src/extra/response_as_result/wgi_response_application.e b/library/server/ewsgi/src/extra/response_as_result/wgi_response_application.e deleted file mode 100644 index aad8bf91..00000000 --- a/library/server/ewsgi/src/extra/response_as_result/wgi_response_application.e +++ /dev/null @@ -1,56 +0,0 @@ -note - description: "Summary description for {WGI_RESPONSE_APPLICATION} " - legal: "See notice at end of class." - status: "See notice at end of class." - date: "$Date$" - revision: "$Revision$" - -deferred class - WGI_RESPONSE_APPLICATION - -feature -- Execution - - execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) - -- Execute the request - -- See `req.input' for input stream - -- `req.environment' for the Gateway environment - -- and `res.output' for output stream - local - rs: WGI_RESPONSE - do - rs := response (req) - if rs.ready_to_transmit then - rs.transmit_to (res) - else - -- Report internal server error. - -- Response not ready to transmit! - -- Implementor of WGI_APPLICATION has not done his job! - create rs.make - rs.set_status (500) - rs.set_header ("Content-Type", "text/plain") - rs.set_message_body ("Incomplete server implementation: Response not ready to transmit.%NTell the programmer to finish his/her job!") - rs.transmit_to (res) - end - end - -feature -- Response - - response (request: WGI_REQUEST): WGI_RESPONSE - -- HTTP response for given 'request'. - deferred - ensure - ready_to_transmit: Result.ready_to_transmit - end - -;note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" - -end diff --git a/library/server/ewsgi/src/wgi_request_from_table.e b/library/server/ewsgi/src/helper/wgi_request_from_table.e similarity index 100% rename from library/server/ewsgi/src/wgi_request_from_table.e rename to library/server/ewsgi/src/helper/wgi_request_from_table.e diff --git a/library/server/ewsgi/src/wgi_response_stream_buffer.e b/library/server/ewsgi/src/helper/wgi_response_stream_buffer.e similarity index 100% rename from library/server/ewsgi/src/wgi_response_stream_buffer.e rename to library/server/ewsgi/src/helper/wgi_response_stream_buffer.e diff --git a/library/server/ewsgi/src/support/ewf_error.e b/library/server/ewsgi/src/support/ewf_error.e deleted file mode 100644 index 5884d12e..00000000 --- a/library/server/ewsgi/src/support/ewf_error.e +++ /dev/null @@ -1,66 +0,0 @@ -note - description: "Summary description for {EWF_ERROR}." - legal: "See notice at end of class." - status: "See notice at end of class." - date: "$Date$" - revision: "$Revision$" - -class - EWF_ERROR - -inherit - ERROR - - HTTP_STATUS_CODE_MESSAGES - -create - make - -feature {NONE} -- Initialization - - make (a_code: INTEGER) - do - code := a_code - name := "HTTP Error" - if attached http_status_code_message (a_code) as m then - name := m - end - end - -feature -- Access - - code: INTEGER - - name: STRING - - message: detachable STRING_32 - -feature -- Element change - - set_message (m: like message) - -- Set `message' to `m' - require - m_attached: m /= Void - do - message := m - end - -feature -- Visitor - - process (a_visitor: ERROR_VISITOR) - -- Process Current using `a_visitor'. - do - a_visitor.process_error (Current) - end - -note - copyright: "2011-2011, Eiffel Software and others" - license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" - source: "[ - Eiffel Software - 5949 Hollister Ave., Goleta, CA 93117 USA - Telephone 805-685-1006, Fax 805-685-6869 - Website http://www.eiffel.com - Customer support http://support.eiffel.com - ]" -end diff --git a/library/server/request/rest/tests/sample.ecf b/library/server/request/rest/tests/sample.ecf index c4938969..e678a4ae 100644 --- a/library/server/request/rest/tests/sample.ecf +++ b/library/server/request/rest/tests/sample.ecf @@ -42,7 +42,7 @@ - + diff --git a/library/server/request/rest/tests/src/gateway/cgi/rest_application_gateway.e b/library/server/request/rest/tests/src/gateway/cgi/rest_application_gateway.e index 30dacc16..17460d10 100644 --- a/library/server/request/rest/tests/src/gateway/cgi/rest_application_gateway.e +++ b/library/server/request/rest/tests/src/gateway/cgi/rest_application_gateway.e @@ -8,11 +8,11 @@ feature -- Access build_gateway_and_launch local - cgi: EWF_CGI_CONNECTOR + cgi: WGI_CGI_CONNECTOR do create cgi.make (Current) cgi.launch - end + end gateway_name: STRING = "CGI" @@ -20,5 +20,5 @@ feature -- Access do (create {EXCEPTIONS}).die (a_code) end - + end diff --git a/library/server/request/rest/tests/src/gateway/fcgi/rest_application_gateway.e b/library/server/request/rest/tests/src/gateway/fcgi/rest_application_gateway.e index 936c79be..e60c9fed 100644 --- a/library/server/request/rest/tests/src/gateway/fcgi/rest_application_gateway.e +++ b/library/server/request/rest/tests/src/gateway/fcgi/rest_application_gateway.e @@ -8,7 +8,7 @@ feature -- Access build_gateway_and_launch local - libfcgi: EWF_LIBFCGI_CONNECTOR + libfcgi: WGI_LIBFCGI_CONNECTOR do create libfcgi.make (Current) libfcgi.launch diff --git a/library/server/request/rest/tests/src/gateway/nino/rest_application_gateway.e b/library/server/request/rest/tests/src/gateway/nino/rest_application_gateway.e index 17ae10f4..34bf8341 100644 --- a/library/server/request/rest/tests/src/gateway/nino/rest_application_gateway.e +++ b/library/server/request/rest/tests/src/gateway/nino/rest_application_gateway.e @@ -18,7 +18,7 @@ feature -- Access print ("Example: start a Nino web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/" + base_url + "%N") end - create app.make_custom (agent execute, base_url) + create app.make_custom (agent wgi_execute, base_url) app.force_single_threaded app.listen (port_number) diff --git a/library/server/request/rest/tests/src/handler/app_request_handler_context.e b/library/server/request/rest/tests/src/handler/app_request_handler_context.e index 76b703a0..45ae824f 100644 --- a/library/server/request/rest/tests/src/handler/app_request_handler_context.e +++ b/library/server/request/rest/tests/src/handler/app_request_handler_context.e @@ -16,14 +16,14 @@ create feature -- Format - get_format_id (a_format_variable_name: detachable READABLE_STRING_GENERAL; a_content_type_supported: detachable ARRAY [STRING_8]) + get_format_id (a_format_variable_name: detachable READABLE_STRING_8; a_content_type_supported: detachable ARRAY [STRING_8]) do if internal_format_id = 0 then internal_format_id := request_format_id (a_format_variable_name, a_content_type_supported) end end - get_format_name (a_format_variable_name: detachable READABLE_STRING_GENERAL; a_content_type_supported: detachable ARRAY [STRING_8]) + get_format_name (a_format_variable_name: detachable READABLE_STRING_8; a_content_type_supported: detachable ARRAY [STRING_8]) do if internal_format_name = Void then internal_format_name := request_format (a_format_variable_name, a_content_type_supported) diff --git a/library/server/ewsgi/default/ewsgi_cgi-safe.ecf b/library/server/wsf/default/cgi-safe.ecf similarity index 76% rename from library/server/ewsgi/default/ewsgi_cgi-safe.ecf rename to library/server/wsf/default/cgi-safe.ecf index 21f4677f..db7056f7 100644 --- a/library/server/ewsgi/default/ewsgi_cgi-safe.ecf +++ b/library/server/wsf/default/cgi-safe.ecf @@ -1,6 +1,6 @@ - - + + /EIFGENs$ @@ -11,8 +11,9 @@ - - + + + diff --git a/library/server/ewsgi/default/ewsgi_cgi.ecf b/library/server/wsf/default/cgi.ecf similarity index 75% rename from library/server/ewsgi/default/ewsgi_cgi.ecf rename to library/server/wsf/default/cgi.ecf index 5abbca2c..e1efa845 100644 --- a/library/server/ewsgi/default/ewsgi_cgi.ecf +++ b/library/server/wsf/default/cgi.ecf @@ -1,6 +1,6 @@ - - + + /EIFGENs$ @@ -11,8 +11,9 @@ - - + + + diff --git a/library/server/ewsgi/default/cgi/default_wgi_application.e b/library/server/wsf/default/cgi/default_application.e similarity index 79% rename from library/server/ewsgi/default/cgi/default_wgi_application.e rename to library/server/wsf/default/cgi/default_application.e index e42f84ae..7fb7b785 100644 --- a/library/server/ewsgi/default/cgi/default_wgi_application.e +++ b/library/server/wsf/default/cgi/default_application.e @@ -1,19 +1,19 @@ note - description: "Summary description for {DEFAULT_WGI_APPLICATION}." + description: "Summary description for {DEFAULT_APPLICATION}." date: "$Date$" revision: "$Revision$" deferred class - DEFAULT_WGI_APPLICATION + DEFAULT_APPLICATION inherit - WGI_APPLICATION + WSF_APPLICATION feature {NONE} -- Initialization make_and_launch local - cgi: EWF_CGI_CONNECTOR + cgi: WGI_CGI_CONNECTOR do create cgi.make (Current) cgi.launch diff --git a/library/server/ewsgi/default/ewsgi_nino-safe.ecf b/library/server/wsf/default/nino-safe.ecf similarity index 78% rename from library/server/ewsgi/default/ewsgi_nino-safe.ecf rename to library/server/wsf/default/nino-safe.ecf index 8a827054..8965e4d9 100644 --- a/library/server/ewsgi/default/ewsgi_nino-safe.ecf +++ b/library/server/wsf/default/nino-safe.ecf @@ -1,6 +1,6 @@ - - + + /EIFGENs$ @@ -11,8 +11,9 @@ - - + + + diff --git a/library/server/ewsgi/default/ewsgi_nino.ecf b/library/server/wsf/default/nino.ecf similarity index 78% rename from library/server/ewsgi/default/ewsgi_nino.ecf rename to library/server/wsf/default/nino.ecf index 0e3f9479..9b2ac5da 100644 --- a/library/server/ewsgi/default/ewsgi_nino.ecf +++ b/library/server/wsf/default/nino.ecf @@ -1,6 +1,6 @@ - - + + /EIFGENs$ @@ -11,8 +11,9 @@ - - + + + diff --git a/library/server/ewsgi/default/nino/default_wgi_application.e b/library/server/wsf/default/nino/default_application.e similarity index 82% rename from library/server/ewsgi/default/nino/default_wgi_application.e rename to library/server/wsf/default/nino/default_application.e index 7ff198fa..becc688a 100644 --- a/library/server/ewsgi/default/nino/default_wgi_application.e +++ b/library/server/wsf/default/nino/default_application.e @@ -1,13 +1,13 @@ note - description: "Summary description for {DEFAULT_WGI_APPLICATION}." + description: "Summary description for {DEFAULT_APPLICATION}." date: "$Date$" revision: "$Revision$" deferred class - DEFAULT_WGI_APPLICATION + DEFAULT_APPLICATION inherit - WGI_APPLICATION + WSF_APPLICATION feature {NONE} -- Initialization @@ -15,13 +15,13 @@ feature {NONE} -- Initialization local app: NINO_APPLICATION do - port_number := 80 + port_number := 8080 base_url := "" debug ("nino") print ("Example: start a Nino web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:" + port_number.out + "/" + base_url + "%N") end - create app.make_custom (agent execute, base_url) + create app.make_custom (agent wgi_execute, base_url) app.listen (port_number) end diff --git a/library/server/wsf/src/support/wsf_header.e b/library/server/wsf/src/support/wsf_header.e index ddc4a2be..5d333cdb 100644 --- a/library/server/wsf/src/support/wsf_header.e +++ b/library/server/wsf/src/support/wsf_header.e @@ -23,424 +23,12 @@ class WSF_HEADER inherit - ANY - - HTTP_STATUS_CODE_MESSAGES --| useful for `put_status' - export - {NONE} all - end + EWF_HEADER create make, make_with_count -feature {NONE} -- Initialization - - make - -- Initialize current - do - make_with_count (3) - end - - make_with_count (n: INTEGER) - -- Make with a capacity of `n' header entries - do - create {ARRAYED_LIST [READABLE_STRING_8]} headers.make (n) - end - -feature -- Recycle - - recycle - -- Recycle current object - do - headers.wipe_out - end - -feature -- Access - - headers: LIST [READABLE_STRING_8] - -- Header's lines - - string: STRING - -- String representation of the headers - local - l_headers: like headers - do - create Result.make (32) - l_headers := headers - if l_headers.is_empty then - put_content_type_text_html -- See if this make sense to define a default content-type - else - from - l_headers.start - until - l_headers.after - loop - append_line_to (l_headers.item, Result) - l_headers.forth - end - end - append_end_of_line_to (Result) - end - -feature -- Header change: general - - add_header (h: READABLE_STRING_8) - -- Add header `h' - -- if it already exists, there will be multiple header with same name - -- which can also be valid - require - h_not_empty: not h.is_empty - do - headers.force (h) - end - - put_header (h: READABLE_STRING_8) - -- Add header `h' or replace existing header of same header name - require - h_not_empty: not h.is_empty - do - force_header_by_name (header_name (h), h) - end - - add_header_key_value (k,v: READABLE_STRING_8) - -- Add header `k:v', or replace existing header of same header name/key - do - add_header (k + colon_space + v) - end - - put_header_key_value (k,v: READABLE_STRING_8) - -- Add header `k:v', or replace existing header of same header name/key - do - put_header (k + colon_space + v) - end - -feature -- Status related - - put_status (c: INTEGER) - -- Put "Status: " header - -- Rarely used - local - s: STRING - do - create s.make_from_string (c.out) - if attached http_status_code_message (c) as msg then - s.append_character (' ') - s.append (msg) - end - put_header_key_value ("Status", s) - end - -feature -- Content related header - - put_content_type (t: READABLE_STRING_8) - do - put_header_key_value ({HTTP_HEADER_NAMES}.header_content_type, t) - end - - add_content_type (t: READABLE_STRING_8) - -- same as `put_content_type', but allow multiple definition of "Content-Type" - do - add_header_key_value ({HTTP_HEADER_NAMES}.header_content_type, t) - end - - put_content_type_with_name (t: READABLE_STRING_8; n: READABLE_STRING_8) - do - put_header_key_value ({HTTP_HEADER_NAMES}.header_content_type, t + "; name=%"" + n + "%"") - end - - add_content_type_with_name (t: READABLE_STRING_8; n: READABLE_STRING_8) - -- same as `put_content_type_with_name', but allow multiple definition of "Content-Type" - do - add_header_key_value ({HTTP_HEADER_NAMES}.header_content_type, t + "; name=%"" + n + "%"") - end - - put_content_length (n: INTEGER) - do - put_header_key_value ({HTTP_HEADER_NAMES}.header_content_length, n.out) - end - - put_content_transfer_encoding (a_mechanism: READABLE_STRING_8) - -- Put "Content-Transfer-Encoding" header with for instance "binary" - --| encoding := "Content-Transfer-Encoding" ":" mechanism - --| - --| mechanism := "7bit" ; case-insensitive - --| / "quoted-printable" - --| / "base64" - --| / "8bit" - --| / "binary" - --| / x-token - - do - put_header_key_value ({HTTP_HEADER_NAMES}.header_content_transfer_encoding, a_mechanism) - end - - put_transfer_encoding (a_enc: READABLE_STRING_8) - -- Put "Transfer-Encoding" header with for instance "chunked" - do - put_header_key_value ({HTTP_HEADER_NAMES}.header_transfer_encoding, a_enc) - end - - put_transfer_encoding_chunked - -- Put "Transfer-Encoding: chunked" header - do - put_transfer_encoding ("chunked") - end - - put_content_disposition (a_type: READABLE_STRING_8; a_params: detachable READABLE_STRING_8) - -- Put "Content-Disposition" header - --| See RFC2183 - --| disposition := "Content-Disposition" ":" - --| disposition-type - --| *(";" disposition-parm) - --| disposition-type := "inline" - --| / "attachment" - --| / extension-token - --| ; values are not case-sensitive - --| disposition-parm := filename-parm - --| / creation-date-parm - --| / modification-date-parm - --| / read-date-parm - --| / size-parm - --| / parameter - --| filename-parm := "filename" "=" value - --| creation-date-parm := "creation-date" "=" quoted-date-time - --| modification-date-parm := "modification-date" "=" quoted-date-time - --| read-date-parm := "read-date" "=" quoted-date-time - --| size-parm := "size" "=" 1*DIGIT - --| quoted-date-time := quoted-string - --| ; contents MUST be an RFC 822 `date-time' - --| ; numeric timezones (+HHMM or -HHMM) MUST be used - do - if a_params /= Void then - put_header_key_value ({HTTP_HEADER_NAMES}.header_content_disposition, a_type + semi_colon_space + a_params) - else - put_header_key_value ({HTTP_HEADER_NAMES}.header_content_disposition, a_type) - end - end - -feature -- Content-type helpers - - put_content_type_text_css do put_content_type ({HTTP_MIME_TYPES}.text_css) end - put_content_type_text_csv do put_content_type ({HTTP_MIME_TYPES}.text_csv) end - put_content_type_text_html do put_content_type ({HTTP_MIME_TYPES}.text_html) end - put_content_type_text_javascript do put_content_type ({HTTP_MIME_TYPES}.text_javascript) end - put_content_type_text_json do put_content_type ({HTTP_MIME_TYPES}.text_json) end - put_content_type_text_plain do put_content_type ({HTTP_MIME_TYPES}.text_plain) end - put_content_type_text_xml do put_content_type ({HTTP_MIME_TYPES}.text_xml) end - - put_content_type_application_json do put_content_type ({HTTP_MIME_TYPES}.application_json) end - put_content_type_application_javascript do put_content_type ({HTTP_MIME_TYPES}.application_javascript) end - put_content_type_application_zip do put_content_type ({HTTP_MIME_TYPES}.application_zip) end - - put_content_type_image_gif do put_content_type ({HTTP_MIME_TYPES}.image_gif) end - put_content_type_image_png do put_content_type ({HTTP_MIME_TYPES}.image_png) end - put_content_type_image_jpg do put_content_type ({HTTP_MIME_TYPES}.image_jpg) end - put_content_type_image_svg_xml do put_content_type ({HTTP_MIME_TYPES}.image_svg_xml) end - - put_content_type_message_http do put_content_type ({HTTP_MIME_TYPES}.message_http) end - - put_content_type_multipart_mixed do put_content_type ({HTTP_MIME_TYPES}.multipart_mixed) end - put_content_type_multipart_alternative do put_content_type ({HTTP_MIME_TYPES}.multipart_alternative) end - put_content_type_multipart_related do put_content_type ({HTTP_MIME_TYPES}.multipart_related) end - put_content_type_multipart_form_data do put_content_type ({HTTP_MIME_TYPES}.multipart_form_data) end - put_content_type_multipart_signed do put_content_type ({HTTP_MIME_TYPES}.multipart_signed) end - put_content_type_multipart_encrypted do put_content_type ({HTTP_MIME_TYPES}.multipart_encrypted) end - -feature -- Date - - put_date (s: READABLE_STRING_8) - -- Put "Date: " header - do - put_header_key_value ({HTTP_HEADER_NAMES}.header_date, s) - end - - put_current_date - -- Put current date time with "Date" header - do - put_utc_date (create {DATE_TIME}.make_now_utc) - end - - put_utc_date (dt: DATE_TIME) - -- Put UTC date time `dt' with "Date" header - do - put_date (dt.formatted_out ("ddd,[0]dd mmm yyyy [0]hh:[0]mi:[0]ss.ff2") + " GMT") - end - -feature -- Others - - put_expires (n: INTEGER) - do - put_header_key_value ("Expires", n.out) - end - - put_cache_control (s: READABLE_STRING_8) - -- `s' could be for instance "no-cache, must-revalidate" - do - put_header_key_value ("Cache-Control", s) - end - - put_pragma (s: READABLE_STRING_8) - do - put_header_key_value ("Pragma", s) - end - - put_pragma_no_cache - do - put_pragma ("no-cache") - end - -feature -- Redirection - - put_location (a_location: READABLE_STRING_8) - -- Tell the client the new location `a_location' - require - a_location_valid: not a_location.is_empty - do - put_header_key_value ({HTTP_HEADER_NAMES}.header_location, a_location) - end - - put_refresh (a_location: READABLE_STRING_8; a_timeout_in_seconds: INTEGER) - -- Tell the client to refresh page with `a_location' after `a_timeout_in_seconds' in seconds - require - a_location_valid: not a_location.is_empty - do - put_header_key_value ({HTTP_HEADER_NAMES}.header_refresh, a_timeout_in_seconds.out + "; url=" + a_location) - end - -feature -- Cookie - - put_cookie (key, value: READABLE_STRING_8; expiration, path, domain, secure: detachable READABLE_STRING_8) - -- Set a cookie on the client's machine - -- with key 'key' and value 'value'. - require - make_sense: (key /= Void and value /= Void) and then (not key.is_empty and not value.is_empty) - local - s: STRING - do - s := {HTTP_HEADER_NAMES}.header_set_cookie + colon_space + key + "=" + value - if expiration /= Void then - s.append ("; expires=" + expiration) - end - if path /= Void then - s.append ("; path=" + path) - end - if domain /= Void then - s.append ("; domain=" + domain) - end - if secure /= Void then - s.append ("; secure=" + secure) - end - add_header (s) - end - -feature -- Status report - - has_header_named (a_name: READABLE_STRING_8): BOOLEAN - -- Has header item for `n'? - local - c: like headers.new_cursor - n: INTEGER - l_line: READABLE_STRING_8 - do - from - n := a_name.count - c := headers.new_cursor - until - c.after or Result - loop - l_line := c.item - if l_line.starts_with (a_name) then - if l_line.valid_index (n + 1) then - Result := l_line [n + 1] = ':' - end - end - c.forth - end - end - - has_content_length: BOOLEAN - -- Has header "content_length" - do - Result := has_header_named ({HTTP_HEADER_NAMES}.header_content_length) - end - -feature {NONE} -- Implementation: Header - - force_header_by_name (n: detachable READABLE_STRING_8; h: READABLE_STRING_8) - -- Add header `h' or replace existing header of same header name `n' - require - h_has_name_n: (n /= Void and attached header_name (h) as hn) implies n.same_string (hn) - local - l_headers: like headers - do - if n /= Void then - from - l_headers := headers - l_headers.start - until - l_headers.after or l_headers.item.starts_with (n) - loop - l_headers.forth - end - if not l_headers.after then - l_headers.replace (h) - else - add_header (h) - end - else - add_header (h) - end - end - - header_name (h: READABLE_STRING_8): detachable READABLE_STRING_8 - -- If any, header's name with colon - --| ex: for "Foo-bar: something", this will return "Foo-bar:" - local - s: detachable STRING_8 - i,n: INTEGER - c: CHARACTER - do - from - i := 1 - n := h.count - create s.make (10) - until - i > n or c = ':' or s = Void - loop - c := h[i] - inspect c - when ':' then - s.extend (c) - when '-', 'a' .. 'z', 'A' .. 'Z' then - s.extend (c) - else - s := Void - end - i := i + 1 - end - Result := s - end - -feature {NONE} -- Implementation - - append_line_to (s: READABLE_STRING_8; h: like string) - do - h.append_string (s) - append_end_of_line_to (h) - end - - append_end_of_line_to (h: like string) - do - h.append_character ('%R') - h.append_character ('%N') - end - -feature {NONE} -- Constants - - colon_space: STRING = ": " - semi_colon_space: STRING = "; " - note copyright: "2011-2011, Eiffel Software and others" license: "Eiffel Forum License v2 (see http://www.eiffel.com/licensing/forum.txt)" diff --git a/library/server/wsf/src/wsf_request.e b/library/server/wsf/src/wsf_request.e index de9305a3..16c595c8 100644 --- a/library/server/wsf/src/wsf_request.e +++ b/library/server/wsf/src/wsf_request.e @@ -1393,7 +1393,7 @@ feature {NONE} -- Implementation report_bad_request_error (a_message: detachable STRING) -- Report error local - e: EWF_ERROR + e: WSF_ERROR do create e.make ({HTTP_STATUS_CODE}.bad_request) if a_message /= Void then diff --git a/library/server/ewsgi/tests/test_ewsgi_request.e b/library/server/wsf/tests/test_wsf_request.e similarity index 96% rename from library/server/ewsgi/tests/test_ewsgi_request.e rename to library/server/wsf/tests/test_wsf_request.e index 9f0a7be7..3ddcf576 100644 --- a/library/server/ewsgi/tests/test_ewsgi_request.e +++ b/library/server/wsf/tests/test_wsf_request.e @@ -17,6 +17,11 @@ inherit on_clean end + WSF_APPLICATION + undefine + default_create + end + feature {NONE} -- Events web_app: detachable NINO_APPLICATION @@ -33,7 +38,7 @@ feature {NONE} -- Events do port_number := 8087 base_url := "test/" - create app.make_custom (agent execute, base_url) + create app.make_custom (agent wgi_execute, base_url) web_app := app create wt.make (agent app.listen (port_number)) @@ -43,7 +48,7 @@ feature {NONE} -- Events e.sleep (1_000_000_000 * 5) end - execute (req: WGI_REQUEST; res: WGI_RESPONSE_BUFFER) + execute (req: WSF_REQUEST; res: WSF_RESPONSE) local q: detachable STRING_32 do diff --git a/library/server/ewsgi/tests/tests-safe.ecf b/library/server/wsf/tests/tests-safe.ecf similarity index 77% rename from library/server/ewsgi/tests/tests-safe.ecf rename to library/server/wsf/tests/tests-safe.ecf index fa29a674..bf9302f3 100644 --- a/library/server/ewsgi/tests/tests-safe.ecf +++ b/library/server/wsf/tests/tests-safe.ecf @@ -1,5 +1,5 @@ - + @@ -11,11 +11,11 @@ - - + + - + diff --git a/library/server/ewsgi/tests/tests.ecf b/library/server/wsf/tests/tests.ecf similarity index 84% rename from library/server/ewsgi/tests/tests.ecf rename to library/server/wsf/tests/tests.ecf index 7f5a6e87..553a52f7 100644 --- a/library/server/ewsgi/tests/tests.ecf +++ b/library/server/wsf/tests/tests.ecf @@ -1,5 +1,5 @@ - + @@ -11,8 +11,8 @@ - - + + diff --git a/library/server/wsf/wsf-safe.ecf b/library/server/wsf/wsf-safe.ecf index 5f420cf7..ac1ee700 100644 --- a/library/server/wsf/wsf-safe.ecf +++ b/library/server/wsf/wsf-safe.ecf @@ -14,7 +14,7 @@ - - + + diff --git a/library/server/wsf/wsf.ecf b/library/server/wsf/wsf.ecf index 96f7f00b..db6b6daf 100644 --- a/library/server/wsf/wsf.ecf +++ b/library/server/wsf/wsf.ecf @@ -9,8 +9,12 @@ - - + + + + + +