[asterisk-dev] [Code Review] 2828: ARI: Fix WebSocket response when subprotocol isn't specified

svnbot reviewboard at asterisk.org
Fri Sep 13 09:18:43 CDT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2828/
-----------------------------------------------------------

(Updated Sept. 13, 2013, 9:18 a.m.)


Status
------

This change has been marked as submitted.


Review request for Asterisk Developers and Joshua Colp.


Changes
-------

Committed in revision 399039


Bugs: ASTERISK-22441
    https://issues.asterisk.org/jira/browse/ASTERISK-22441


Repository: Asterisk


Description
-------

When I moved the ARI WebSocket from /ws to /ari/events, I added code to
allow a WebSocket to connect without specifying the subprotocol if
there's only one subprotocol handler registered for the WebSocket.

Naively, I coded it to always respond with the subprotocol in use.
Unfortunately, according to RFC 6455, if the server's response includes
a subprotocol header field that "indicates the use of a subprotocol that
was not present in the client's handshake [...], the client MUST _Fail
the WebSocket Connection_.", emphasis theirs.

This patch correctly omits the Sec-WebSocket-Protocol if one is not
specified by the client.


Diffs
-----

  /branches/12/res/res_http_websocket.c 398509 

Diff: https://reviewboard.asterisk.org/r/2828/diff/


Testing
-------

Used wscat and tshark to verify that the header is only present when
needed.

Connected using Autobahn.py, which is what showed the problem in the
first place.


Thanks,

David Lee

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130913/247bfcb8/attachment.htm>


More information about the asterisk-dev mailing list