ASPLes / nopoll

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

PING frame is not handled properly in function "nopoll_conn_get_msg" #31

Closed jackyzy823 closed 7 years ago

jackyzy823 commented 7 years ago

After receiving PING frame from server ,the nopoll websockets client will just shutdown in function nopoll_conn_get_msg (line 3378 of npoll_conn.c) , when the payload_size of PING frame is 0 .

Some code handling PING frame (however this code will never work in case of the closed connection) in function nopoll_conn_read (line 3851 of npoll_conn.c) could be moved to function nopoll_conn_get_msg before line 3378` to handle PING frame properly.

jackyzy823 commented 7 years ago

FYI: in RFC6455:

5.5.2. Ping The Ping frame contains an opcode of 0x9. A Ping frame MAY include "Application data".

francisbrosnan commented 7 years ago

Hi @jackyzy823, thanks for reporting. I've pushed some changes to support pings with cero payload. Also added reg-test (test_02-b). Best Regards