Compare commits

...

3 Commits

Author SHA1 Message Date
f56aa22c29 Fixed compilation of proxy and simple examples.
Made the websocket client library scoop capable.
2016-12-05 15:56:46 +01:00
186e5514eb If the count for put_file_content is not positive (i.e <= 0), do not send anything.
Output/log more information for request handling when standalone httpd server has verbose enabled.
2016-12-01 21:20:14 +01:00
9fd53b9b1f Fixed debug.ecf file from debug example. 2016-12-01 21:08:13 +01:00
12 changed files with 44 additions and 38 deletions

View File

@@ -11,10 +11,6 @@
</option> </option>
<setting name="console_application" value="true"/> <setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/> <setting name="concurrency" value="scoop"/>
<capability>
<concurrency support="scoop" use="scoop"/>
<void_safety support="all"/>
</capability>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="encoder" location="..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/> <library name="encoder" location="..\..\library\text\encoder\encoder-safe.ecf" readonly="false"/>
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/> <library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>
@@ -24,9 +20,6 @@
<target name="debug_any" extends="common"> <target name="debug_any" extends="common">
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/> <root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="scoop"/> <setting name="concurrency" value="scoop"/>
<capability>
<concurrency support="scoop" use="scoop"/>
</capability>
<library name="cgi" location="..\..\library\server\wsf\connector\cgi-safe.ecf" readonly="false"/> <library name="cgi" location="..\..\library\server\wsf\connector\cgi-safe.ecf" readonly="false"/>
<library name="libfcgi" location="..\..\library\server\wsf\connector\libfcgi-safe.ecf" readonly="false"/> <library name="libfcgi" location="..\..\library\server\wsf\connector\libfcgi-safe.ecf" readonly="false"/>
<library name="standalone" location="..\..\library\server\wsf\connector\standalone-safe.ecf" readonly="false"/> <library name="standalone" location="..\..\library\server\wsf\connector\standalone-safe.ecf" readonly="false"/>
@@ -36,9 +29,6 @@
<target name="debug_standalone" extends="common"> <target name="debug_standalone" extends="common">
<root class="EWF_DEBUG_SERVER" feature="make_and_launch"/> <root class="EWF_DEBUG_SERVER" feature="make_and_launch"/>
<setting name="concurrency" value="scoop"/> <setting name="concurrency" value="scoop"/>
<capability>
<concurrency support="scoop" use="scoop"/>
</capability>
<library name="default_standalone" location="..\..\library\server\wsf\default\standalone-safe.ecf" readonly="false"/> <library name="default_standalone" location="..\..\library\server\wsf\default\standalone-safe.ecf" readonly="false"/>
<cluster name="launcher" location=".\launcher\default\" recursive="true"/> <cluster name="launcher" location=".\launcher\default\" recursive="true"/>
<cluster name="src" location=".\src\" recursive="true"/> <cluster name="src" location=".\src\" recursive="true"/>

View File

@@ -10,6 +10,7 @@
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/> <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option> </option>
<setting name="console_application" value="true"/> <setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/>
<variable name="ssl_supported" value="false"/> <variable name="ssl_supported" value="false"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/> <library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>

View File

@@ -10,6 +10,7 @@
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/> <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option> </option>
<setting name="console_application" value="true"/> <setting name="console_application" value="true"/>
<setting name="concurrency" value="scoop"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/> <library name="http" location="..\..\library\network\protocol\http\http-safe.ecf"/>
<library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/> <library name="wsf" location="..\..\library\server\wsf\wsf-safe.ecf"/>

View File

@@ -22,13 +22,10 @@ create
feature {NONE} -- Initialization feature {NONE} -- Initialization
initialize initialize
local
opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS
do do
Precursor Precursor
--| Uncomment the following 2 lines, to read options from "ewf.ini" configuration file --| Uncomment the following line, to read options from "ewf.ini" configuration file
-- create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} opts.make_from_file ("ewf.ini") -- import_service_options (create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI} opts.make_from_file ("ewf.ini"))
-- import_service_options (opts)
end end
launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS) launch (opts: detachable WSF_SERVICE_LAUNCHER_OPTIONS)

View File

