aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_client
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2010-03-22 12:00:00 +0100
committerBjörn Gustavsson <[email protected]>2010-08-20 08:49:47 +0200
commitb792ebc90dca5c9ba3d75d7f3c56e2295ae5d6f3 (patch)
tree00646a187671eb46e7621b47d5ba0d8a4fcd19bb /lib/inets/src/http_client
parent4b4409332636b70fb22c3bcaf7e0ba5ef1538bf7 (diff)
downloadotp-b792ebc90dca5c9ba3d75d7f3c56e2295ae5d6f3.tar.gz
otp-b792ebc90dca5c9ba3d75d7f3c56e2295ae5d6f3.tar.bz2
otp-b792ebc90dca5c9ba3d75d7f3c56e2295ae5d6f3.zip
inets: Patch 1111
OTP-8508 [httpc] Badly formated error reason for errors occuring during initial connec to a servert. Also, the possible error reasons was not properly documented. OTP-8509 [httpd] Issues with ESI erl_script_timeout. </p> *) The "erl_script_timeout" config option is ducumented as a number of seconds. But when parsing the config, in the new format (not a config file), it was handled as if in number of milliseconds. *) When the erl-script-timeout time was exceeded, the server incorrectly marked the answer as sent, thereby leaving client hanging (with an incomplete answer). This has been changed, so that now the socket will be closed.
Diffstat (limited to 'lib/inets/src/http_client')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl35
1 files changed, 26 insertions, 9 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 31585537d4..695ff9cf82 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -280,7 +280,7 @@ handle_call({connect_and_send, #request{address = Address0,
{ok, NewState} ->
{reply, ok, NewState};
{stop, Error, NewState} ->
- {stop, Error, Error, NewState}
+ {stop, normal, Error, NewState}
end
end;
@@ -675,6 +675,24 @@ handle_info({'EXIT', _, _}, State) ->
%%--------------------------------------------------------------------
%% Init error there is no socket to be closed.
+terminate(normal,
+ #state{request = Request,
+ session = {send_failed, AReason} = Reason} = State) ->
+ ?hcrd("terminate", [{send_reason, AReason}, {request, Request}]),
+ maybe_send_answer(Request,
+ httpc_response:error(Request, Reason),
+ State),
+ ok;
+
+terminate(normal,
+ #state{request = Request,
+ session = {connect_failed, AReason} = Reason} = State) ->
+ ?hcrd("terminate", [{connect_reason, AReason}, {request, Request}]),
+ maybe_send_answer(Request,
+ httpc_response:error(Request, Reason),
+ State),
+ ok;
+
terminate(normal, #state{session = undefined}) ->
ok;
@@ -886,18 +904,17 @@ connect_and_send_first_request(Address,
NewState = activate_request_timeout(TmpState),
{ok, NewState};
- {error, Reason} ->
+ {error, Reason} = Error ->
?hcrv("failed sending request", [{reason, Reason}]),
- Error = {error, {send_failed,
- httpc_response:error(Request, Reason)}},
- {stop, Error, State#state{request = Request}}
+ {stop, Error,
+ State#state{session = {send_failed, Reason},
+ request = Request}}
end;
- {error, Reason} ->
+ {error, Reason} = Error ->
?hcri("connect failed", [{reason, Reason}]),
- Error = {error, {connect_failed,
- httpc_response:error(Request, Reason)}},
- {stop, Error, State#state{request = Request}}
+ {stop, Error, State#state{session = {connect_failed, Reason},
+ request = Request}}
end.