Test impatient client sending body

This commit is contained in:
Chris Boden 2017-10-14 23:03:09 -04:00
parent a83a4e460a
commit 444d4b5b55

View File

@ -3,6 +3,10 @@ namespace Ratchet\Http;
use Ratchet\WebSocket\WsServerInterface; use Ratchet\WebSocket\WsServerInterface;
use Symfony\Component\Routing\Exception\ResourceNotFoundException; use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use Symfony\Component\Routing\Matcher\UrlMatcherInterface; use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Matcher\UrlMatcher;
/** /**
* @covers Ratchet\Http\Router * @covers Ratchet\Http\Router
@ -142,4 +146,18 @@ class RouterTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals('ws', $request->getUri()->getScheme()); $this->assertEquals('ws', $request->getUri()->getScheme());
$this->assertEquals('doesnt.matter', $request->getUri()->getHost()); $this->assertEquals('doesnt.matter', $request->getUri()->getHost());
} }
public function testImpatientClientOverflow() {
$header = "GET /nope HTTP/1.1
Upgrade: websocket
Connection: upgrade
Host: localhost
Origin: http://localhost
Sec-WebSocket-Version: 13\r\n\r\n";
$app = new HttpServer(new Router(new UrlMatcher(new RouteCollection, new RequestContext)));
$app->onOpen($this->_conn);
$app->onMessage($this->_conn, $header);
$app->onMessage($this->_conn, 'Silly body');
}
} }