aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/test
diff options
context:
space:
mode:
authorJohannes Weißl <[email protected]>2015-11-14 19:30:52 +0100
committerJohannes Weißl <[email protected]>2015-11-15 09:09:18 +0100
commit56025e23118f69b8d1b87b0478a93499752360cb (patch)
tree9bc40a6c81660dd92f1304cc61846a3a346f7964 /lib/inets/test
parent0db6272323fd662cb43f5bb4d24f01daa8a6647d (diff)
downloadotp-56025e23118f69b8d1b87b0478a93499752360cb.tar.gz
otp-56025e23118f69b8d1b87b0478a93499752360cb.tar.bz2
otp-56025e23118f69b8d1b87b0478a93499752360cb.zip
inets: Allow whitespace after HTTP chunk again
Before 77acb47 http:request/1 could parse server responses with whitespace after the HTTP chunk size (some embedded legacy devices still do this). This patch restores this functionality.
Diffstat (limited to 'lib/inets/test')
-rw-r--r--lib/inets/test/http_format_SUITE.erl16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/inets/test/http_format_SUITE.erl b/lib/inets/test/http_format_SUITE.erl
index a927adc75e..e977bd1b9b 100644
--- a/lib/inets/test/http_format_SUITE.erl
+++ b/lib/inets/test/http_format_SUITE.erl
@@ -38,6 +38,7 @@ groups() ->
[chunk_decode, chunk_encode, chunk_extensions_otp_6005,
chunk_decode_otp_6264,
chunk_decode_empty_chunk_otp_6511,
+ chunk_whitespace_suffix,
chunk_decode_trailer, chunk_max_headersize, chunk_max_bodysize, chunk_not_hex]}].
init_per_suite(Config) ->
@@ -157,6 +158,21 @@ chunk_decode_empty_chunk_otp_6511(Config) when is_list(Config) ->
?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE).
%%-------------------------------------------------------------------------
+chunk_whitespace_suffix() ->
+ [{doc, "Test whitespace after chunked length header"}].
+chunk_whitespace_suffix(Config) when is_list(Config) ->
+ ChunkedBody = "1a ; ignore-stuff-here" ++ ?CRLF ++
+ "abcdefghijklmnopqrstuvwxyz" ++ ?CRLF ++ "10 " ++ ?CRLF
+ ++ "1234567890abcdef" ++ ?CRLF ++ "0 " ++ ?CRLF
+ ++ "some-footer:some-value" ++ ?CRLF
+ ++ "another-footer:another-value" ++ ?CRLF ++ ?CRLF,
+ {ok, {["content-length:42", "another-footer:another-value",
+ "some-footer:some-value", ""],
+ <<"abcdefghijklmnopqrstuvwxyz1234567890abcdef">>}} =
+ http_chunk:decode(list_to_binary(ChunkedBody),
+ ?HTTP_MAX_BODY_SIZE, ?HTTP_MAX_HEADER_SIZE).
+
+%%-------------------------------------------------------------------------
chunk_decode_trailer() ->
[{doc,"Make sure trailers are handled correctly. Trailers should"
"become new headers"}].