aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_client/httpc_handler.erl
diff options
context:
space:
mode:
authorKirilll Zaborsky <[email protected]>2015-07-24 14:02:48 +0300
committerIngela Anderton Andin <[email protected]>2015-09-08 18:16:47 +0200
commita66d9fb8813d32c7ded2253a7a5904f5b20b5ba8 (patch)
tree481bb6bcd67d3d0e095e543713b4376184df0278 /lib/inets/src/http_client/httpc_handler.erl
parentee5587d585052fe7b64c972029a6c68c403b71dc (diff)
downloadotp-a66d9fb8813d32c7ded2253a7a5904f5b20b5ba8.tar.gz
otp-a66d9fb8813d32c7ded2253a7a5904f5b20b5ba8.tar.bz2
otp-a66d9fb8813d32c7ded2253a7a5904f5b20b5ba8.zip
inets: Forward connection errors with https proxy
httpc should return meaningful error reason disregarding whether it is being used with http proxy or not
Diffstat (limited to 'lib/inets/src/http_client/httpc_handler.erl')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index 205348524a..6e6cc38c06 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -1817,13 +1817,13 @@ host_header(_, URI) ->
tls_upgrade(#state{status =
{ssl_tunnel,
#request{settings =
- #http_options{ssl = {_, TLSOptions} = SocketType}} = Request},
+ #http_options{ssl = {_, TLSOptions} = SocketType},
+ address = Address} = Request},
session = #session{socket = TCPSocket} = Session0,
options = Options} = State) ->
case ssl:connect(TCPSocket, TLSOptions) of
{ok, TLSSocket} ->
- Address = Request#request.address,
ClientClose = httpc_request:is_client_closing(Request#request.headers),
SessionType = httpc_manager:session_type(Options),
Session = Session0#session{
@@ -1844,7 +1844,11 @@ tls_upgrade(#state{status =
status = new
},
{noreply, activate_request_timeout(NewState)};
- {error, _Reason} ->
+ {error, Reason} ->
+ Error = httpc_response:error(Request, {failed_connect,
+ [{to_address, Address},
+ {tls, TLSOptions, Reason}]}),
+ maybe_send_answer(Request, Error, State),
{stop, normal, State#state{request = Request}}
end.