[WebSocket] Fixed Hixie handshake bug (for real this time)

refs #80
This commit is contained in:
Chris Boden 2013-03-31 14:02:10 -04:00
parent 6140c94a33
commit 3030c81f03
2 changed files with 1 additions and 11 deletions

View File

@ -103,13 +103,7 @@ class Hixie76 implements VersionInterface {
}
public function generateKeyNumber($key) {
if (0 === substr_count($key, ' ')) {
return '';
}
$int = (int)preg_replace('[\D]', '', $key) / substr_count($key, ' ');
return (is_int($int)) ? $int : '';
return preg_replace('[\D]', '', $key) / substr_count($key, ' ');
}
protected function sign($key1, $key2, $code) {

View File

@ -31,11 +31,7 @@ class Hixie76Test extends \PHPUnit_Framework_TestCase {
public static function keyProvider() {
return array(
array(179922739, '17 9 G`ZD9 2 2b 7X 3 /r90')
, array('', '17 9 G`ZD9 2 2b 7X 3 /r91')
, array(906585445, '3e6b263 4 17 80')
, array('', '3e6b263 4 17 80')
, array('', '3e6b63 4 17 80')
, array('', '3e6b6341780')
);
}