From cb6f580d0221e0a8a7dc45a86635729f0f9f99fe Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 9 Jun 2013 11:10:22 -0400 Subject: [PATCH] Guzzle 3.6 conformance Updated inheritance class to match API change Use new Guzzle Header class when searching for values Lock Ratchet into using Guzzle 3.6 to future-proof --- Guzzle/Http/Message/RequestFactory.php | 2 +- WsServer.php | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) 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);