Fix requested changes on PR

This commit is contained in:
Matt Bonneau 2017-09-12 22:33:33 -04:00
parent 78b7137627
commit 8128af799a
3 changed files with 4 additions and 16 deletions

View File

@ -17,4 +17,4 @@ before_script:
- sh tests/ab/run_ab_tests.sh
script:
- phpunit
- vendor/bin/phpunit

View File

@ -62,13 +62,7 @@ class ServerNegotiator implements NegotiatorInterface {
'Sec-WebSocket-Protocol' => implode(', ', $this->_supportedSubProtocols)
];
if (true !== $this->verifier->verifyUpgradeRequest($request->getHeader('Upgrade'))) {
return new Response(
426,
$upgradeSuggestion,
null,
'1.1',
'Upgrade header MUST be provided'
);
return new Response(426, $upgradeSuggestion, null, '1.1', 'Upgrade header MUST be provided');
}
if (true !== $this->verifier->verifyConnection($request->getHeader('Connection'))) {
@ -80,12 +74,6 @@ class ServerNegotiator implements NegotiatorInterface {
}
if (true !== $this->verifier->verifyVersion($request->getHeader('Sec-WebSocket-Version'))) {
/*
* https://tools.ietf.org/html/rfc7230#section-6.7
* A server that sends a 426 (Upgrade Required) response MUST send an
* Upgrade header field to indicate the acceptable protocols, in order
* of descending preference
*/
return new Response(426, $upgradeSuggestion);
}
@ -99,7 +87,7 @@ class ServerNegotiator implements NegotiatorInterface {
}, null);
if ($this->_strictSubProtocols && null === $match) {
return new Response(426, $upgradeSuggestion);
return new Response(426, $upgradeSuggestion, null, '1.1', 'No Sec-WebSocket-Protocols requested supported');
}
if (null !== $match) {

View File

@ -136,7 +136,7 @@ Accept-Language: en-US,en;q=0.8';
$this->assertEquals('1.1', $response->getProtocolVersion());
$this->assertEquals(426, $response->getStatusCode());
$this->assertEquals('Upgrade Required', $response->getReasonPhrase());
$this->assertEquals('No Sec-WebSocket-Protocols requested supported', $response->getReasonPhrase());
$this->assertEquals('Upgrade', $response->getHeaderLine('Connection'));
$this->assertEquals('websocket', $response->getHeaderLine('Upgrade'));
$this->assertEquals('13', $response->getHeaderLine('Sec-WebSocket-Version'));