Applied the removal of HTTP_INPUT_STREAM and HTTP_OUTPUT_STREAM to the example.
This commit is contained in:
@@ -24,18 +24,15 @@ create
|
||||
|
||||
feature {NONE} -- Initialization
|
||||
|
||||
make (a_input: like input; a_output: like output)
|
||||
make (a_socket: TCP_STREAM_SOCKET)
|
||||
do
|
||||
default_create
|
||||
input := a_input
|
||||
output := a_output
|
||||
socket := a_socket
|
||||
end
|
||||
|
||||
feature -- Access
|
||||
|
||||
input: HTTP_INPUT_STREAM
|
||||
|
||||
output: HTTP_OUTPUT_STREAM
|
||||
socket: TCP_STREAM_SOCKET
|
||||
|
||||
feature -- Execution
|
||||
|
||||
@@ -88,7 +85,7 @@ feature -- Execution
|
||||
end
|
||||
|
||||
--| Output the result
|
||||
output.put_string (answer.reply_header + answer.reply_text)
|
||||
socket.put_string (answer.reply_header + answer.reply_text)
|
||||
end
|
||||
|
||||
process_default
|
||||
|
||||
@@ -22,19 +22,30 @@ feature -- Execution
|
||||
-- process the request and create an answer
|
||||
local
|
||||
l_data: STRING
|
||||
s: STRING
|
||||
s: detachable STRING
|
||||
n: INTEGER
|
||||
sock: like socket
|
||||
do
|
||||
from
|
||||
n := 1_024
|
||||
input.read_stream (n)
|
||||
s := input.last_string
|
||||
sock := socket
|
||||
if sock.socket_ok then
|
||||
sock.read_stream_thread_aware (n)
|
||||
s := sock.last_string
|
||||
else
|
||||
s := Void
|
||||
end
|
||||
create l_data.make_empty
|
||||
until
|
||||
s.count < n
|
||||
s = Void or else s.count < n
|
||||
loop
|
||||
l_data.append_string (s)
|
||||
input.read_stream (n)
|
||||
if sock.socket_ok then
|
||||
sock.read_stream_thread_aware (n)
|
||||
s := sock.last_string
|
||||
else
|
||||
s := Void
|
||||
end
|
||||
end
|
||||
Precursor
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user