���� JFIF �� � ( %"1"%)+...383,7(-.-
![]() Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20 System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64 User : apache ( 48) PHP Version : 7.4.20 Disable Function : NONE Directory : /var/www/html/vidoe.top/proxy/logs/curl/tests/PHPCurlClass/ |
<?php namespace RangeHeader; class RangeHeader { private $first_byte; private $last_byte; private $filesize; private $is_valid = true; public function __construct($http_range_header, $file_path) { // Simulate basic support for the Content-Range header. preg_match('/bytes=(\d+)?-(\d+)?/', $http_range_header, $matches); $this->first_byte = isset($matches['1']) ? (int)$matches['1'] : null; $this->last_byte = isset($matches['2']) ? (int)$matches['2'] : null; $this->filesize = filesize($file_path); // Start position begins after end of file. if ($this->first_byte >= $this->filesize) { $this->is_valid = false; } // "If the last-byte-pos value is present, it MUST be greater than or equal to the first-byte-pos in that // byte-range-spec, or the byte- range-spec is syntactically invalid." if (!($this->last_byte === null) && !($this->last_byte >= $this->first_byte)) { $this->is_valid = false; } } public function getFirstBytePosition() { if ($this->first_byte === null) { return $this->filesize - 1 - $this->last_byte; } return $this->first_byte; } public function getLastBytePosition() { if ($this->last_byte === null) { return $this->filesize - 1; } return $this->last_byte; } public function getLength() { return $this->getLastBytePosition() - $this->getFirstBytePosition() + 1; } public function getByteRangeSpec() { return $this->is_valid ? $this->getFirstBytePosition() . '-' . $this->getLastBytePosition() : '*'; } public function getContentRangeHeader() { return 'bytes ' . $this->getByteRangeSpec() . '/' . $this->filesize; } public function isValid() { return $this->is_valid; } }