aboutsummaryrefslogtreecommitdiffstats
path: root/lib/inets/src/http_client/httpc_handler.erl
diff options
context:
space:
mode:
authorMicael Karlberg <[email protected]>2011-03-07 14:52:30 +0100
committerMicael Karlberg <[email protected]>2011-03-07 14:52:30 +0100
commitdb29f9ede14ff5b8d747230fcad8ffa1b157f1e1 (patch)
tree0512f7a95f5425aa4afdb5dc8eddf2f303eae12b /lib/inets/src/http_client/httpc_handler.erl
parent546d0fd69519682e92b6493b6d092e4591ae5010 (diff)
downloadotp-db29f9ede14ff5b8d747230fcad8ffa1b157f1e1.tar.gz
otp-db29f9ede14ff5b8d747230fcad8ffa1b157f1e1.tar.bz2
otp-db29f9ede14ff5b8d747230fcad8ffa1b157f1e1.zip
Adding missing "send loop" for raw sending.
Also fixed some of the documentation (types).
Diffstat (limited to 'lib/inets/src/http_client/httpc_handler.erl')
-rw-r--r--lib/inets/src/http_client/httpc_handler.erl18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/inets/src/http_client/httpc_handler.erl b/lib/inets/src/http_client/httpc_handler.erl
index cb6f3e2841..5e22400fe0 100644
--- a/lib/inets/src/http_client/httpc_handler.erl
+++ b/lib/inets/src/http_client/httpc_handler.erl
@@ -1724,9 +1724,27 @@ handle_verbose(_) ->
%% ok.
+send_raw(#session{socket = Socket, socket_type = SocketType},
+ {ProcessBody, Acc}) when is_function(ProcessBody, 1) ->
+ ?hcrt("send raw", [{acc, Acc}]),
+ send_raw(SocketType, Socket, ProcessBody, Acc);
send_raw(#session{socket = Socket, socket_type = SocketType}, Body) ->
http_transport:send(SocketType, Socket, Body).
+send_raw(SocketType, Socket, ProcessBody, Acc) ->
+ case ProcessBody(Acc) of
+ eof ->
+ ok;
+ {ok, Data, NewAcc} ->
+ DataBin = iolist_to_binary(Data),
+ ?hcrd("send", [{data, DataBin}]),
+ case http_transport:send(SocketType, Socket, DataBin) of
+ ok ->
+ send_raw(SocketType, Socket, ProcessBody, NewAcc);
+ Error ->
+ Error
+ end
+ end.
call(Msg, Pid) ->