Send ZIP64 CDR Locator (Central Directory Record Locator) record.

@return void
178669
protected function addCdr64Locator(): void
    {
        $cdr_offset = $this->ofs->add($this->cdr_ofs);

        $fields = [
            ['V', static::ZIP64_CDR_LOCATOR_SIGNATURE], // ZIP64 end of central file header signature
            ['V', 0x00],                                // Disc number containing CDR64EOF
            ['P', $cdr_offset],                         // CDR offset
            ['V', 1],                                   // Total number of disks
        ];

        $ret = static::packFields($fields);
        $this->send($ret);
    }
1262042
public function sendHeaders()
    {
        deprecationWarning(
            'Will be removed in 4.0.0'
        );

        $file = $line = null;
        if (headers_sent($file, $line)) {
            Log::warning("Headers already sent in {$file}:{$line}");

            return;
        }

        $codeMessage = $this->_statusCodes[$this->_status];
        $this->_setCookies();
        $this->_sendHeader("{$this->_protocol} {$this->_status} {$codeMessage}");
        $this->_setContentType();

        foreach ($this->headers as $header => $values) {
            foreach ((array)$values as $value) {
                $this->_sendHeader($header, $value);
            }
        }
    }
1229173
public function send()
    {
        $this->sendContentOptions();
        $this->sendFrameOptions();
        $this->sendXssProtection();
        $this->sendStrictTransport();
        $this->sendAccessControlAllowOrigin();
        $this->sendContentSecurity();
    }
1226600
private function fileCompress()
    {
        if ($this->file && $this->file->getTmp()) {
            $compression = $this->file->getCompression();
            if ($compression && in_array($compression, ['tar.gz', 'tar.bz2', 'zip'])) {
                // Discern new tmp file name (with compression applied).
                $target   = $this->fileGenerateTmp($compression);
                $fileName = $this->getFileName();
                try {
                    switch ($compression) {
                        case 'tar.gz':
                            $phar = new \PharData($target);
                            $phar->addFile($this->file->getTmp(), $fileName);
                            $phar->compress(\Phar::GZ, $compression);
                            $target = $phar->getRealPath();
                            break;

                        case 'tar.bz2':
                            $phar = new \PharData($target);
                            $phar->addFile($this->file->getTmp(), $fileName);
                            $phar->compress(\Phar::BZ2, $compression);
                            $target = $phar->getRealPath();
                            break;

                        default:
                        case 'zip':
                            $zip = new \ZipArchive();
                            if (true !== $zip->open($target, \ZipArchive::CREATE)) {
                                throw new ContactClientException(
                                    'Cound not open zip '.$target,
                                    Codes::HTTP_INTERNAL_SERVER_ERROR,
                                    null,
                                    Stat::TYPE_ERROR,
                                    false
                                );
                            }
                            $zip->addFile($this->file->getTmp(), $fileName);
                            $zip->close();
                            break;
                    }
                    $this->file->setTmp($target);
                    $this->setLogs($target, 'fileCompressed');
                } catch (\Exception $e) {
                    throw new ContactClientException(
                        'Could not create compressed file '.$target,
                        Codes::HTTP_INTERNAL_SERVER_ERROR,
                        $e,
                        Stat::TYPE_ERROR,
                        false
                    );
                }
            } else {
                $this->setLogs(false, 'fileCompressed');
            }
        }

        return $this;
    }
46223
protected function sendContent()
    {
        $body = $this->getBody();
        if (!$body->isReadable()) {
            throw new \RuntimeException('Unable to send content: body stream is not readable.');
        }

        set_time_limit(0); // Reset time limit for big files
        $chunkSize = 8 * 1024 * 1024; // 8MB per chunk

        if (is_array($this->bodyRange)) {
            [$begin, $end] = $this->bodyRange;

            if (!$body->isSeekable()) {
                throw new \RuntimeException('Unable to send content in range: body stream is not seekable.');
            }

            $body->seek($begin);
            while (!$body->eof() && ($pos = $body->tell()) <= $end) {
                if ($pos + $chunkSize > $end) {
                    $chunkSize = $end - $pos + 1;
                }
                echo $body->read($chunkSize);
                flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit.
            }
            $body->close();
        } else {
            if ($body->isSeekable()) {
                $body->seek(0);
            }
            while (!$body->eof()) {
                echo $body->read($chunkSize);
                flush(); // Free up memory. Otherwise large files will trigger PHP's memory limit.
            }
            $body->close();
            return;
        }
    }
