commit
						3b6125c59c
					
				@ -8,6 +8,11 @@ CHANGELOG
 | 
			
		||||
 | 
			
		||||
---
 | 
			
		||||
 | 
			
		||||
* 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
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								LICENSE
									
									
									
									
									
								
							@ -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
 | 
			
		||||
 | 
			
		||||
@ -27,11 +27,12 @@
 | 
			
		||||
    }
 | 
			
		||||
  , "require": {
 | 
			
		||||
        "php": ">=5.4.2"
 | 
			
		||||
      , "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": "~4.8"
 | 
			
		||||
 | 
			
		||||
@ -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);
 | 
			
		||||
        }
 | 
			
		||||
@ -74,7 +75,7 @@ class App {
 | 
			
		||||
        $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);
 | 
			
		||||
 | 
			
		||||
@ -5,7 +5,7 @@ namespace Ratchet;
 | 
			
		||||
 * 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
 | 
			
		||||
 | 
			
		||||
@ -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 {
 | 
			
		||||
@ -16,7 +16,7 @@ trait CloseResponseTrait {
 | 
			
		||||
            'X-Powered-By' => \Ratchet\VERSION
 | 
			
		||||
        ], $additional_headers));
 | 
			
		||||
 | 
			
		||||
        $conn->send(gPsr\str($response));
 | 
			
		||||
        $conn->send(Message::toString($response));
 | 
			
		||||
        $conn->close();
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
@ -59,6 +59,6 @@ class HttpRequestParser implements MessageInterface {
 | 
			
		||||
     * @return \Psr\Http\Message\RequestInterface
 | 
			
		||||
     */
 | 
			
		||||
    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\Exception\MethodNotAllowedException;
 | 
			
		||||
use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 | 
			
		||||
use GuzzleHttp\Psr7 as gPsr;
 | 
			
		||||
use GuzzleHttp\Psr7\Query;
 | 
			
		||||
 | 
			
		||||
class Router implements HttpServerInterface {
 | 
			
		||||
    use CloseResponseTrait;
 | 
			
		||||
@ -61,9 +61,9 @@ class Router implements HttpServerInterface {
 | 
			
		||||
                $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);
 | 
			
		||||
 | 
			
		||||
@ -86,6 +86,7 @@ class Topic implements \IteratorAggregate, \Countable {
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    #[\ReturnTypeWillChange]
 | 
			
		||||
    public function getIterator() {
 | 
			
		||||
        return $this->subscribers;
 | 
			
		||||
    }
 | 
			
		||||
@ -93,6 +94,7 @@ class Topic implements \IteratorAggregate, \Countable {
 | 
			
		||||
    /**
 | 
			
		||||
     * {@inheritdoc}
 | 
			
		||||
     */
 | 
			
		||||
    #[\ReturnTypeWillChange]
 | 
			
		||||
    public function count() {
 | 
			
		||||
        return $this->subscribers->count();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -14,7 +14,7 @@ use Ratchet\RFC6455\Messaging\CloseFrameChecker;
 | 
			
		||||
use Ratchet\RFC6455\Handshake\ServerNegotiator;
 | 
			
		||||
use Ratchet\RFC6455\Handshake\RequestVerifier;
 | 
			
		||||
use React\EventLoop\LoopInterface;
 | 
			
		||||
use GuzzleHttp\Psr7 as gPsr;
 | 
			
		||||
use GuzzleHttp\Psr7\Message;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 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);
 | 
			
		||||
 | 
			
		||||
        $conn->send(gPsr\str($response));
 | 
			
		||||
        $conn->send(Message::toString($response));
 | 
			
		||||
 | 
			
		||||
        if (101 !== $response->getStatusCode()) {
 | 
			
		||||
            return $conn->close();
 | 
			
		||||
 | 
			
		||||
@ -11,6 +11,8 @@ use Symfony\Component\HttpFoundation\Session\Storage\Handler\NullSessionHandler;
 | 
			
		||||
 */
 | 
			
		||||
class SessionProviderTest extends AbstractMessageComponentTestCase {
 | 
			
		||||
    public function setUp() {
 | 
			
		||||
        return $this->markTestIncomplete('Test needs to be updated for ini_set issue in PHP 7.2');
 | 
			
		||||
 | 
			
		||||
        if (!class_exists('Symfony\Component\HttpFoundation\Session\Session')) {
 | 
			
		||||
            return $this->markTestSkipped('Dependency of Symfony HttpFoundation failed');
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user