0
Fork 0
mirror of https://github.com/ninenines/cowboy.git synced 2025-07-14 12:20:24 +00:00

Use integer_to_binary when possible

This commit is contained in:
Loïc Hoguin 2016-08-11 11:53:05 +02:00
parent 699164fbdd
commit b75b0a6d4d
2 changed files with 2 additions and 2 deletions

View file

@ -862,7 +862,7 @@ commands(State=#state{socket=Socket, transport=Transport, streams=Streams}, Stre
case lists:keyfind(StreamID, #stream.id, Streams) of
#stream{version='HTTP/1.1'} ->
Size = iolist_size(Data),
Transport:send(Socket, [integer_to_list(Size, 16), <<"\r\n">>, Data, <<"\r\n">>]);
Transport:send(Socket, [integer_to_binary(Size, 16), <<"\r\n">>, Data, <<"\r\n">>]);
#stream{version='HTTP/1.0'} ->
Transport:send(Socket, Data)
end,

View file

@ -945,7 +945,7 @@ do_body_to_chunks(ChunkSize, Body, Acc) ->
false -> ChunkSize
end,
<< Chunk:ChunkSize2/binary, Rest/binary >> = Body,
ChunkSizeBin = list_to_binary(integer_to_list(ChunkSize2, 16)),
ChunkSizeBin = integer_to_binary(ChunkSize2, 16),
do_body_to_chunks(ChunkSize, Rest,
[<< ChunkSizeBin/binary, "\r\n", Chunk/binary, "\r\n" >>|Acc]).