diff --git a/src/Ratchet/Component/WebSocket/Version/Hixie76.php b/src/Ratchet/Component/WebSocket/Version/Hixie76.php index e2034d8..5f2bf5b 100644 --- a/src/Ratchet/Component/WebSocket/Version/Hixie76.php +++ b/src/Ratchet/Component/WebSocket/Version/Hixie76.php @@ -34,7 +34,7 @@ class Hixie76 implements VersionInterface { , 'Sec-WebSocket-Location' => 'ws://' . $request->getHeader('Host') . $request->getPath() ); - $response = new \Guzzle\Http\Message\Response('101', $headers, $body); + $response = new Response('101', $headers, $body); $response->setStatus('101', 'WebSocket Protocol Handshake'); return $response; diff --git a/src/Ratchet/Component/WebSocket/Version/RFC6455.php b/src/Ratchet/Component/WebSocket/Version/RFC6455.php index 9d3c82d..1c31cd5 100644 --- a/src/Ratchet/Component/WebSocket/Version/RFC6455.php +++ b/src/Ratchet/Component/WebSocket/Version/RFC6455.php @@ -41,7 +41,7 @@ class RFC6455 implements VersionInterface { , 'Sec-WebSocket-Accept' => $this->sign($request->getHeader('Sec-WebSocket-Key')) ); - return new \Guzzle\Http\Message\Response('101', $headers); + return new Response('101', $headers); } /** diff --git a/src/Ratchet/Component/WebSocket/WebSocketComponent.php b/src/Ratchet/Component/WebSocket/WebSocketComponent.php index b4775a0..454128d 100644 --- a/src/Ratchet/Component/WebSocket/WebSocketComponent.php +++ b/src/Ratchet/Component/WebSocket/WebSocketComponent.php @@ -82,13 +82,13 @@ class WebSocketComponent implements MessageComponentInterface { // This block is to be moved/changed later $agreed_protocols = array(); $requested_protocols = $from->WebSocket->headers->getTokenizedHeader('Sec-WebSocket-Protocol', ','); - - foreach ($this->accepted_subprotocols as $sub_protocol) { - if (null !== $requested_protocols && false !== $requested_protocols->hasValue($sub_protocol)) { - $agreed_protocols[] = $sub_protocol; + if (null !== $requested_protocols) { + foreach ($this->accepted_subprotocols as $sub_protocol) { + if (false !== $requested_protocols->hasValue($sub_protocol)) { + $agreed_protocols[] = $sub_protocol; + } } } - if (count($agreed_protocols) > 0) { $response->setHeader('Sec-WebSocket-Protocol', implode(',', $agreed_protocols)); }