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.
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user