Skip to content

Commit f8abda0

Browse files
committed
Added 'websocket' SockJS method which returns 426 Upgrade Required
1 parent 029d323 commit f8abda0

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

PHPDaemon/Servers/WebSocket/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ protected function httpProcessHeaders() {
393393
if (!isset($this->server['HTTP_CONNECTION'])
394394
|| (!preg_match('~(?:^|\W)Upgrade(?:\W|$)~i', $this->server['HTTP_CONNECTION'])) // "Upgrade" is not always alone (ie. "Connection: Keep-alive, Upgrade")
395395
|| !isset($this->server['HTTP_UPGRADE'])
396-
|| (strtolower($this->server['HTTP_UPGRADE']) !== 'websocket') // Lowercase compare important
396+
|| (strtolower($this->server['HTTP_UPGRADE']) !== 'websocket') // Lowercase comparison iss important
397397
) {
398398
$this->finish();
399399
return false;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
namespace PHPDaemon\SockJS\Methods;
3+
4+
use PHPDaemon\Core\Daemon;
5+
use PHPDaemon\Core\Debug;
6+
use PHPDaemon\Utils\Crypt;
7+
8+
/**
9+
* @package Libraries
10+
* @subpackage SockJS
11+
* @author Vasily Zorin <[email protected]>
12+
*/
13+
class Websocket extends Generic {
14+
protected $contentType = 'text/plain';
15+
16+
/**
17+
* Constructor
18+
* @return void
19+
*/
20+
public function init() {
21+
$this->header('426 Upgrade Required');
22+
$this->finish();
23+
}
24+
25+
/**
26+
* Called when request iterated
27+
* @return void
28+
*/
29+
public function run() {}
30+
}

0 commit comments

Comments
 (0)