diff --git a/PHPDaemon/Servers/WebSocket/Connection.php b/PHPDaemon/Servers/WebSocket/Connection.php index 914b2316..d39dc6bc 100644 --- a/PHPDaemon/Servers/WebSocket/Connection.php +++ b/PHPDaemon/Servers/WebSocket/Connection.php @@ -393,7 +393,7 @@ protected function httpProcessHeaders() { if (!isset($this->server['HTTP_CONNECTION']) || (!preg_match('~(?:^|\W)Upgrade(?:\W|$)~i', $this->server['HTTP_CONNECTION'])) // "Upgrade" is not always alone (ie. "Connection: Keep-alive, Upgrade") || !isset($this->server['HTTP_UPGRADE']) - || (strtolower($this->server['HTTP_UPGRADE']) !== 'websocket') // Lowercase compare important + || (strtolower($this->server['HTTP_UPGRADE']) !== 'websocket') // Lowercase comparison iss important ) { $this->finish(); return false; diff --git a/PHPDaemon/SockJS/Methods/Websocket.php b/PHPDaemon/SockJS/Methods/Websocket.php new file mode 100644 index 00000000..877d7452 --- /dev/null +++ b/PHPDaemon/SockJS/Methods/Websocket.php @@ -0,0 +1,30 @@ + + */ +class Websocket extends Generic { + protected $contentType = 'text/plain'; + + /** + * Constructor + * @return void + */ + public function init() { + $this->header('426 Upgrade Required'); + $this->finish(); + } + + /** + * Called when request iterated + * @return void + */ + public function run() {} +}