Fixed up ResponseVerifier for PSR-7
This commit is contained in:
parent
b3501e27b3
commit
de76869847
@ -26,16 +26,19 @@ class ResponseVerifier {
|
|||||||
return ($status == 101);
|
return ($status == 101);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyUpgrade($upgrade) {
|
public function verifyUpgrade(array $upgrade) {
|
||||||
return (strtolower($upgrade) == "websocket");
|
return (in_array('websocket', array_map('strtolower', $upgrade)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifyConnection($connection) {
|
public function verifyConnection(array $connection) {
|
||||||
return (strtolower($connection) == "upgrade");
|
return (in_array('upgrade', array_map('strtolower', $connection)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function verifySecWebSocketAccept($swa, $key) {
|
public function verifySecWebSocketAccept($swa, $key) {
|
||||||
return ($swa == $this->sign($key));
|
return (
|
||||||
|
1 === count($swa) &&
|
||||||
|
1 === count($key) &&
|
||||||
|
$swa[0] == $this->sign($key[0]));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sign($key) {
|
public function sign($key) {
|
||||||
|
Loading…
Reference in New Issue
Block a user