[Http] Cleanup and parse error fix

This commit is contained in:
Chris Boden 2013-04-27 16:51:24 -04:00
parent 38df976768
commit 1ea0bd3255
2 changed files with 7 additions and 10 deletions

View File

@ -3,13 +3,10 @@ namespace Ratchet\Http;
use Ratchet\MessageComponentInterface; use Ratchet\MessageComponentInterface;
use Ratchet\ConnectionInterface; use Ratchet\ConnectionInterface;
use Guzzle\Http\Message\Response; use Guzzle\Http\Message\Response;
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
use Symfony\Component\Routing\RequestContext;
use Symfony\Component\Routing\Matcher\UrlMatcher;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
/**
* @todo Detect HTTP proxy header IP, re-map remoteAddress
*/
class HttpServer implements MessageComponentInterface { class HttpServer implements MessageComponentInterface {
/** /**
* Buffers incoming HTTP requests returning a Guzzle Request when coalesced * Buffers incoming HTTP requests returning a Guzzle Request when coalesced
@ -26,8 +23,8 @@ class HttpServer implements MessageComponentInterface {
/** /**
* @param HttpServerInterface * @param HttpServerInterface
*/ */
public function __construct(HttpServerInterface $server) { public function __construct(HttpServerInterface $component) {
$this->_httpServer = $server; $this->_httpServer = $component;
$this->_reqParser = new HttpRequestParser; $this->_reqParser = new HttpRequestParser;
} }
@ -83,7 +80,7 @@ class HttpServer implements MessageComponentInterface {
* Close a connection with an HTTP response * Close a connection with an HTTP response
* @param \Ratchet\ConnectionInterface $conn * @param \Ratchet\ConnectionInterface $conn
* @param int $code HTTP status code * @param int $code HTTP status code
* @return void * @return null
*/ */
protected function close(ConnectionInterface $conn, $code = 400) { protected function close(ConnectionInterface $conn, $code = 400) {
$response = new Response($code, array( $response = new Response($code, array(

View File

@ -4,7 +4,7 @@
$loop = new React\EventLoop\StreamSelectLoop; $loop = new React\EventLoop\StreamSelectLoop;
$sock = new React\Socket\Server($loop); $sock = new React\Socket\Server($loop);
$web = new Ratchet\WebSocket\WsServer(new Ratchet\Tests\AbFuzzyServer) $web = new Ratchet\WebSocket\WsServer(new Ratchet\Tests\AbFuzzyServer);
$app = new Ratchet\Http\HttpServer($web); $app = new Ratchet\Http\HttpServer($web);
$web->setEncodingChecks(false); $web->setEncodingChecks(false);