[erlang-bugs] Possible regression in httpc's cookie handling

Anton Yabchinskiy arn@REDACTED
Fri Mar 15 15:19:56 CET 2013


Hello,

I've encountered a difference in behaviour of HTTP client in
R15B01 (Debian build) and in R16B (Erlang Solutions build).
Consider the following code:

#!/usr/bin/env escript

main(_Args) ->
    Profile = some_profile,
    ok = application:start(inets),
    {ok, _Pid} = inets:start(httpc, [{profile, Profile}]),
    ok = httpc:set_option(cookies, enabled, Profile),
    _Ans = httpc:request("http://www.google.ru/", Profile),
    io:format("~p~n", [httpc:which_cookies(Profile)]).

When run with R15B01 it outputs the following:

[{session_cookies,[{http_cookie,".google.ru",false,"PREF",
                                 
"ID=542c81909139855f:FF=0:NW=1:TM=1363356181:LM=1363356181:S=JNFNZBI_nhJC-IIO",
                                undefined,session,"/",false,false,"0"},
                   {http_cookie,".google.ru",false,"NID",
                                 
"67=CkprmSvcQFKD7P0pt1FkRHkXZXTe_geBYXy2gk65yJTJyxvIjqm0Mrc7xErtR4xL5qaKsfUMC4oTWsvJze910qRx79VBf66rivfjmN88bVhg9aDd6YS2M3UohXLXT68t",
                                undefined,session,"/",false,false,"0"}]}]

The output for R16B is:

[{session_cookies,[]}]

There is no difference in behaviour if profile isn't used.

I'm not sure, but probably it's related to commit
9c85ee8b61c24587a228b3644c37b1b4fdfb7dcb, which includes
the following change in lib/inets/src/http_client/httpc_handler.erl
file:

- handle_cookies(Headers, Request, Options, ProfileName), + 
handle_cookies(Headers, Request, Options, httpc_manager), %% FOO 
profile_name




More information about the erlang-bugs mailing list