URI verification
Added code in handshake to verify the URI Updated unit testing to reflect this
This commit is contained in:
parent
5c5f9e558f
commit
feb6c5ab57
@ -49,10 +49,18 @@ class HandshakeVerifier {
|
|||||||
/**
|
/**
|
||||||
* @param string
|
* @param string
|
||||||
* @return bool
|
* @return bool
|
||||||
* @todo Implement this functionality
|
* @todo Verify the logic here is correct
|
||||||
*/
|
*/
|
||||||
public function verifyRequestURI($val) {
|
public function verifyRequestURI($val) {
|
||||||
return true;
|
if ($val[0] != '/') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (false !== strstr($val, '#')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return mb_check_encoding($val, 'ASCII');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,12 +57,13 @@ class HandshakeVerifierTest extends \PHPUnit_Framework_TestCase {
|
|||||||
$this->assertEquals($expected, $this->_v->verifyHTTPVersion($in));
|
$this->assertEquals($expected, $this->_v->verifyHTTPVersion($in));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @todo Add failing values in here
|
|
||||||
*/
|
|
||||||
public static function uRIProvider() {
|
public static function uRIProvider() {
|
||||||
return array(
|
return array(
|
||||||
array(true, '/chat')
|
array(true, '/chat')
|
||||||
|
, array(true, '/hello/world?key=val')
|
||||||
|
, array(false, '/chat#bad')
|
||||||
|
, array(false, 'nope')
|
||||||
|
, array(false, '/ ಠ_ಠ ')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -70,8 +71,6 @@ class HandshakeVerifierTest extends \PHPUnit_Framework_TestCase {
|
|||||||
* @dataProvider URIProvider
|
* @dataProvider URIProvider
|
||||||
*/
|
*/
|
||||||
public function testRequestUri($expected, $in) {
|
public function testRequestUri($expected, $in) {
|
||||||
return $this->markTestIncomplete('Method this test is testing is incomplete');
|
|
||||||
|
|
||||||
$this->assertEquals($expected, $this->_v->verifyRequestURI($in));
|
$this->assertEquals($expected, $this->_v->verifyRequestURI($in));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user