diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-03-29 15:09:45 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-04-04 08:22:33 +0200 |
commit | 2a9192334eb6de56b55d5d9c1faab51ca2de2f9e (patch) | |
tree | f863432996152ab86993e1d5523ab836db0df3ca /lib/private/AppFramework | |
parent | 51bcb0bbe196a82f17ccd67022dcef3a4b7573c1 (diff) | |
download | nextcloud-server-2a9192334eb6de56b55d5d9c1faab51ca2de2f9e.tar.gz nextcloud-server-2a9192334eb6de56b55d5d9c1faab51ca2de2f9e.zip |
Don't try to parse empty body if there is no body
Fixes #3890
If we do a put request without a body the current code still tries to
read the body. This patch makes sure that we do not try to read the body
if the content length is 0.
See RFC 2616 Section 4.3
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/private/AppFramework')
-rw-r--r-- | lib/private/AppFramework/Http/Request.php | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/private/AppFramework/Http/Request.php b/lib/private/AppFramework/Http/Request.php index fd43d468568..3f1e6fd951a 100644 --- a/lib/private/AppFramework/Http/Request.php +++ b/lib/private/AppFramework/Http/Request.php @@ -401,6 +401,8 @@ class Request implements \ArrayAccess, \Countable, IRequest { protected function getContent() { // If the content can't be parsed into an array then return a stream resource. if ($this->method === 'PUT' + && $this->getHeader('Content-Length') !== 0 + && $this->getHeader('Content-Length') !== null && strpos($this->getHeader('Content-Type'), 'application/x-www-form-urlencoded') === false && strpos($this->getHeader('Content-Type'), 'application/json') === false ) { |