diff --git a/examples/simple_file/service.ini b/examples/simple_file/service.ini new file mode 100644 index 00000000..a8c39747 --- /dev/null +++ b/examples/simple_file/service.ini @@ -0,0 +1,4 @@ +port=9090 +verbose=true +socket_recv_timeout=15 +keep_alive_timeout=30 diff --git a/examples/simple_file/service_file.e b/examples/simple_file/service_file.e index 44de0e62..edec85f8 100644 --- a/examples/simple_file/service_file.e +++ b/examples/simple_file/service_file.e @@ -21,6 +21,7 @@ feature {NONE} -- Initialization do Precursor set_service_option ("port", 9090) + import_service_options (create {WSF_SERVICE_LAUNCHER_OPTIONS_FROM_INI}.make_from_file ("service.ini")) end end diff --git a/library/server/wsf/tests/src/wgi_response_null.e b/library/server/wsf/tests/src/wgi_response_null.e index 95b47c83..3d41b925 100644 --- a/library/server/wsf/tests/src/wgi_response_null.e +++ b/library/server/wsf/tests/src/wgi_response_null.e @@ -108,6 +108,49 @@ feature -- Output operation output.append_substring (s, start_index, end_index) end + put_file_content (a_file: FILE; a_offset: INTEGER; a_byte_count: INTEGER) + -- Send `a_byte_count' bytes from the content of file `a_file' starting at offset `a_offset'. + --| Could be redefined for optimization. + local + l_close_needed: BOOLEAN + l_remain: INTEGER + l_done: BOOLEAN + s: STRING + do + if a_file.exists and then a_file.is_access_readable then + if a_file.is_open_read then + l_close_needed := False + else + l_close_needed := True + a_file.open_read + end + if a_offset > 0 then + a_file.move (a_offset) + end + from + l_remain := a_byte_count + l_done := False + until + a_file.exhausted or l_done + loop + a_file.read_stream (l_remain.min (4_096)) + s := a_file.last_string + if s.is_empty then + -- network error? + l_done := True + else + put_string (s) + l_remain := l_remain - s.count + check l_remain >= 0 end + l_done := l_remain = 0 + end + end + if l_close_needed then + a_file.close + end + end + end + flush do output.wipe_out