<p style="white-space: pre-wrap; word-wrap: break-word;">OK this is turning into something of a rabbithole!</p><p style="white-space: pre-wrap; word-wrap: break-word;">Some things I don't understand:</p><ul><li>the documentation for ast_websocket_read (and ast_websocket_readingstring) state: "Once an AST_WEBSOCKET_OPCODE_CLOSE opcode is received the socket will be closed". Am I to understand this is not true, and we don't want it to be?</li></ul><ul><li>the documentation also states that the caller is responsible for freeing the payload, but I don't think that's true either. From what I understand we have a session->payload whose alllocation is managed internally by ast_websocket_read. By the looks of it we keep appending data onto session->payload .. until we receive a frame with a zero payload length? The returned "payload" is set to point to the start of session->payload.</li></ul><p style="white-space: pre-wrap; word-wrap: break-word;">To be honest the handling of fragmented data looks rather brittle, if we receive a PONG in the middle of a fragmented message (which is allowed according RFC 6455) I'm pretty sure we end up with a corrupt payload.</p><p><a href="https://gerrit.asterisk.org/10861">View Change</a></p><ul style="list-style: none; padding: 0;"></ul><p>To view, visit <a href="https://gerrit.asterisk.org/10861">change 10861</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10861"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-MessageType: comment </div>
<div style="display:none"> Gerrit-Change-Id: Icb1b60205fc77ee970ddc91d1f545671781344cf </div>
<div style="display:none"> Gerrit-Change-Number: 10861 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Jeremy Lainé <jeremy.laine@m4x.org> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation (1000185) </div>
<div style="display:none"> Gerrit-Reviewer: Jeremy Lainé <jeremy.laine@m4x.org> </div>
<div style="display:none"> Gerrit-Reviewer: Joshua C. Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Sean Bright <sean.bright@gmail.com> </div>
<div style="display:none"> Gerrit-Comment-Date: Tue, 15 Jan 2019 19:28:54 +0000 </div>
<div style="display:none"> Gerrit-HasComments: No </div>
<div style="display:none"> Gerrit-HasLabels: No </div>