404

[ Avaa Bypassed ]




Upload:

Command:

botdev@18.223.3.50: ~ $
<?php

namespace React\Socket;

use React\EventLoop\LoopInterface;
use React\Promise;
use BadMethodCallException;
use InvalidArgumentException;
use UnexpectedValueException;

final class SecureConnector implements ConnectorInterface
{
    private $connector;
    private $streamEncryption;
    private $context;

    public function __construct(ConnectorInterface $connector, LoopInterface $loop, array $context = array())
    {
        $this->connector = $connector;
        $this->streamEncryption = new StreamEncryption($loop, false);
        $this->context = $context;
    }

    public function connect($uri)
    {
        if (!function_exists('stream_socket_enable_crypto')) {
            return Promise\reject(new BadMethodCallException('Encryption not supported on your platform (HHVM < 3.8?)')); // @codeCoverageIgnore
        }

        if (strpos($uri, '://') === false) {
            $uri = 'tls://' . $uri;
        }

        $parts = parse_url($uri);
        if (!$parts || !isset($parts['scheme']) || $parts['scheme'] !== 'tls') {
            return Promise\reject(new InvalidArgumentException('Given URI "' . $uri . '" is invalid'));
        }

        $uri = str_replace('tls://', '', $uri);
        $context = $this->context;

        $encryption = $this->streamEncryption;
        return $this->connector->connect($uri)->then(function (ConnectionInterface $connection) use ($context, $encryption) {
            // (unencrypted) TCP/IP connection succeeded

            if (!$connection instanceof Connection) {
                $connection->close();
                throw new UnexpectedValueException('Base connector does not use internal Connection class exposing stream resource');
            }

            // set required SSL/TLS context options
            foreach ($context as $name => $value) {
                stream_context_set_option($connection->stream, 'ssl', $name, $value);
            }

            // try to enable encryption
            return $encryption->enable($connection)->then(null, function ($error) use ($connection) {
                // establishing encryption failed => close invalid connection and return error
                $connection->close();
                throw $error;
            });
        });
    }
}

Filemanager

Name Type Size Permission Actions
Connection.php File 5.61 KB 0644
ConnectionInterface.php File 4.32 KB 0644
Connector.php File 4.2 KB 0644
ConnectorInterface.php File 2.01 KB 0644
DnsConnector.php File 3.6 KB 0644
FixedUriConnector.php File 1.02 KB 0644
LimitingServer.php File 6.39 KB 0644
SecureConnector.php File 2.21 KB 0644
SecureServer.php File 6.45 KB 0644
Server.php File 1.83 KB 0644
ServerInterface.php File 5.13 KB 0644
StreamEncryption.php File 4.69 KB 0644
TcpConnector.php File 4.16 KB 0644
TcpServer.php File 7.39 KB 0644
TimeoutConnector.php File 570 B 0644
UnixConnector.php File 1.11 KB 0644
UnixServer.php File 3.48 KB 0644