diff options
author | Ingela Anderton Andin <[email protected]> | 2013-03-19 12:04:46 +0100 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2013-03-19 12:04:46 +0100 |
commit | 395e5870020df6807c6e73462e75d594a07e40a8 (patch) | |
tree | 2cfae60b655f72dc1c0c7e64cb7ffa7458d4477a | |
parent | 487116a505a4346ea9e951a92fa17eea294bd177 (diff) | |
parent | ce52178afbfa9b70d0ebf0a3c974a2bf2c134d30 (diff) | |
download | otp-395e5870020df6807c6e73462e75d594a07e40a8.tar.gz otp-395e5870020df6807c6e73462e75d594a07e40a8.tar.bz2 otp-395e5870020df6807c6e73462e75d594a07e40a8.zip |
Merge branch 'ia/inets/cookie-bug/OTP-10956' into maint
* ia/inets/cookie-bug/OTP-10956:
inets httpc: Revert incorrect commit regarding cookie handling.
-rw-r--r-- | lib/inets/src/http_client/httpc_handler.erl | 2 | ||||
-rw-r--r-- | lib/inets/test/httpc_SUITE.erl | 29 |
2 files changed, 30 insertions, 1 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl index 857043bae2..f6b13c2998 100644 --- a/lib/inets/src/http_client/httpc_handler.erl +++ b/lib/inets/src/http_client/httpc_handler.erl @@ -1142,7 +1142,7 @@ handle_response(#state{request = Request, {session, Session}, {status_line, StatusLine}]), - handle_cookies(Headers, Request, Options, httpc_manager), %% FOO profile_name + handle_cookies(Headers, Request, Options, ProfileName), case httpc_response:result({StatusLine, Headers, Body}, Request) of %% 100-continue continue -> diff --git a/lib/inets/test/httpc_SUITE.erl b/lib/inets/test/httpc_SUITE.erl index c20ec63448..350192464e 100644 --- a/lib/inets/test/httpc_SUITE.erl +++ b/lib/inets/test/httpc_SUITE.erl @@ -90,6 +90,7 @@ real_requests()-> only_simulated() -> [ cookie, + cookie_profile, trace, stream_once, no_content_204, @@ -489,9 +490,37 @@ cookie(Config) when is_list(Config) -> {ok, {{_,200,_}, [_ | _], [_|_]}} = httpc:request(get, Request1, [], []), + [{session_cookies, [_|_]}] = httpc:which_cookies(httpc:default_profile()), + ets:delete(cookie), ok = httpc:set_options([{cookies, disabled}]). + + +%%------------------------------------------------------------------------- +cookie_profile() -> + [{doc, "Test cookies on a non default profile."}]. +cookie_profile(Config) when is_list(Config) -> + inets:start(httpc, [{profile, cookie_test}]), + ok = httpc:set_options([{cookies, enabled}], cookie_test), + + Request0 = {url(group_name(Config), "/cookie.html", Config), []}, + + {ok, {{_,200,_}, [_ | _], [_|_]}} + = httpc:request(get, Request0, [], [], cookie_test), + + %% Populate table to be used by the "dummy" server + ets:new(cookie, [named_table, public, set]), + ets:insert(cookie, {cookies, true}), + + Request1 = {url(group_name(Config), "/", Config), []}, + + {ok, {{_,200,_}, [_ | _], [_|_]}} + = httpc:request(get, Request1, [], [], cookie_test), + + ets:delete(cookie), + inets:stop(httpc, cookie_test). + %%------------------------------------------------------------------------- headers_as_is(doc) -> ["Test the option headers_as_is"]; |