diff options
author | Ingela Anderton Andin <[email protected]> | 2011-05-11 12:05:11 +0200 |
---|---|---|
committer | Ingela Anderton Andin <[email protected]> | 2011-05-11 16:14:07 +0200 |
commit | 5d32eaf750cff98d242c8048eeb6b49c94fb6ee6 (patch) | |
tree | 6277bd5d272a1c0ae98be67c35734b4f16e36ff9 /lib/inets/src/http_client/httpc_request.erl | |
parent | 495ed95eeda4aa37de2f7387a3f029eb907039d6 (diff) | |
download | otp-5d32eaf750cff98d242c8048eeb6b49c94fb6ee6.tar.gz otp-5d32eaf750cff98d242c8048eeb6b49c94fb6ee6.tar.bz2 otp-5d32eaf750cff98d242c8048eeb6b49c94fb6ee6.zip |
Fixed httpc manager crash
httpc manager crashes.When a request results in a retry, the request
id will be "reused" in the previous implementation a race condition
could occur causing the manager to crash. This is now avoided by using
proc_lib:init_ack and gen_server:enter_loop to allow more advanced
initialization of httpc_handlers without blocking the httpc_manger
and eliminating extra processes that can cause race conditions.
Diffstat (limited to 'lib/inets/src/http_client/httpc_request.erl')
-rw-r--r-- | lib/inets/src/http_client/httpc_request.erl | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/inets/src/http_client/httpc_request.erl b/lib/inets/src/http_client/httpc_request.erl index 0d602adb11..879053f0f2 100644 --- a/lib/inets/src/http_client/httpc_request.erl +++ b/lib/inets/src/http_client/httpc_request.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2004-2010. All Rights Reserved. +%% Copyright Ericsson AB 2004-2011. All Rights Reserved. %% %% The contents of this file are subject to the Erlang Public License, %% Version 1.1, (the "License"); you may not use this file except in @@ -120,7 +120,7 @@ do_send_body(SocketType, Socket, Method, Uri, Version, Headers, Body) -> version(Version), ?CRLF, headers(Headers, Version), ?CRLF, Body], ?hcrd("send", [{message, Message}]), - http_transport:send(SocketType, Socket, lists:append(Message)). + http_transport:send(SocketType, Socket, Message). do_send_body(SocketType, Socket, ProcessBody, Acc) -> @@ -128,9 +128,7 @@ do_send_body(SocketType, Socket, ProcessBody, Acc) -> eof -> ok; {ok, Data, NewAcc} -> - DataBin = iolist_to_binary(Data), - ?hcrd("send", [{data, DataBin}]), - case http_transport:send(SocketType, Socket, DataBin) of + case http_transport:send(SocketType, Socket, Data) of ok -> do_send_body(SocketType, Socket, ProcessBody, NewAcc); Error -> |