reactphp / socket

Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP.
https://reactphp.org/socket/
MIT License
1.2k stars 156 forks source link

[Security] Response size limitation #282

Closed ziaratban closed 2 years ago

ziaratban commented 2 years ago

Hi

How can i limit the size of the response from the client to prevent a ddos ​​attack?

For example, after sending a client more than 100 bytes, the connection must be disconnected.

https://github.com/ratchetphp/Ratchet/issues/892

clue commented 2 years ago

@ziaratban Thanks for bringing this up, but it's kind of hard to give useful information with this little information. What response are we talking about and what kind of DDoS are we talking about?

If you want to close the connection, you can simply call $connection->close(). If you want to close the connection after sending some data (such as 100 bytes), you may call $connection->end($data) together with a possible time out handling logic to also call close().

I believe this has been answered, so I'm closing this for now. Please come back with more details if this problem persists and we can always reopen this :+1:

ziaratban commented 2 years ago

@clue thanks. I thinks It's better to continue this issue in https://github.com/ratchetphp/Ratchet/issues/892