Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion framework/web/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,8 @@ class Request extends \yii\base\Request
* @var HeaderCollection Collection of request headers.
*/
private $_headers;
/** @var boolean Enable gzip inflate */
public $gzip = true;


/**
Expand Down Expand Up @@ -569,7 +571,15 @@ public function getIsFlash()
public function getRawBody()
{
if ($this->_rawBody === null) {
$this->_rawBody = file_get_contents('php://input');
$contentEncoding = $this->headers->get('Content-Encoding', '');
if (!empty($contentEncoding)) {
$contentEncoding = strtolower($contentEncoding);
}
if ($this->gzip && $contentEncoding === 'gzip' || $contentEncoding === 'deflate') {
$this->_rawBody = gzinflate(file_get_contents('php://input'));
} else {
$this->_rawBody = file_get_contents('php://input');
}
}

return $this->_rawBody;
Expand Down