Skip to content

Commit d545a2e

Browse files
author
Martijn Croonen
committed
The client only sends on protocol version per handshake!
1 parent 1def343 commit d545a2e

File tree

1 file changed

+2
-16
lines changed

1 file changed

+2
-16
lines changed

App/Net/WebSocketConnection.php

+2-16
Original file line numberDiff line numberDiff line change
@@ -405,22 +405,8 @@ protected function parseHandshake()
405405
/**
406406
* The Sec-WebSocket-Version is a non-optional part of the opening handshake and should
407407
* have a value from $m_aAcceptedVersions. We don't support all versions of the protocol
408-
* First build an array of versions accepted by the client*/
409-
$aClientVersions = explode(',', $this -> getHeader('Sec-WebSocket-Version'));
410-
411-
/* Trim values */
412-
array_map('trim', $aClientVersions);
413-
414-
/* Get in common values. The protocols that appear first in the $m_aAcceptedVersions array
415-
* have the preference. */
416-
$aInCommomVersions = array_intersect($this -> m_aAcceptedVersions, $aClientVersions);
417-
418-
/* Look for a match */
419-
if (count($aInCommomVersions) > 0)
420-
{
421-
$sProtocolVersion = $aInCommomVersions[0];
422-
}
423-
else
408+
*/
409+
if (array_key_exists($this -> getHeader('Sec-WebSocket-Version'), $this -> m_aAcceptedVersions))
424410
{
425411
/* Close the connection if none is supported and include the accepted versions
426412
* in the message so the client can retry with on of those. */

0 commit comments

Comments
 (0)