diff --git a/library/server/ewsgi/default/nino/default_ewsgi_application.e b/library/server/ewsgi/default/nino/default_ewsgi_application.e index b7dabb28..25f59486 100644 --- a/library/server/ewsgi/default/nino/default_ewsgi_application.e +++ b/library/server/ewsgi/default/nino/default_ewsgi_application.e @@ -13,12 +13,15 @@ feature {NONE} -- Initialization make_and_launch do - print ("Example: start a Nino web server on port " + port_number.out + ", %Nand reply Hello World for any request such as http://localhost:8123/%N") + port_number := 80 + 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 + "/%N") (create {NINO_APPLICATION}.make_custom (agent execute, "")).listen (port_number) end - port_number: INTEGER = 80 + port_number: INTEGER +invariant + port_number_valid: port_number > 0 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/ewsgi/examples/hello_world_with_response/src/hello_world.e b/library/server/ewsgi/examples/hello_world_with_response/src/hello_world.e index 5d574f5c..0e1344c6 100644 --- 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 @@ -19,7 +19,19 @@ feature -- Response response (request: EWSGI_REQUEST): EWSGI_RESPONSE do - create {HELLO_WORLD_RESPONSE} Result.make + if request.environment.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: EWSGI_REQUEST): EWSGI_RESPONSE + do + create {HELLO_WORLD_RESPONSE} Result.make Result.set_status (200) Result.set_header ("Content-Type", "text/html; charset=utf-8") 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 index 56d64da8..fad48337 100644 --- 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 @@ -31,23 +31,26 @@ feature {NONE} -- Entity body local i: INTEGER do - if current_hello >= 100000 then + if current_hello >= 10000 then end_of_blocks := True else if current_hello = 0 then - current_block := "%N" + current_block := "%N" + current_block.append ("Welcome
In progress
") end from i := 0 until - i = 10000 + i = 1000 loop current_block.append ("Hello World ("+ current_hello.out +","+ i.out +")
%N") i := i + 1 end current_hello := current_hello + i - if current_hello = 100000 then - current_block.append ("Bye bye..
") + 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 diff --git a/library/server/ewsgi/src/extra/response_as_result/ewsgi_response.e b/library/server/ewsgi/src/extra/response_as_result/ewsgi_response.e index 221a6f26..d55b214e 100644 --- a/library/server/ewsgi/src/extra/response_as_result/ewsgi_response.e +++ b/library/server/ewsgi/src/extra/response_as_result/ewsgi_response.e @@ -131,7 +131,8 @@ feature {EWSGI_RESPONSE_APPLICATION} -- Message body -- -- TBD! end ensure - not is_buffered implies last_block.count <= max_block_size +--Commented, since it is far from obvious to ensure that: +-- not is_buffered implies last_block.count <= max_block_size end last_block: STRING