Fixed issue in WSF_REQUEST.read_input_data_into when the content is zero

Cleaned the WGI_CHUNKED_INPUT_STREAM and provides access to last extension, last trailer, ...
Improved WSF_TRACE_RESPONSE to support tracing chunked input back to the client.
This commit is contained in:
Jocelyn Fiat
2012-12-19 12:47:35 +01:00
parent 59f19dc52f
commit 7193ce93f4
3 changed files with 93 additions and 39 deletions

View File

@@ -54,24 +54,37 @@ feature {WSF_RESPONSE} -- Output
res.put_header_text (h.string)
res.put_chunk (s, Void)
if attached req.input as l_input then
from
n := 8_192
until
n = 0
loop
s.wipe_out
nb := l_input.read_to_string (s, 1, n)
if nb = 0 then
n := 0
else
if nb < n then
n := 0
end
res.put_chunk (s, Void)
if attached {WGI_CHUNKED_INPUT_STREAM} l_input as l_chunked_input then
from
l_chunked_input.read_chunk
until
l_chunked_input.last_chunk_size = 0
loop
res.put_chunk (l_chunked_input.last_chunk_data, l_chunked_input.last_chunk_extension)
l_chunked_input.read_chunk
end
res.put_custom_chunk_end (l_chunked_input.last_chunk_extension, l_chunked_input.last_trailer)
else
check is_chunked_input: False end
from
n := 8_192
until
n = 0
loop
s.wipe_out
nb := l_input.read_to_string (s, 1, n)
if nb = 0 then
n := 0
else
if nb < n then
n := 0
end
res.put_chunk (s, Void)
end
end
res.put_chunk_end
end
end
res.put_chunk_end
res.flush
else
req.read_input_data_into (s)

View File

@@ -224,9 +224,11 @@ feature -- Access: Input
end
else
n := content_length_value.as_integer_32
buf.resize (buf.count + n)
n := l_input.read_to_string (buf, buf.count + 1, n)
check n = content_length_value.as_integer_32 end
if n > 0 then
buf.resize (buf.count + n)
n := l_input.read_to_string (buf, buf.count + 1, n)
check n = content_length_value.as_integer_32 end
end
end
if raw_input_data_recorded then
set_raw_input_data (buf)