420775
protected function sendCacheControlHeader()
	{
		if(Yii::app()->session->isStarted)
		{
			Yii::app()->session->setCacheLimiter('public');
			header('Pragma:',true);
		}
		header('Cache-Control: '.$this->cacheControl,true);
	}
1070186
public function send(): void
    {
        $body = $this->getBody();

        $this->sendCookies();

        switch (true) {
            case 'CLI' === $this->type:
                // no CLI response
                return;
            case null === $body:
            case StatusCode::NO_CONTENT === $this->getStatusCode():
                $response = new EmptyResponse($this->getStatusCode(), $this->getHeaders());
                break;
            case StatusCode::MOVED_PERMANENTLY === $this->getStatusCode():
            case StatusCode::FOUND === $this->getStatusCode():
                $response = new RedirectResponse(
                    $this->getHeader('Location'),
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'JSON' === $this->type:
                // JSON response
                // setup messages
                if (Messages::count()) {
                    $this->setHeader('Bluz-Notify', json_encode(Messages::popAll()));
                }

                // encode body data to JSON
                $response = new JsonResponse(
                    $body,
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'FILE' === $this->type:
                // File attachment
                $response = new AttachmentResponse(
                    $this->body->getData()->get('FILE'),
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
            case 'HTML' === $this->type:
            default:
                // HTML response
                $response = new HtmlResponse(
                    (string)$body,
                    $this->getStatusCode(),
                    $this->getHeaders()
                );
                break;
        }

        $emitter = new SapiEmitter();
        $emitter->emit($response);
    }
91425
protected function createOrGetZip()
    {
        if (!isset($this->zip)) {
            $this->zip = new \ZipArchive();
            $zipFilePath = $this->getZipFilePath();

            $this->zip->open($zipFilePath, \ZipArchive::CREATE|\ZipArchive::OVERWRITE);
        }

        return $this->zip;
    }
232740
public function sendResponse()
    {
        $xml =& CKFinder_Connector_Core_Factory::getInstance("Core_Xml");
        $this->_connectorNode =& $xml->getConnectorNode();

        $this->checkConnector();
        if ($this->mustCheckRequest()) {
            $this->checkRequest();
        }

        $resourceTypeName = $this->_currentFolder->getResourceTypeName();
        if (!empty($resourceTypeName)) {
            $this->_connectorNode->addAttribute("resourceType", $this->_currentFolder->getResourceTypeName());
        }

        if ($this->mustAddCurrentFolderNode()) {
            $_currentFolder = new Ckfinder_Connector_Utils_XmlNode("CurrentFolder");
            $this->_connectorNode->addChild($_currentFolder);
            $_currentFolder->addAttribute("path", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($this->_currentFolder->getClientPath()));

            $this->_errorHandler->setCatchAllErros(true);
            $_url = $this->_currentFolder->getUrl();
            $_currentFolder->addAttribute("url", is_null($_url) ? "" : CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($_url));
            $this->_errorHandler->setCatchAllErros(false);

            $_currentFolder->addAttribute("acl", $this->_currentFolder->getAclMask());
        }

        $this->buildXml();

        $_oErrorNode =& $xml->getErrorNode();
        $_oErrorNode->addAttribute("number", "0");

        echo $this->_connectorNode->asXML();
        exit;
    }
1352857
void sendDirectory(HttpRequest request,
                       HttpResponse response,
                       Resource resource,
                       boolean parent)
        throws IOException
    {
        if (!_dirAllowed)
        {
            response.sendError(HttpResponse.__403_Forbidden);
            return;
        }
        
        request.setHandled(true);
        
        if(log.isDebugEnabled())log.debug("sendDirectory: "+resource);
        byte[] data=null;
        if (resource instanceof CachedResource)
            data=((CachedResource)resource).getCachedData();
        
        if (data==null)
        {
            String base = URI.addPaths(request.getPath(),"/");
            String dir = resource.getListHTML(URI.encodePath(base),parent);
            if (dir==null)
            {
                response.sendError(HttpResponse.__403_Forbidden,
                                   "No directory");
                return;
            }
            data=dir.getBytes("UTF8");
            if (resource instanceof CachedResource)
                ((CachedResource)resource).setCachedData(data);
        }
        
        response.setContentType("text/html; charset=UTF8");
        response.setContentLength(data.length);
        
        if (request.getMethod().equals(HttpRequest.__HEAD))
        {
            response.commit();
            return;
        }
        
        response.getOutputStream().write(data,0,data.length);
        response.commit();
    }
1155765
public function addFileHeader(): void
    {
        $name = static::filterFilename($this->name);

        // calculate name length
        $nameLength = strlen($name);

        // create dos timestamp
        $time = static::dosTime($this->opt->getTime()->getTimestamp());

        $comment = $this->opt->getComment();

        if (!mb_check_encoding($name, 'ASCII') ||
            !mb_check_encoding($comment, 'ASCII')) {
            // Sets Bit 11: Language encoding flag (EFS).  If this bit is set,
            // the filename and comment fields for this file
            // MUST be encoded using UTF-8. (see APPENDIX D)
            if (!mb_check_encoding($name, 'UTF-8') ||
                !mb_check_encoding($comment, 'UTF-8')) {
                throw new EncodingException(
                    'File name and comment should use UTF-8 ' .
                    'if one of them does not fit into ASCII range.'
                );
            }
            $this->bits |= self::BIT_EFS_UTF8;
        }

        if ($this->method->equals(Method::DEFLATE())) {
            $this->version = Version::DEFLATE();
        }

        $force = (boolean)($this->bits & self::BIT_ZERO_HEADER) &&
            $this->zip->opt->isEnableZip64();

        $footer = $this->buildZip64ExtraBlock($force);

        // If this file will start over 4GB limit in ZIP file,
        // CDR record will have to use Zip64 extension to describe offset
        // to keep consistency we use the same value here
        if ($this->zip->ofs->isOver32()) {
            $this->version = Version::ZIP64();
        }

        $fields = [
            ['V', ZipStream::FILE_HEADER_SIGNATURE],
            ['v', $this->version->getValue()],      // Version needed to Extract
            ['v', $this->bits],                     // General purpose bit flags - data descriptor flag set
            ['v', $this->method->getValue()],       // Compression method
            ['V', $time],                           // Timestamp (DOS Format)
            ['V', $this->crc],                      // CRC32 of data (0 -> moved to data descriptor footer)
            ['V', $this->zlen->getLowFF($force)],   // Length of compressed data (forced to 0xFFFFFFFF for zero header)
            ['V', $this->len->getLowFF($force)],    // Length of original data (forced to 0xFFFFFFFF for zero header)
            ['v', $nameLength],                     // Length of filename
            ['v', strlen($footer)],                 // Extra data (see above)
        ];

        // pack fields and calculate "total" length
        $header = ZipStream::packFields($fields);

        // print header and filename
        $data = $header . $name . $footer;
        $this->zip->send($data);

        // save header length
        $this->hlen = Bigint::init(strlen($data));
    }
452430
public function get_zip()
	{
		// Is there any data to return?
		if ($this->entries === 0)
		{
			return FALSE;
		}

		return $this->zipdata
			.$this->directory."\x50\x4b\x05\x06\x00\x00\x00\x00"
			.pack('v', $this->entries) // total # of entries "on this disk"
			.pack('v', $this->entries) // total # of entries overall
			.pack('V', strlen($this->directory)) // size of central dir
			.pack('V', strlen($this->zipdata)) // offset to start of central dir
			."\x00\x00"; // .zip file comment length
	}
1026596
public function send()
  {
    if (!array_key_exists($this->code, Status::CODE)) return false;

    if ($this->with !== null || $this->with !== []) {
      $data = array_merge(isset($_SESSION['application']['with']) ? $_SESSION['application']['with'] : [], $this->with);
      $_SESSION['application']['with'] = $data;
    }

    header('Location: ' . $this->url);
    exit;
  }
803651
public function send()
    {

        // Set some defaults
        $extension = null;
        $returnImage = $this->_absoluteImagePath;

        // If the GD extension is not available
        if (!extension_loaded('gd') && (!function_exists('dl') || !dl('gd.so'))) {
            $this->_addErrorHeader(\Tollwerk\Squeezr\Exception::GD_UNAVAILABLE_MSG,
                \Tollwerk\Squeezr\Exception::GD_UNAVAILABLE);

            // If the cache directory doesn't exist or is not writable: Error
        } elseif ((!@is_dir($this->_absoluteCacheImageDir) && !@mkdir($this->_absoluteCacheImageDir, 0777,
                    true)) || !@is_writable($this->_absoluteCacheImageDir)
        ) {
            $this->_addErrorHeader(\Tollwerk\Squeezr\Exception::INVALID_TARGET_CACHE_DIRECTORY_MSG,
                \Tollwerk\Squeezr\Exception::INVALID_TARGET_CACHE_DIRECTORY);

            // If the squeezr screen cookie is not available or invalid
        } elseif (empty($_COOKIE['squeezr_screen']) || !preg_match("%^(\d+)x(\d+)\@(\d+(?:\.\d+)?)$%",
                $_COOKIE['squeezr_screen'], $squeezr)
        ) {
            $this->_addErrorHeader(\Tollwerk\Squeezr\Exception::MISSING_METRICS_COOKIE_MSG,
                \Tollwerk\Squeezr\Exception::MISSING_METRICS_COOKIE);

            // Copy & resample original image
        } else {
            $errors = array();
            $returnImage = $this->squeeze($this->_absoluteImagePath, $this->_absoluteCacheImagePath, SQUEEZR_BREAKPOINT,
                $errors);
            foreach ($errors as $errNo => $errMsg) {
                $this->_addErrorHeader(sprintf($errMsg, $this->_relativeImagePath), $errNo);
            }
        }

        // Send the image along with it's HTTP headers
        $extension = ($extension === null) ? pathinfo($returnImage, PATHINFO_EXTENSION) : $extension;
        $this->_sendFile($returnImage, 'image/'.((strtolower($extension) == 'jpg') ? 'jpeg' : strtolower($extension)),
            true);
        exit;
    }
230067
protected function write(array $record)
    {
        if (!self::$sendHeaders) {
            return;
        }

        // WildFire-specific headers must be sent prior to any messages
        if (!self::$initialized) {
            self::$initialized = true;

            self::$sendHeaders = $this->headersAccepted();
            if (!self::$sendHeaders) {
                return;
            }

            foreach ($this->getInitHeaders() as $header => $content) {
                $this->sendHeader($header, $content);
            }
        }

        $header = $this->createRecordHeader($record);
        if (trim(current($header)) !== '') {
            $this->sendHeader(key($header), current($header));
        }
    }
705388
private function getZipper()
    {
        $app = $this->app;
        return function($last, MiddlewareInterface $middleware) use ($app) {
            return $app->make(DelegateInterface::class, [$middleware, $last]);
        };
    }
1374697
public function clear_data()
	{
		$this->zipdata = '';
		$this->directory = '';
		$this->entries = 0;
		$this->file_num = 0;
		$this->offset = 0;
		return $this;
	}