[WebSocket] Fixed missing request headers bug

Accidentally removed HTTP request headers from connections
Added them back
This commit is contained in:
Chris Boden 2012-06-14 16:07:16 -04:00
parent 49d68ba7df
commit 5d1cabc751
3 changed files with 5 additions and 3 deletions

View File

@ -71,7 +71,7 @@ class SessionProvider implements MessageComponentInterface, WsServerInterface {
* {@inheritdoc}
*/
function onOpen(ConnectionInterface $conn) {
if (null === ($id = $conn->WebSocket->headers->getCookie(ini_get('session.name')))) {
if (null === ($id = $conn->WebSocket->request->getCookie(ini_get('session.name')))) {
$saveHandler = $this->_null;
$id = '';
} else {

View File

@ -93,7 +93,9 @@ class WsServer implements MessageComponentInterface {
return $this->close($from);
}
$from->WebSocket->request = $request;
$from->WebSocket->version = $this->versioner->getVersion($request);
$response = $from->WebSocket->version->handshake($request);
$response->setHeader('X-Powered-By', \Ratchet\VERSION);

View File

@ -67,7 +67,7 @@ class SessionProviderTest extends \PHPUnit_Framework_TestCase {
$headers->expects($this->once())->method('getCookie', array(ini_get('session.name')))->will($this->returnValue($sessionId));
$connection->WebSocket = new \StdClass;
$connection->WebSocket->headers = $headers;
$connection->WebSocket->request = $headers;
$component->onOpen($connection);
@ -83,7 +83,7 @@ class SessionProviderTest extends \PHPUnit_Framework_TestCase {
$headers->expects($this->once())->method('getCookie', array(ini_get('session.name')))->will($this->returnValue(null));
$conns[$i]->WebSocket = new \StdClass;
$conns[$i]->WebSocket->headers = $headers;
$conns[$i]->WebSocket->request = $headers;
}
$mock = new MockComponent;