ASPLes / nopoll

OpenSource WebSocket toolkit
http://www.aspl.es/nopoll
GNU Lesser General Public License v2.1
126 stars 73 forks source link

Add support for ping with payload #42

Closed selvamKrish closed 6 years ago

selvamKrish commented 6 years ago

Ping with payload is not handled in Nopoll

As per https://tools.ietf.org/html/rfc6455#section-5.5.2 and https://tools.ietf.org/html/rfc6455#section-5.5.3, A ping frame may include payload/application data and the websocket library (nopoll) should respond with Pong frame with the same payload as the response.

Currently in nopoll here https://github.com/ASPLes/nopoll/blob/master/src/nopoll_conn.c#L3448, Ping frame is handled only when the payload size is 0.

This changes may support the above feature to respond pong frame with ping payload.

Review these changes and Please, let me know if it has any review comments or requires any other changes/modification.

selvamKrish commented 6 years ago

@francisbrosnan Any comment on this pull request?

francisbrosnan commented 6 years ago

Hello @selvamKrish Thanks for the patch and pointing the issue.

I've applied an updated version of the PR to avoid doing nopoll_log with application data received (which might cause memory problems, SEGFAULT, or even buffer memory problems with a carefully crafted application data that takes advantage of the fact that the payload will be processed by vprintf C API).

Latest commit here: https://github.com/ASPLes/nopoll/commit/4350ec4745ed475e333e84f9e7b1e1a2f77b796e

Best Regards.