diff --git a/Guzzle/Http/Message/RequestFactory.php b/Guzzle/Http/Message/RequestFactory.php index c1f6b45..64b6302 100644 --- a/Guzzle/Http/Message/RequestFactory.php +++ b/Guzzle/Http/Message/RequestFactory.php @@ -7,7 +7,7 @@ class RequestFactory extends GuzzleRequestFactory { /** * {@inheritdoc} */ - public function create($method, $url, $headers = null, $body = '') { + public function create($method, $url, $headers = null, $body = '', array $options = array()) { $c = $this->entityEnclosingRequestClass; $request = new $c($method, $url, $headers); $request->setBody(EntityBody::factory($body)); diff --git a/WsServer.php b/WsServer.php index 281f16c..dbc8104 100644 --- a/WsServer.php +++ b/WsServer.php @@ -117,9 +117,10 @@ class WsServer implements MessageComponentInterface { return; } - // This needs to be refactored later on, incorporated with routing - if ('' !== ($agreedSubProtocols = $this->getSubProtocolString($from->WebSocket->request->getTokenizedHeader('Sec-WebSocket-Protocol', ',')))) { - $response->setHeader('Sec-WebSocket-Protocol', $agreedSubProtocols); + if (null !== ($subHeader = $from->WebSocket->request->getHeader('Sec-WebSocket-Protocol'))) { + if ('' !== ($agreedSubProtocols = $this->getSubProtocolString($subHeader->normalize()))) { + $response->setHeader('Sec-WebSocket-Protocol', $agreedSubProtocols); + } } $response->setHeader('X-Powered-By', \Ratchet\VERSION);