File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -307,6 +307,8 @@ class Request extends \yii\base\Request
307307 * @var HeaderCollection Collection of request headers.
308308 */
309309 private $ _headers ;
310+ /** @var boolean Enable gzip inflate */
311+ public $ gzip = true ;
310312
311313
312314 /**
@@ -569,7 +571,15 @@ public function getIsFlash()
569571 public function getRawBody ()
570572 {
571573 if ($ this ->_rawBody === null ) {
572- $ this ->_rawBody = file_get_contents ('php://input ' );
574+ $ contentEncoding = $ this ->headers ->get ('Content-Encoding ' , '' );
575+ if (!empty ($ contentEncoding )) {
576+ $ contentEncoding = strtolower ($ contentEncoding );
577+ }
578+ if ($ this ->gzip && $ contentEncoding === 'gzip ' || $ contentEncoding === 'deflate ' ) {
579+ $ this ->_rawBody = gzinflate (file_get_contents ('php://input ' ));
580+ } else {
581+ $ this ->_rawBody = file_get_contents ('php://input ' );
582+ }
573583 }
574584
575585 return $ this ->_rawBody ;
You can’t perform that action at this time.
0 commit comments