aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/test/httpc_SUITE.erl
diff options
context:
space:
mode:
authorSergey Sinkovskiy <[email protected]>2014-04-30 09:57:51 +0300
committerKirilll Zaborsky <[email protected]>2014-04-30 14:28:43 +0400
commitcf3c624dc66a42d9d7bec904d8be3b8c4cce38ae (patch)
tree43abfd2c3df19ddcd2870e9a51aac37bdad90d1e /lib/inets/test/httpc_SUITE.erl
parent8acc644e162bad52f7ab81c76c0cad15628e4f3d (diff)
downloadotp-cf3c624dc66a42d9d7bec904d8be3b8c4cce38ae.tar.gz
otp-cf3c624dc66a42d9d7bec904d8be3b8c4cce38ae.tar.bz2
otp-cf3c624dc66a42d9d7bec904d8be3b8c4cce38ae.zip
inets: Fix streaming with single chunk body
Receiving HTTP response with chunked transfer encoding in a single TCP message should produce stream messages for response body when streaming mode is used for httpc.
Diffstat (limited to 'lib/inets/test/httpc_SUITE.erl')
-rw-r--r--lib/inets/test/httpc_SUITE.erl18
1 files changed, 17 insertions, 1 deletions
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl
index fe6edd504e..1e3710288b 100644
--- a/lib/inets/test/httpc_SUITE.erl
+++ b/lib/inets/test/httpc_SUITE.erl
@@ -93,6 +93,7 @@ only_simulated() ->
cookie_profile,
trace,
stream_once,
+ stream_single_chunk,
no_content_204,
tolerate_missing_CR,
userinfo,
@@ -379,6 +380,13 @@ stream_once(Config) when is_list(Config) ->
Request2 = {url(group_name(Config), "/once_chunked.html", Config), []},
stream_test(Request2, {stream, {self, once}}).
+%%-------------------------------------------------------------------------
+stream_single_chunk() ->
+ [{doc, "Test the option stream for asynchrony requests"}].
+stream_single_chunk(Config) when is_list(Config) ->
+ Request = {url(group_name(Config), "/single_chunk.html", Config), []},
+ stream_test(Request, {stream, self}).
+
%%-------------------------------------------------------------------------
redirect_multiple_choises() ->
@@ -1020,7 +1028,7 @@ stream_test(Request, To) ->
ct:fail(Msg)
end,
- Body == binary_to_list(StreamedBody).
+ Body = binary_to_list(StreamedBody).
url(http, End, Config) ->
Port = ?config(port, Config),
@@ -1635,6 +1643,14 @@ handle_uri(_,"/once_chunked.html",_,_,Socket,_) ->
http_chunk:encode("obar</BODY></HTML>")),
http_chunk:encode_last();
+handle_uri(_,"/single_chunk.html",_,_,Socket,_) ->
+ Chunk = "HTTP/1.1 200 ok\r\n" ++
+ "Transfer-Encoding:Chunked\r\n\r\n" ++
+ http_chunk:encode("<HTML><BODY>fo") ++
+ http_chunk:encode("obar</BODY></HTML>") ++
+ http_chunk:encode_last(),
+ send(Socket, Chunk);
+
handle_uri(_,"/once.html",_,_,Socket,_) ->
Head = "HTTP/1.1 200 ok\r\n" ++
"Content-Length:32\r\n\r\n",