diff options
author | Péter Dimitrov <[email protected]> | 2018-08-27 15:56:19 +0200 |
---|---|---|
committer | Péter Dimitrov <[email protected]> | 2018-08-27 15:56:19 +0200 |
commit | 30b5899883282b746b55fbf59b73211bbd071ddd (patch) | |
tree | f15195c299ff08d1578c90599952191eb96e1f16 /lib/inets/test | |
parent | 8bb0d5d4049b6b2ec41f6cc3e154e9f688029bef (diff) | |
parent | c492a313ce2893fdb8d5f1215b95d437a00c92de (diff) | |
download | otp-30b5899883282b746b55fbf59b73211bbd071ddd.tar.gz otp-30b5899883282b746b55fbf59b73211bbd071ddd.tar.bz2 otp-30b5899883282b746b55fbf59b73211bbd071ddd.zip |
Merge branch 'peterdmv/inets/fix_http_server/OTP-15241' into maint-20
* peterdmv/inets/fix_http_server/OTP-15241:
inets: Do not use chunked encoding with 1xx, 204, 304
Change-Id: I4dc1cb6dc62cc5a090d49248c5fbfbb23f33004f
Diffstat (limited to 'lib/inets/test')
-rw-r--r-- | lib/inets/test/httpd_SUITE.erl | 38 |
1 files changed, 37 insertions, 1 deletions
diff --git a/lib/inets/test/httpd_SUITE.erl b/lib/inets/test/httpd_SUITE.erl index 95466887f9..90192e633c 100644 --- a/lib/inets/test/httpd_SUITE.erl +++ b/lib/inets/test/httpd_SUITE.erl @@ -118,7 +118,7 @@ groups() -> disturbing_1_0, disturbing_0_9 ]}, - {post, [], [chunked_post, chunked_chunked_encoded_post]}, + {post, [], [chunked_post, chunked_chunked_encoded_post, post_204]}, {basic_auth, [], [basic_auth_1_1, basic_auth_1_0, basic_auth_0_9]}, {auth_api, [], [auth_api_1_1, auth_api_1_0, auth_api_0_9 ]}, @@ -746,6 +746,42 @@ chunked_chunked_encoded_post(Config) when is_list(Config) -> [{http_version, "HTTP/1.1"} | Config], [{statuscode, 200}]). +%%------------------------------------------------------------------------- +post_204() -> + [{doc,"Test that 204 responses are not chunk encoded"}]. +post_204(Config) -> + Host = proplists:get_value(host, Config), + Port = proplists:get_value(port, Config), + SockType = proplists:get_value(type, Config), + TranspOpts = transport_opts(SockType, Config), + Request = "POST /cgi-bin/erl/httpd_example:post_204 ", + + try inets_test_lib:connect_bin(SockType, Host, Port, TranspOpts) of + {ok, Socket} -> + RequestStr = http_request(Request, "HTTP/1.1", Host), + ok = inets_test_lib:send(SockType, Socket, RequestStr), + receive + {tcp, Socket, Data} -> + case binary:match(Data, <<"chunked">>,[]) of + nomatch -> + ok; + {_, _} -> + ct:fail("Chunked encoding detected.") + end + after 2000 -> + ct:fail(connection_timed_out) + end; + ConnectError -> + ct:fail({connect_error, ConnectError, + [SockType, Host, Port, TranspOpts]}) + catch + T:E -> + ct:fail({connect_failure, + [{type, T}, + {error, E}, + {stacktrace, erlang:get_stacktrace()}, + {args, [SockType, Host, Port, TranspOpts]}]}) + end. %%------------------------------------------------------------------------- htaccess_1_1(Config) when is_list(Config) -> |