Open Speedkore opened 7 years ago
The server/client should fragment the packets.
I'm doing this to avoid a malicious attack from the client side that eats all the memory of the server, sending a large bunch of data. How do i tell the server to fragment packets when receiving them? or it's just enough what i did to avoid this kind of attack?
Thanks a lot for the response , you made a great library and it works very well!!
i had to modify the source code in my way to limit big transfers, how could i do it in a right way? i never receive fragment packets or anything, if i send for example a file of 100MB it is done in one step by Socket.Web.recv() in memory
this is what i did, in file web.ex, line 577:
@spec recv(t, boolean, non_neg_integer, Keyword.t) :: { :ok, binary } | { :error, error } defp recv(%W{socket: socket, version: 13}, mask, length, options) do length = cond do length == 127 -> case socket |> Socket.Stream.recv(8, options) do { :ok, << length :: 64 >> } -> if length > 5_000_000 do {:error, :transfer_too_large} else length end