aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_client
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-11-23 16:22:50 +0100
committerMicael Karlberg <[email protected]>2011-11-23 16:22:50 +0100
commit473c6308bbfed958ab04f45f53305e5d82d733fa (patch)
treef1f40409c955cb367aca433c1e1c8ddbb391bf9a /lib/inets/src/http_client
parenta41174d5ef937a22455f8cc52428fee313ae156e (diff)
downloadotp-473c6308bbfed958ab04f45f53305e5d82d733fa.tar.gz
otp-473c6308bbfed958ab04f45f53305e5d82d733fa.tar.bz2
otp-473c6308bbfed958ab04f45f53305e5d82d733fa.zip
Fixed acceptor exit warnings (detected by dialyzer).
Also fixed cookie_header/3 and updated documented accordingly. Also added documentation for undocumented URI parse option.
Diffstat (limited to 'lib/inets/src/http_client')
-rw-r--r--lib/inets/src/http_client/httpc.erl21
-rw-r--r--lib/inets/src/http_client/httpc_manager.erl4
2 files changed, 19 insertions, 6 deletions
diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl
index d72c34fa6b..ae87ceed93 100644
--- a/lib/inets/src/http_client/httpc.erl
+++ b/lib/inets/src/http_client/httpc.erl
@@ -34,7 +34,7 @@
set_option/2, set_option/3,
set_options/1, set_options/2,
store_cookies/2, store_cookies/3,
- cookie_header/1, cookie_header/2,
+ cookie_header/1, cookie_header/2, cookie_header/3,
which_cookies/0, which_cookies/1,
reset_cookies/0, reset_cookies/1,
stream_next/1,
@@ -290,25 +290,36 @@ store_cookies(SetCookieHeaders, Url, Profile)
%%--------------------------------------------------------------------------
-%% cookie_header(Url [, Profile]) -> Header | {error, Reason}
-%%
+%% cookie_header(Url) -> Header | {error, Reason}
+%% cookie_header(Url, Profile) -> Header | {error, Reason}
+%% cookie_header(Url, Opts, Profile) -> Header | {error, Reason}
+%%
%% Description: Returns the cookie header that would be sent when making
%% a request to <Url>.
%%-------------------------------------------------------------------------
cookie_header(Url) ->
cookie_header(Url, default_profile()).
-cookie_header(Url, Profile) ->
+cookie_header(Url, Profile) when is_atom(Profile) orelse is_pid(Profile) ->
+ cookie_header(Url, [], Profile);
+cookie_header(Url, Opts) when is_list(Opts) ->
+ cookie_header(Url, Opts, default_profile()).
+
+cookie_header(Url, Opts, Profile)
+ when (is_list(Opts) andalso (is_atom(Profile) orelse is_pid(Profile))) ->
?hcrt("cookie header", [{url, Url},
+ {opts, Opts},
{profile, Profile}]),
try
begin
- httpc_manager:which_cookies(Url, profile_name(Profile))
+ httpc_manager:which_cookies(Url, Opts, profile_name(Profile))
end
catch
exit:{noproc, _} ->
{error, {not_started, Profile}}
end.
+
+
%%--------------------------------------------------------------------------
diff --git a/lib/inets/src/http_client/httpc_manager.erl b/lib/inets/src/http_client/httpc_manager.erl
index 121562195f..a97cbb83f1 100644
--- a/lib/inets/src/http_client/httpc_manager.erl
+++ b/lib/inets/src/http_client/httpc_manager.erl
@@ -271,9 +271,11 @@ reset_cookies(ProfileName) ->
which_cookies(ProfileName) when is_atom(ProfileName) ->
call(ProfileName, which_cookies).
+
which_cookies(Url, ProfileName)
when is_list(Url) andalso is_atom(ProfileName) ->
- call(ProfileName, {which_cookies, Url, []}).
+ which_cookies(Url, [], ProfileName).
+
which_cookies(Url, Options, ProfileName)
when is_list(Url) andalso is_list(Options) andalso is_atom(ProfileName) ->
call(ProfileName, {which_cookies, Url, Options}).