diff --git a/lib/client-parser.c b/lib/client-parser.c index e548b4f0..b6b592b3 100644 --- a/lib/client-parser.c +++ b/lib/client-parser.c @@ -382,7 +382,7 @@ spill: } } #endif - if (eff_buf.token_len <= 0) + if (eff_buf.token_len <= 0 && callback_action != LWS_CALLBACK_CLIENT_RECEIVE_PONG) goto already_done; eff_buf.token[eff_buf.token_len] = '\0'; diff --git a/lib/output.c b/lib/output.c index 990cc6c2..173cda49 100644 --- a/lib/output.c +++ b/lib/output.c @@ -569,8 +569,8 @@ do_more_inside_frame: send_raw: #if 0 - lwsl_debug("send %ld: ", len + post); - lwsl_hexdump(&buf[-pre], len + post); + lwsl_debug("send %ld: ", len + pre + post); + lwsl_hexdump(&buf[-pre], len + pre + post); #endif switch (protocol) { diff --git a/lib/parsers.c b/lib/parsers.c index 0502f703..dcf1cdce 100644 --- a/lib/parsers.c +++ b/lib/parsers.c @@ -670,8 +670,13 @@ handle_first: wsi->lws_rx_parse_state = LWS_RXPS_07_COLLECT_FRAME_KEY_1; else - wsi->lws_rx_parse_state = + if (wsi->u.ws.rx_packet_length) + wsi->lws_rx_parse_state = LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; + else { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; + goto spill; + } break; } break; @@ -779,8 +784,10 @@ handle_first: wsi->lws_rx_parse_state = LWS_RXPS_PAYLOAD_UNTIL_LENGTH_EXHAUSTED; wsi->u.ws.frame_mask_index = 0; - if (wsi->u.ws.rx_packet_length == 0) + if (wsi->u.ws.rx_packet_length == 0) { + wsi->lws_rx_parse_state = LWS_RXPS_NEW; goto spill; + } break;