diff options
author | Micael Karlberg <[email protected]> | 2012-05-22 17:37:33 +0200 |
---|---|---|
committer | Micael Karlberg <[email protected]> | 2012-05-22 17:37:33 +0200 |
commit | 022bc68b6dd10624b58779dc2b3b0e392e3e04f5 (patch) | |
tree | 60c818aef959b24f83a21b857dc906406b3c16d9 /lib/inets/src/http_client/httpc.erl | |
parent | ef14221acafe78b7a77b5d42b6a615fa7333750d (diff) | |
download | otp-022bc68b6dd10624b58779dc2b3b0e392e3e04f5.tar.gz otp-022bc68b6dd10624b58779dc2b3b0e392e3e04f5.tar.bz2 otp-022bc68b6dd10624b58779dc2b3b0e392e3e04f5.zip |
[inets/httpc] Better handling of session db update failure
A failure to update the session database will now result
in an informative error message and a controlled (handler)
exit rather then an ugly crash.
Also debug functions to retrieve sessions info and
updated the info function with more info (sessions and
options).
OTP-10093
Diffstat (limited to 'lib/inets/src/http_client/httpc.erl')
-rw-r--r-- | lib/inets/src/http_client/httpc.erl | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/lib/inets/src/http_client/httpc.erl b/lib/inets/src/http_client/httpc.erl index f4802fb96d..b6e7708353 100644 --- a/lib/inets/src/http_client/httpc.erl +++ b/lib/inets/src/http_client/httpc.erl @@ -39,6 +39,7 @@ cookie_header/1, cookie_header/2, cookie_header/3, which_cookies/0, which_cookies/1, reset_cookies/0, reset_cookies/1, + which_sessions/0, which_sessions/1, stream_next/1, default_profile/0, profile_name/1, profile_name/2, @@ -267,6 +268,7 @@ set_option(Key, Value, Profile) -> %% Reason - term() %% Description: Retrieves the current options. %%------------------------------------------------------------------------- + get_options() -> record_info(fields, options). @@ -373,8 +375,6 @@ cookie_header(Url, Opts, Profile) {error, {not_started, Profile}} end. - - %%-------------------------------------------------------------------------- %% which_cookies() -> [cookie()] @@ -398,6 +398,28 @@ which_cookies(Profile) -> %%-------------------------------------------------------------------------- +%% which_sessions() -> {GoodSession, BadSessions, NonSessions} +%% which_sessions(Profile) -> {GoodSession, BadSessions, NonSessions} +%% +%% Description: Debug function, dumping the sessions database, sorted +%% into three groups (Good-, Bad- and Non-sessions). +%%------------------------------------------------------------------------- +which_sessions() -> + which_sessions(default_profile()). + +which_sessions(Profile) -> + ?hcrt("which sessions", [{profile, Profile}]), + try + begin + httpc_manager:which_sessions(profile_name(Profile)) + end + catch + exit:{noproc, _} -> + {[], [], []} + end. + + +%%-------------------------------------------------------------------------- %% info() -> list() %% info(Profile) -> list() %% |