[WebSocket] Fixing name spacing and a bug
Fixing the namespacing for the Guzzle response and the bug was the if statement should have been outside the loop.
This commit is contained in:
parent
f6fef1a390
commit
f4c1cb110f
@ -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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user