Skip to content

Commit

Permalink
inets httpc: Revert incorrect commit regarding cookie handling.
Browse files Browse the repository at this point in the history
  • Loading branch information
IngelaAndin committed Mar 18, 2013
1 parent 6769824 commit ce52178
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/inets/src/http_client/httpc_handler.erl
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand Down
29 changes: 29 additions & 0 deletions lib/inets/test/httpc_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ real_requests()->
only_simulated() ->
[
cookie,
cookie_profile,
trace,
stream_once,
no_content_204,
Expand Down Expand Up @@ -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"];
Expand Down

0 comments on commit ce52178

Please sign in to comment.