Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge remote-tracking branch 'ratchet/master' into v0.5 #946

Open
wants to merge 26 commits into
base: v0.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
2a6d3ab
Add Github actions so CI runs
simPod Jan 26, 2021
36983e1
Merge pull request #856 from simPod/ga
cboden Jan 26, 2021
a30da13
Add ReturnTypeWillChange attribute to silence PHP 8.1 deprecations
mbabker Jul 25, 2021
f1ddbc7
Create SECURITY.md
sartoshi-foot-dao Aug 31, 2021
5a83bd3
Add email addresses to SECURITY.md
mbonneau Aug 31, 2021
78fb27b
Merge pull request #900 from zidingz/patch-1
mbonneau Aug 31, 2021
d239e94
Support for PSR7 2.x
erikn69 Nov 30, 2021
c5920ac
Skip Session tests until ini_set issue resolved
cboden Dec 12, 2021
05b1e85
Replace futureTick for older versions
cboden Dec 12, 2021
6512da0
Lock minimum implicity dependency
cboden Dec 12, 2021
547c117
Merge pull request #896 from mbabker/patch-2
cboden Dec 12, 2021
c3c83ea
Merge branch 'erikn69-#922-support_psr7_2_0' into v0.4.4
cboden Dec 12, 2021
08480d1
Fix case on futureTick
cboden Dec 12, 2021
409139f
Added context to App facade constructor
Minifets Oct 20, 2017
3e97459
Update composer.json
Minifets Oct 20, 2017
5b01941
Revert "Update composer.json"
Oct 20, 2017
928854a
Merge branch 'Minifets-master' into v0.4.4
cboden Dec 12, 2021
3d18955
Use latest RFC6455 lib
cboden Dec 12, 2021
7f1cc6d
Add Symfony 6 support
frank9999 Dec 6, 2021
73937da
Merge pull request #926 from frank9999/symfony6
cboden Dec 12, 2021
6771d23
Update changelog and version
cboden Dec 14, 2021
274054c
Update licence
cboden Dec 14, 2021
3b6125c
Merge pull request #929 from ratchetphp/v0.4.4
cboden Dec 14, 2021
5012dc9
Format changelog
cboden Dec 14, 2021
face7f3
Merge remote-tracking branch 'ratchet/master' into v0.5
simPod Jan 12, 2022
4518b81
Fix VirtualSessionStorage signatures (still broken)
simPod Jan 12, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ CHANGELOG
* BC: `Ratchet\Session\Storage\Proxy\VirtualSessionStorage` requires `Ratchet\Session\OptionsHandler`
* `ComponentInterface::onError()` now accepts `Throwable` instead of `Exception`

* 0.4.4 (2021-12-11)
* Correct and update dependencies for forward compatibility
* Added context for React Socket server to App
* Use non-deprecated Guzzle API calls

* 0.4.3 (2020-06-04)
* BF: Fixed interface acceptable regression in `App`
* Update RFC6455 library with latest fixes
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2011-2020 Chris Boden
Copyright (c) 2011 Chris Boden

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
8 changes: 8 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Security Policy

## Reporting a Vulnerability

Please report security issues to:

