1. Tamas Nagy
  2. lhttpc

Commits

Oscar Hellström  committed b26f9a5

Changed name of lhttp_sock:read to recv, as it normally is called.

  • Participants
  • Parent commits f74ee37
  • Branches default

Comments (0)

Files changed (2)

File src/lhttpc_client.erl

View file
  • Ignore whitespace
 read_response(State, Vsn, Status, Hdrs, Body) ->
     Socket = State#client_state.socket,
     Ssl = State#client_state.ssl,
-    case lhttpc_sock:read(Socket, Ssl) of
+    case lhttpc_sock:recv(Socket, Ssl) of
         {ok, {http_response, NewVsn, StatusCode, Reason}} ->
             NewStatus = {StatusCode, Reason},
             read_response(State, NewVsn, NewStatus, Hdrs, Body);
     end.
 
 read_length(Hdrs, Ssl, Socket, Length) ->
-    case lhttpc_sock:read(Socket, Length, Ssl) of
+    case lhttpc_sock:recv(Socket, Length, Ssl) of
         {ok, Data} ->
             NewSocket = case lhttpc_lib:header_value("connection", Hdrs) of
                 "close" ->
         _         -> erlang:error(no_content_length)
     end.
 
-    case lhttpc_sock:read(Socket, Ssl) of
 read_until_closed(Socket, Acc, Hdrs, Ssl) ->
+    case lhttpc_sock:recv(Socket, Ssl) of
         {ok, Body} ->
             NewAcc = <<Acc/binary, Body/binary>>,
             read_until_closed(Socket, NewAcc, Hdrs, Ssl);

File src/lhttpc_sock.erl

View file
  • Ignore whitespace
 
 -export([
         connect/5,
-        read/2,
-        read/3,
+        recv/2,
+        recv/3,
         send/3,
         controlling_process/3,
         setopts/3,
 %% Will block untill data is available on the socket and return the first
 %% packet.
 %% @end
--spec read(port(), bool()) -> {ok, any()} | {error, atom()}.
-read(Socket, true) ->
+-spec recv(port(), bool()) -> {ok, any()} | {error, atom()}.
+recv(Socket, true) ->
     ssl:recv(Socket, 0);
-read(Socket, false) ->
+recv(Socket, false) ->
     gen_tcp:recv(Socket, 0).
 
 %% @spec (Socket, Length, SslFlag) -> {ok, Data} | {error, Reason}
 %%   Data = term()
 %%   Reason = atom()
 %% @doc
-%% Reads `Length' bytes from `Socket'.
+%% Receives `Length' bytes from `Socket'.
 %% Will block untill `Length' bytes is available.
 %% @end
--spec read(port(), integer(), bool()) -> {ok, any()} | {error, atom()}.
-read(_, 0, _) ->
+-spec recv(port(), integer(), bool()) -> {ok, any()} | {error, atom()}.
+recv(_, 0, _) ->
     {ok, <<>>};
-read(Socket, Length, true) ->
+recv(Socket, Length, true) ->
     ssl:recv(Socket, Length);
-read(Socket, Length, false) ->
+recv(Socket, Length, false) ->
     gen_tcp:recv(Socket, Length).
 
 %% @spec (Socket, Data, SslFlag) -> ok | {error, Reason}