@@ -29,10 +29,8 @@ feature {NONE} -- Initialization
create ws_client.make_with_port ("ws://echo.websocket.org", 80, Void) create ws_client.make_with_port ("ws://echo.websocket.org", 80, Void)
-- create ws_client.make_with_port ("ws://127.0.0.1", 9090, Void) -- create ws_client.make_with_port ("ws://127.0.0.1", 9090, Void)
ws_client.launch
ws_client.join_all
execution_environment.sleep (5_000_000) ws_client.execute
end end
end end

View File

@@ -7,9 +7,10 @@
<exclude>/CVS$</exclude> <exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude> <exclude>/EIFGENs$</exclude>
</file_rule> </file_rule>
<option warning="true" void_safety="all"> <option warning="true" void_safety="all">
<assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/> <assertions precondition="true" postcondition="true" check="true" invariant="true" loop="true" supplier_precondition="true"/>
</option> </option>
<setting name="concurrency" value="scoop"/>
<setting name="console_application" value="true"/> <setting name="console_application" value="true"/>
<library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base-safe.ecf"/>
<library name="web_socket_client" location="..\..\web_socket_client-safe.ecf" readonly="false"/> <library name="web_socket_client" location="..\..\web_socket_client-safe.ecf" readonly="false"/>
@@ -17,7 +18,7 @@
</target> </target>
<target name="ws_client" extends="common"> <target name="ws_client" extends="common">
<root class="APPLICATION" feature="make"/> <root class="APPLICATION" feature="make"/>
<setting name="concurrency" value="thread"/> <setting name="concurrency" value="scoop"/>
</target> </target>
<target name="ws_client_ssl" extends="ws_client"> <target name="ws_client_ssl" extends="ws_client">
<variable name="ssl_enabled" value="true"/> <variable name="ssl_enabled" value="true"/>

View File

@@ -23,11 +23,6 @@ inherit
WEB_SOCKET WEB_SOCKET
THREAD
rename
make as thread_make
end
feature -- Initialization feature -- Initialization
initialize (a_uri: READABLE_STRING_GENERAL; a_protocols: detachable ITERABLE [STRING]) initialize (a_uri: READABLE_STRING_GENERAL; a_protocols: detachable ITERABLE [STRING])
@@ -35,7 +30,6 @@ feature -- Initialization
require require
is_valid_uri: is_valid_uri (a_uri) is_valid_uri: is_valid_uri (a_uri)
do do
thread_make
uri := a_uri uri := a_uri
set_default_port set_default_port
create protocol.make_empty create protocol.make_empty
@@ -50,7 +44,6 @@ feature -- Initialization
require require
is_valid_uri: is_valid_uri (a_uri) is_valid_uri: is_valid_uri (a_uri)
do do
thread_make
uri := a_uri uri := a_uri
port := a_port port := a_port
create protocol.make_empty create protocol.make_empty
@@ -64,11 +57,9 @@ feature -- Initialization
require require
is_valid_uri: is_valid_uri (a_host) is_valid_uri: is_valid_uri (a_host)
do do
thread_make
uri := a_host + ":" + a_port.out + a_path uri := a_host + ":" + a_port.out + a_path
port := a_port port := a_port
create protocol.make_empty create protocol.make_empty
-- set_protocols (a_protocols)
create ready_state.make create ready_state.make
socket := new_socket (port, host) socket := new_socket (port, host)
create server_handshake.make create server_handshake.make
@@ -98,8 +89,10 @@ feature -- Access
local local
l_uri: URI l_uri: URI
do do
create l_uri.make_from_string (a_uri.as_string_8) if a_uri.is_valid_as_string_8 then
Result := l_uri.is_valid create l_uri.make_from_string (a_uri.to_string_8)
Result := l_uri.is_valid
end
end end
server_handshake: WEB_SOCKET_HANDSHAKE_DATA server_handshake: WEB_SOCKET_HANDSHAKE_DATA

View File

@@ -17,7 +17,6 @@
<library name="lib_http_network" location="..\..\http_network\http_network-safe.ecf"/> <library name="lib_http_network" location="..\..\http_network\http_network-safe.ecf"/>
<library name="lib_web_socket_protocol" location="..\protocol\web_socket_protocol-safe.ecf"/> <library name="lib_web_socket_protocol" location="..\protocol\web_socket_protocol-safe.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/> <library name="net" location="$ISE_LIBRARY\library\net\net-safe.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread-safe.ecf"/>
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri-safe.ecf"/> <library name="uri" location="$ISE_LIBRARY\library\text\uri\uri-safe.ecf"/>
<cluster name="web_socket_client" location=".\src\" recursive="true"> <cluster name="web_socket_client" location=".\src\" recursive="true">
<file_rule> <file_rule>