* Chris Boden [cboden@gmail.com](cboden@gmail.com)
* Matt Bonneau [matt@bonneau.net](matt@bonneau.net)
9 changes: 5 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@
}
, "require": {
"php": "^7.3 || ^8.0"
, "ratchet/rfc6455": "^0.3"
, "ratchet/rfc6455": "^0.3.1"
, "react/socket": "^1.0 || ^0.8 || ^0.7 || ^0.6 || ^0.5"
, "guzzlehttp/psr7": "^1.0"
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0"
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0"
, "react/event-loop": ">=0.4"
, "guzzlehttp/psr7": "^1.7|^2.0"
, "symfony/http-foundation": "^2.6|^3.0|^4.0|^5.0|^6.0"
, "symfony/routing": "^2.6|^3.0|^4.0|^5.0|^6.0"
}
, "require-dev": {
"phpunit/phpunit": "^8.5",
Expand Down
5 changes: 3 additions & 2 deletions src/Ratchet/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ class App {
* @param int $port Port to listen on. If 80, assuming production, Flash on 843 otherwise expecting Flash to be proxied through 8843
* @param string $address IP address to bind to. Default is localhost/proxy only. '0.0.0.0' for any machine.
* @param LoopInterface $loop Specific React\EventLoop to bind the application to. null will create one for you.
* @param array $context
*/
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null) {
public function __construct($httpHost = 'localhost', $port = 8080, $address = '127.0.0.1', LoopInterface $loop = null, $context = array()) {
if (extension_loaded('xdebug') && getenv('RATCHET_DISABLE_XDEBUG_WARN') === false) {
trigger_error('XDebug extension detected. Remember to disable this if performance testing or going live!', E_USER_WARNING);
}
Expand All @@ -74,7 +75,7 @@ public function __construct($httpHost = 'localhost', $port = 8080, $address = '1
$this->httpHost = $httpHost;
$this->port = $port;

$socket = new Reactor($address . ':' . $port, $loop);
$socket = new Reactor($address . ':' . $port, $loop, $context);

$this->routes = new RouteCollection;
$this->_server = new IoServer(new HttpServer(new Router(new UrlMatcher($this->routes, new RequestContext))), $socket, $loop);
Expand Down
2 changes: 1 addition & 1 deletion src/Ratchet/ConnectionInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* The version of Ratchet being used
* @var string
*/
const VERSION = 'Ratchet/0.4.3';
const VERSION = 'Ratchet/0.4.4';

/**
* A proxy object representing a connection to the application
Expand Down
6 changes: 3 additions & 3 deletions src/Ratchet/Http/CloseResponseTrait.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php
namespace Ratchet\Http;
use Ratchet\ConnectionInterface;
use GuzzleHttp\Psr7 as gPsr;
use GuzzleHttp\Psr7\Message;
use GuzzleHttp\Psr7\Response;

trait CloseResponseTrait {
Expand All @@ -16,7 +16,7 @@ private function close(ConnectionInterface $conn, $code = 400, array $additional
'X-Powered-By' => \Ratchet\VERSION
], $additional_headers));

$conn->send(gPsr\str($response));
$conn->send(Message::toString($response));
$conn->close();
}
}
}
4 changes: 2 additions & 2 deletions src/Ratchet/Http/HttpRequestParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
namespace Ratchet\Http;
use Ratchet\MessageInterface;
use Ratchet\ConnectionInterface;
use GuzzleHttp\Psr7 as gPsr;
use GuzzleHttp\Psr7\Message;

/**
* This class receives streaming data from a client request
Expand Down Expand Up @@ -59,6 +59,6 @@ public function isEom($message) {
* @return \Psr\Http\Message\RequestInterface
*/
public function parse($headers) {
return gPsr\parse_request($headers);
return Message::parseRequest($headers);
}
}
6 changes: 3 additions & 3 deletions src/Ratchet/Http/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use Symfony\Component\Routing\Matcher\UrlMatcherInterface;
use Symfony\Component\Routing\Exception\MethodNotAllowedException;
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
use GuzzleHttp\Psr7 as gPsr;
use GuzzleHttp\Psr7\Query;
use Throwable;

class Router implements HttpServerInterface {
Expand Down Expand Up @@ -62,9 +62,9 @@ public function onOpen(ConnectionInterface $conn, RequestInterface $request = nu
$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->onOpen($conn, $request);
Expand Down
16 changes: 6 additions & 10 deletions src/Ratchet/Session/Storage/VirtualSessionStorage.php
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
<?php
namespace Ratchet\Session\Storage;
use Ratchet\Session\OptionsHandlerInterface;
use Symfony\Component\HttpFoundation\Session\Storage\MetadataBag;
use Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage;
use Ratchet\Session\Storage\Proxy\VirtualProxy;
use Ratchet\Session\Serialize\HandlerInterface;
use Symfony\Component\HttpFoundation\Session\Storage\Proxy\AbstractProxy;

class VirtualSessionStorage extends NativeSessionStorage {
/**
Expand All @@ -14,12 +15,7 @@ class VirtualSessionStorage extends NativeSessionStorage {
/** @var OptionsHandlerInterface */
private $optionsHandler;

/**
* @param \SessionHandlerInterface $handler
* @param string $sessionId The ID of the session to retrieve
* @param \Ratchet\Session\Serialize\HandlerInterface $serializer
*/
public function __construct(\SessionHandlerInterface $handler, $sessionId, HandlerInterface $serializer, OptionsHandlerInterface $optionsHandler) {
public function __construct(array $options = [], AbstractProxy|\SessionHandlerInterface $handler = null, MetadataBag $metaBag = null) {
$this->optionsHandler = $optionsHandler;
$this->setSaveHandler($handler);
$this->saveHandler->setId($sessionId);
Expand All @@ -30,7 +26,7 @@ public function __construct(\SessionHandlerInterface $handler, $sessionId, Handl
/**
* {@inheritdoc}
*/
public function start() {
public function start(): bool {
if ($this->started && !$this->closed) {
return true;
}
Expand All @@ -56,8 +52,8 @@ public function start() {
/**
* {@inheritdoc}
*/
public function regenerate($destroy = false, $lifetime = null) {
// .. ?
public function regenerate(bool $destroy = false, int $lifetime = null): bool {
return true;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Ratchet/Wamp/Topic.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,15 @@ public function remove(ConnectionInterface $conn) {
/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function getIterator() {
return $this->subscribers;
}

/**
* {@inheritdoc}
*/
#[\ReturnTypeWillChange]
public function count() {
return $this->subscribers->count();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Ratchet/WebSocket/WsServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
use Ratchet\RFC6455\Handshake\ServerNegotiator;
use Ratchet\RFC6455\Handshake\RequestVerifier;
use React\EventLoop\LoopInterface;
use GuzzleHttp\Psr7 as gPsr;
use GuzzleHttp\Psr7\Message;
use Throwable;

/**
Expand Down Expand Up @@ -117,7 +117,7 @@ public function onOpen(ConnectionInterface $conn, RequestInterface $request = nu

$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()) {
return $conn->close();
Expand Down