Revert BC breaks to ServerNegotiator

This commit is contained in:
Matt Bonneau 2017-09-10 15:10:54 -04:00
parent 2d10201b00
commit 78b7137627
2 changed files with 6 additions and 9 deletions

View File

@ -13,15 +13,12 @@ class ServerNegotiator implements NegotiatorInterface {
*/
private $verifier;
private $_supportedSubProtocols;
private $_supportedSubProtocols = [];
private $_strictSubProtocols;
private $_strictSubProtocols = false;
public function __construct(RequestVerifier $requestVerifier, array $supportedSubProtocols = [], $strictSubProtocol = false) {
public function __construct(RequestVerifier $requestVerifier) {
$this->verifier = $requestVerifier;
$this->_supportedSubProtocols = $supportedSubProtocols;
$this->_strictSubProtocols = $strictSubProtocol;
}
/**
@ -130,7 +127,6 @@ class ServerNegotiator implements NegotiatorInterface {
/**
* @param array $protocols
* @deprecated
*/
function setSupportedSubProtocols(array $protocols) {
$this->_supportedSubProtocols = array_flip($protocols);
@ -143,7 +139,6 @@ class ServerNegotiator implements NegotiatorInterface {
* @todo Consider extending this interface and moving this there.
* The spec does says the server can fail for this reason, but
* it is not a requirement. This is an implementation detail.
* @deprecated
*/
function setStrictSubProtocolCheck($enable) {
$this->_strictSubProtocols = (boolean)$enable;

View File

@ -111,7 +111,9 @@ Accept-Language: en-US,en;q=0.8';
}
public function testBadSubprotocolResponse() {
$negotiator = new ServerNegotiator(new RequestVerifier(), [], true);
$negotiator = new ServerNegotiator(new RequestVerifier());
$negotiator->setStrictSubProtocolCheck(true);
$negotiator->setSupportedSubProtocols([]);
$requestText = 'GET / HTTP/1.1
Host: 127.0.0.1:6789