Merge branch 'erikn69-#922-support_psr7_2_0' into v0.4.4
# Conflicts: # composer.json
This commit is contained in:
commit
c3c83ea4c0
@ -30,7 +30,7 @@
|
|||||||
, "ratchet/rfc6455": "^0.3"
|
, "ratchet/rfc6455": "^0.3"
|
||||||
, "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
|
, "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
|
||||||
, "react/event-loop": ">=0.4"
|
, "react/event-loop": ">=0.4"
|
||||||
, "guzzlehttp/psr7": "^1.0"
|
, "guzzlehttp/psr7": "^1.7|^2.0"
|
||||||
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0"
|
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0"
|
||||||
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0"
|
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0"
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Ratchet\Http;
|
namespace Ratchet\Http;
|
||||||
use Ratchet\ConnectionInterface;
|
use Ratchet\ConnectionInterface;
|
||||||
use GuzzleHttp\Psr7 as gPsr;
|
use GuzzleHttp\Psr7\Message;
|
||||||
use GuzzleHttp\Psr7\Response;
|
use GuzzleHttp\Psr7\Response;
|
||||||
|
|
||||||
trait CloseResponseTrait {
|
trait CloseResponseTrait {
|
||||||
@ -16,7 +16,7 @@ trait CloseResponseTrait {
|
|||||||
'X-Powered-By' => \Ratchet\VERSION
|
'X-Powered-By' => \Ratchet\VERSION
|
||||||
], $additional_headers));
|
], $additional_headers));
|
||||||
|
|
||||||
$conn->send(gPsr\str($response));
|
$conn->send(Message::toString($response));
|
||||||
$conn->close();
|
$conn->close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
namespace Ratchet\Http;
|
namespace Ratchet\Http;
|
||||||
use Ratchet\MessageInterface;
|
use Ratchet\MessageInterface;
|
||||||
use Ratchet\ConnectionInterface;
|
use Ratchet\ConnectionInterface;
|
||||||
use GuzzleHttp\Psr7 as gPsr;
|
use GuzzleHttp\Psr7\Message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This class receives streaming data from a client request
|
* This class receives streaming data from a client request
|
||||||
@ -59,6 +59,6 @@ class HttpRequestParser implements MessageInterface {
|
|||||||
* @return \Psr\Http\Message\RequestInterface
|
* @return \Psr\Http\Message\RequestInterface
|
||||||
*/
|
*/
|
||||||
public function parse($headers) {
|
public function parse($headers) {
|
||||||
return gPsr\parse_request($headers);
|
return Message::parseRequest($headers);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ use Psr\Http\Message\RequestInterface;
|
|||||||
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
|
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
|
||||||
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
|
||||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
|
||||||
use GuzzleHttp\Psr7 as gPsr;
|
use GuzzleHttp\Psr7\Query;
|
||||||
|
|
||||||
class Router implements HttpServerInterface {
|
class Router implements HttpServerInterface {
|
||||||
use CloseResponseTrait;
|
use CloseResponseTrait;
|
||||||
@ -61,9 +61,9 @@ class Router implements HttpServerInterface {
|
|||||||
$parameters[$key] = $value;
|
$parameters[$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$parameters = array_merge($parameters, gPsr\parse_query($uri->getQuery() ?: ''));
|
$parameters = array_merge($parameters, Query::parse($uri->getQuery() ?: ''));
|
||||||
|
|
||||||
$request = $request->withUri($uri->withQuery(gPsr\build_query($parameters)));
|
$request = $request->withUri($uri->withQuery(Query::build($parameters)));
|
||||||
|
|
||||||
$conn->controller = $route['_controller'];
|
$conn->controller = $route['_controller'];
|
||||||
$conn->controller->onOpen($conn, $request);
|
$conn->controller->onOpen($conn, $request);
|
||||||
|
@ -14,7 +14,7 @@ use Ratchet\RFC6455\Messaging\CloseFrameChecker;
|
|||||||
use Ratchet\RFC6455\Handshake\ServerNegotiator;
|
use Ratchet\RFC6455\Handshake\ServerNegotiator;
|
||||||
use Ratchet\RFC6455\Handshake\RequestVerifier;
|
use Ratchet\RFC6455\Handshake\RequestVerifier;
|
||||||
use React\EventLoop\LoopInterface;
|
use React\EventLoop\LoopInterface;
|
||||||
use GuzzleHttp\Psr7 as gPsr;
|
use GuzzleHttp\Psr7\Message;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The adapter to handle WebSocket requests/responses
|
* The adapter to handle WebSocket requests/responses
|
||||||
@ -116,7 +116,7 @@ class WsServer implements HttpServerInterface {
|
|||||||
|
|
||||||
$response = $this->handshakeNegotiator->handshake($request)->withHeader('X-Powered-By', \Ratchet\VERSION);
|
$response = $this->handshakeNegotiator->handshake($request)->withHeader('X-Powered-By', \Ratchet\VERSION);
|
||||||
|
|
||||||
$conn->send(gPsr\str($response));
|
$conn->send(Message::toString($response));
|
||||||
|
|
||||||
if (101 !== $response->getStatusCode()) {
|
if (101 !== $response->getStatusCode()) {
|
||||||
return $conn->close();
|
return $conn->close();
|
||||||
|
Loading…
Reference in New Issue
Block a user