Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/main/lib/web/http/ |
Upload File : |
<?php /** * Bitrix Framework * @package bitrix * @subpackage main * @copyright 2001-2023 Bitrix */ namespace Bitrix\Main\Web\Http; use Psr\Http\Message\ResponseInterface; use Psr\Http\Message\StreamInterface; class Response extends Message implements ResponseInterface { public function __construct(int $statusCode, array $headers = null, StreamInterface $body = null, string $version = null, string $reasonPhrase = '') { parent::__construct($headers, $body, $version); $this->headers->setStatus($statusCode, $reasonPhrase); } /** * @inheritdoc */ public function getStatusCode(): int { return $this->headers->getStatus(); } /** * @inheritdoc */ public function withStatus(int $code, string $reasonPhrase = ''): ResponseInterface { $new = clone $this; $new->headers->setStatus($code, $reasonPhrase); return $new; } /** * @inheritdoc */ public function getReasonPhrase(): string { return $this->headers->getReasonPhrase(); } /** * Adjusts the response headers after dechunking and decompressing the body. * @return void */ public function adjustHeaders(): void { // If a Client chooses to decompress the message body then it MUST also remove the Content-Encoding header and adjust the Content-Length header if (strtolower($this->headers->get('Content-Encoding') ?? '') == 'gzip') { $this->headers->delete('Content-Encoding'); if ($this->headers->has('Content-Length')) { $size = $this->body->getSize(); if ($size !== null) { $this->headers->set('Content-Length', $size); } else { $this->headers->delete('Content-Length'); } } } // Already dechunked if (strtolower($this->headers->get('Transfer-Encoding') ?? '') == 'chunked') { $this->headers->delete('Transfer-Encoding'); } } }