View File

@@ -8,7 +8,7 @@
<exclude>/CVS$</exclude> <exclude>/CVS$</exclude>
<exclude>/EIFGENs$</exclude> <exclude>/EIFGENs$</exclude>
</file_rule> </file_rule>
<option warning="true" void_safety="none"> <option warning="true" void_safety="none">
</option> </option>
<setting name="concurrency" value="scoop"/> <setting name="concurrency" value="scoop"/>
<library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/> <library name="base" location="$ISE_LIBRARY\library\base\base.ecf"/>
@@ -17,7 +17,6 @@
<library name="lib_http_network" location="..\..\http_network\http_network.ecf"/> <library name="lib_http_network" location="..\..\http_network\http_network.ecf"/>
<library name="lib_web_socket_protocol" location="..\protocol\web_socket_protocol.ecf"/> <library name="lib_web_socket_protocol" location="..\protocol\web_socket_protocol.ecf"/>
<library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/> <library name="net" location="$ISE_LIBRARY\library\net\net.ecf"/>
<library name="thread" location="$ISE_LIBRARY\library\thread\thread.ecf"/>
<library name="uri" location="$ISE_LIBRARY\library\text\uri\uri.ecf"/> <library name="uri" location="$ISE_LIBRARY\library\text\uri\uri.ecf"/>
<cluster name="web_socket_client" location=".\src\" recursive="true"> <cluster name="web_socket_client" location=".\src\" recursive="true">
<file_rule> <file_rule>

View File

@@ -106,7 +106,9 @@ feature -- Output operation
put_file_content (f: FILE; a_offset: INTEGER; a_count: INTEGER) put_file_content (f: FILE; a_offset: INTEGER; a_count: INTEGER)
-- Send `a_count' bytes from the content of file `f' starting at offset `a_offset'. -- Send `a_count' bytes from the content of file `f' starting at offset `a_offset'.
do do
output.put_file_content (f, a_offset, a_count) if a_count > 0 then
output.put_file_content (f, a_offset, a_count)
end
end end
flush flush

View File

@@ -170,6 +170,9 @@ feature -- Status change
-- Report error occurred, with optional message `m'. -- Report error occurred, with optional message `m'.
do do
has_error := True has_error := True
if m /= Void and then is_verbose then
log (m.as_string_8, debug_level)
end
end end
reset_error reset_error
@@ -313,7 +316,7 @@ feature -- Execution
is_persistent_connection_requested := False is_persistent_connection_requested := False
else else
if is_verbose then if is_verbose then
log (request_header, information_level) log_with_separation_line (request_header, information_level)
end end
process_request (l_socket) process_request (l_socket)
end end
@@ -590,6 +593,26 @@ feature -- Output
logger_set: logger = a_logger logger_set: logger = a_logger
end end
log_with_separation_line (m: STRING; a_level: INTEGER)
-- Log message `m'.
require
is_verbose: is_verbose
local
s: STRING
do
if is_verbose and (verbose_level & a_level) = a_level then
create s.make (m.count + 42)
s.append (create {STRING}.make_filled ('-', 40))
s.append_character ('%N')
s.append (m)
if attached logger as l_logger then
l_logger.log (s)
else
io.put_string (s + "%N")
end
end
end
log (m: STRING; a_level: INTEGER) log (m: STRING; a_level: INTEGER)
-- Log message `m'. -- Log message `m'.
require require

View File

@@ -389,8 +389,10 @@ feature -- Body
message_writable: message_writable message_writable: message_writable
not_too_big: a_offset + a_count <= f.count not_too_big: a_offset + a_count <= f.count
do do
wgi_response.put_file_content (f, a_offset, a_count) if a_count > 0 then
increment_transfered_content_length (a_count) wgi_response.put_file_content (f, a_offset, a_count)
increment_transfered_content_length (a_count)
end
end end
feature -- Chunk body feature -- Chunk body