From 4a955764995cc2298605bdf75f11b10b73fa45a5 Mon Sep 17 00:00:00 2001 From: Kirilll Zaborsky Date: Thu, 6 Mar 2014 15:40:26 +0400 Subject: Added a condition to ignore empty Set-Cookie header and tests for it --- lib/inets/test/httpc_SUITE.erl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'lib/inets/test/httpc_SUITE.erl') diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index fe6edd504e..b6e2b24450 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -91,6 +91,7 @@ only_simulated() -> [ cookie, cookie_profile, + empty_set_cookie, trace, stream_once, no_content_204, @@ -529,6 +530,19 @@ cookie_profile(Config) when is_list(Config) -> ets:delete(cookie), inets:stop(httpc, cookie_test). +%%------------------------------------------------------------------------- +empty_set_cookie() -> + [{doc, "Test empty Set-Cookie header."}]. +empty_set_cookie(Config) when is_list(Config) -> + ok = httpc:set_options([{cookies, enabled}]), + + Request0 = {url(group_name(Config), "/empty_set_cookie.html", Config), []}, + + {ok, {{_,200,_}, [_ | _], [_|_]}} + = httpc:request(get, Request0, [], []), + + ok = httpc:set_options([{cookies, disabled}]). + %%------------------------------------------------------------------------- headers_as_is(doc) -> ["Test the option headers_as_is"]; @@ -1616,6 +1630,12 @@ handle_uri(_,"/cookie.html",_,_,_,_) -> "Content-Length:32\r\n\r\n"++ "foobar"; +handle_uri(_,"/empty_set_cookie.html",_,_,_,_) -> + "HTTP/1.1 200 ok\r\n" ++ + "set-cookie: \r\n" ++ + "Content-Length:32\r\n\r\n"++ + "foobar"; + handle_uri(_,"/missing_crlf.html",_,_,_,_) -> "HTTP/1.1 200 ok" ++ "Content-Length:32\r\n" ++ -- cgit v1.2.3