Review Board 1.7.16

ARI: Fix WebSocket response when subprotocol isn't specified

Review Request #2828 - Created Sept. 6, 2013 and submitted

David Lee
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.
Used wscat and tshark to verify that the header is only present when

Connected using, which is what showed the problem in the
first place.
Review request changed
Updated (Sept. 13, 2013, 9:34 a.m.)
  • changed from pending to submitted
Committed in revision 399080 runs on a server provided by Digium, Inc. and uses bandwidth donated to the open source Asterisk community by API Digital Communications in Huntsville, AL USA.
Please report problems with this site to