... this afternoon I was just doing a little
interoperability testing around close... in my test-server I added
libwebsocket_close_and_free_session(this, wsi, LWS_CLOSE_STATUS_NORMAL);
in order to generate a server driven close.. I hope that was the right
way to go about it. In any event, in generated an invalid websocket
frame - I think you want this patch, or something like it:
Signed-off-by: \"Pat McManus @Mozilla\" <mcmanus@ducksong.com>
*/
if (wsi->close_reason) {
- buf[pre - 2] = wsi->close_reason >> 8;
- buf[pre - 1] = wsi->close_reason;
- pre += 2;
+ /* reason codes count as data bytes */
+ buf -= 2;
+ buf[0] = wsi->close_reason >> 8;
+ buf[1] = wsi->close_reason;
+ len += 2;
}
break;
}