diff options
author | Kirilll Zaborsky <[email protected]> | 2015-07-20 16:38:33 +0300 |
---|---|---|
committer | Henrik Nord <[email protected]> | 2015-10-13 11:15:34 +0200 |
commit | f8750f121176c6cedc7b3162b6656ce201c9fe97 (patch) | |
tree | dd34f90b5f91ec81ecce16def8111bec585cb43d /lib/inets/test | |
parent | 981dd4509dbabcf3af3d4df611163987e10bca41 (diff) | |
download | otp-f8750f121176c6cedc7b3162b6656ce201c9fe97.tar.gz otp-f8750f121176c6cedc7b3162b6656ce201c9fe97.tar.bz2 otp-f8750f121176c6cedc7b3162b6656ce201c9fe97.zip |
inets: fix suppport of HTTP headers with obs-fold
httpc should not fail when response contains (now deprecated)
multiline HTTP headers constructed with obs-folds. And as
RFC7230 specifies user agent should replace obs-folds with
spaces.
Diffstat (limited to 'lib/inets/test')
-rw-r--r-- | lib/inets/test/httpc_SUITE.erl | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index 5b40d08859..2ad00bdf76 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -105,6 +105,7 @@ only_simulated() -> internal_server_error, invalid_http, headers_dummy, + headers_with_obs_fold, empty_response_header, remote_socket_close, remote_socket_close_async, @@ -893,6 +894,13 @@ headers_dummy(Config) when is_list(Config) -> %%------------------------------------------------------------------------- +headers_with_obs_fold(Config) when is_list(Config) -> + Request = {url(group_name(Config), "/obs_folded_headers.html", Config), []}, + {ok, {{_,200,_}, Headers, [_|_]}} = httpc:request(get, Request, [], []), + "a b" = proplists:get_value("folded", Headers). + +%%------------------------------------------------------------------------- + invalid_headers(Config) -> Request = {url(group_name(Config), "/dummy.html", Config), [{"cookie", undefined}]}, {error, _} = httpc:request(get, Request, [], []). @@ -1713,6 +1721,13 @@ handle_uri(_,"/dummy_headers.html",_,_,Socket,_) -> send(Socket, http_chunk:encode("obar</BODY></HTML>")), http_chunk:encode_last(); +handle_uri(_,"/obs_folded_headers.html",_,_,_,_) -> + "HTTP/1.1 200 ok\r\n" + "Content-Length:5\r\n" + "Folded: a\r\n" + " b\r\n\r\n" + "Hello"; + handle_uri(_,"/capital_transfer_encoding.html",_,_,Socket,_) -> Head = "HTTP/1.1 200 ok\r\n" ++ "Transfer-Encoding:Chunked\r\n\r\n", |