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

David Lee reviewboard at asterisk.org
Fri Sep 6 15:39:43 CDT 2013


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

Review request for Asterisk Developers and Joshua Colp.


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/20130906/04031fdb/attachment-0001.htm>


More information about the asterisk-dev mailing list