!C99Shell v. 2.1 [PHP 8 Update] [02.02.2022]!

Software: Apache/2.4.53 (Unix) OpenSSL/1.1.1o PHP/7.4.29 mod_perl/2.0.12 Perl/v5.34.1. PHP/7.4.29 

uname -a: Linux vps-2738122-x 4.15.0-213-generic #224-Ubuntu SMP Mon Jun 19 13:30:12 UTC 2023 x86_64 

uid=1(daemon) gid=1(daemon) grupos=1(daemon) 

Safe-mode: OFF (not secure)

/opt/apex_led/php/vendor/guzzlehttp/ringphp/tests/Client/   drwxrwxr-x
Free 11.55 GB of 61.93 GB (18.65%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     CurlMultiHandlerTest.php (5.38 KB)      -rwxrwxr-x
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace GuzzleHttp\Tests\Ring\Client;

use 
GuzzleHttp\Ring\Client\CurlMultiHandler;

class 
CurlMultiHandlerTest extends \PHPUnit_Framework_TestCase
{
    public function 
testSendsRequest()
    {
        
Server::enqueue([['status' => 200]]);
        
$a = new CurlMultiHandler();
        
$response $a([
            
'http_method' => 'GET',
            
'headers'     => ['host' => [Server::$host]],
        ]);
        
$this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray'$response);
        
$this->assertEquals(200$response['status']);
        
$this->assertArrayHasKey('transfer_stats'$response);
        
$realUrl trim($response['transfer_stats']['url'], '/');
        
$this->assertEquals(trim(Server::$url'/'), $realUrl);
        
$this->assertArrayHasKey('effective_url'$response);
        
$this->assertEquals(
            
trim(Server::$url'/'),
            
trim($response['effective_url'], '/')
        );
    }

    public function 
testCreatesErrorResponses()
    {
        
$url 'http://localhost:123/';
        
$a = new CurlMultiHandler();
        
$response $a([
            
'http_method' => 'GET',
            
'headers'     => ['host' => ['localhost:123']],
        ]);
        
$this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray'$response);
        
$this->assertNull($response['status']);
        
$this->assertNull($response['reason']);
        
$this->assertEquals([], $response['headers']);
        
$this->assertArrayHasKey('error'$response);
        
$this->assertContains('cURL error '$response['error']->getMessage());
        
$this->assertArrayHasKey('transfer_stats'$response);
        
$this->assertEquals(
            
trim($url'/'),
            
trim($response['transfer_stats']['url'], '/')
        );
        
$this->assertArrayHasKey('effective_url'$response);
        
$this->assertEquals(
            
trim($url'/'),
            
trim($response['effective_url'], '/')
        );
    }

    public function 
testSendsFuturesWhenDestructed()
    {
        
Server::enqueue([['status' => 200]]);
        
$a = new CurlMultiHandler();
        
$response $a([
            
'http_method' => 'GET',
            
'headers'     => ['host' => [Server::$host]],
        ]);
        
$this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray'$response);
        
$a->__destruct();
        
$this->assertEquals(200$response['status']);
    }

    public function 
testCanSetMaxHandles()
    {
        
$a = new CurlMultiHandler(['max_handles' => 2]);
        
$this->assertEquals(2$this->readAttribute($a'maxHandles'));
    }

    public function 
testCanSetSelectTimeout()
    {
        
$a = new CurlMultiHandler(['select_timeout' => 2]);
        
$this->assertEquals(2$this->readAttribute($a'selectTimeout'));
    }

    public function 
testSendsFuturesWhenMaxHandlesIsReached()
    {
        
$request = [
            
'http_method' => 'PUT',
            
'headers'     => ['host' => [Server::$host]],
            
'future'      => 'lazy'// passing this to control the test
        
];
        
$response = ['status' => 200];
        
Server::flush();
        
Server::enqueue([$response$response$response]);
        
$a = new CurlMultiHandler(['max_handles' => 3]);
        for (
$i 0$i 5$i++) {
            
$responses[] = $a($request);
        }
        
$this->assertCount(3Server::received());
        
$responses[3]->cancel();
        
$responses[4]->cancel();
    }

    public function 
testCanCancel()
    {
        
Server::flush();
        
$response = ['status' => 200];
        
Server::enqueue(array_fill_keys(range(010), $response));
        
$a = new CurlMultiHandler();
        
$responses = [];

        for (
$i 0$i 10$i++) {
            
$response $a([
                
'http_method' => 'GET',
                
'headers'     => ['host' => [Server::$host]],
                
'future'      => 'lazy',
            ]);
            
$response->cancel();
            
$responses[] = $response;
        }

        
$this->assertCount(0Server::received());

        foreach (
$responses as $response) {
            
$this->assertTrue($this->readAttribute($response'isRealized'));
        }
    }

    public function 
testCannotCancelFinished()
    {
        
Server::flush();
        
Server::enqueue([['status' => 200]]);
        
$a = new CurlMultiHandler();
        
$response $a([
            
'http_method' => 'GET',
            
'headers'     => ['host' => [Server::$host]],
        ]);
        
$response->wait();
        
$response->cancel();
    }

    public function 
testDelaysInParallel()
    {
        
Server::flush();
        
Server::enqueue([['status' => 200]]);
        
$a = new CurlMultiHandler();
        
$expected microtime(true) + (100 1000);
        
$response $a([
            
'http_method' => 'GET',
            
'headers'     => ['host' => [Server::$host]],
            
'client'      => ['delay' => 100],
        ]);
        
$response->wait();
        
$this->assertGreaterThanOrEqual($expectedmicrotime(true));
    }

    public function 
testSendsNonLazyFutures()
    {
        
$request = [
            
'http_method' => 'GET',
            
'headers'     => ['host' => [Server::$host]],
            
'future'      => true,
        ];
        
Server::flush();
        
Server::enqueue([['status' => 202]]);
        
$a = new CurlMultiHandler();
        
$response $a($request);
        
$this->assertInstanceOf('GuzzleHttp\Ring\Future\FutureArray'$response);
        
$this->assertEquals(202$response['status']);
    }
}

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.1 [PHP 8 Update] [02.02.2022] maintained byC99Shell Github | Generation time: 0.7832 ]--