From 6b2b156c94bf6673ab77c6b2e1dce375b7497926 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 23 Jul 2020 13:59:01 +0200 Subject: [PATCH] Fix possible response truncation in HTTPRequest on Windows --- wcfsetup/install/files/lib/util/HTTPRequest.class.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/util/HTTPRequest.class.php b/wcfsetup/install/files/lib/util/HTTPRequest.class.php index 27c84c7a29..5fb4cabaf8 100644 --- a/wcfsetup/install/files/lib/util/HTTPRequest.class.php +++ b/wcfsetup/install/files/lib/util/HTTPRequest.class.php @@ -190,7 +190,10 @@ final class HTTPRequest { $request = new Request($this->options['method'], $this->url, $headers, $this->body); try { - $this->response = $client->send($request); + $this->response = $client->send($request, [ + // https://github.com/guzzle/guzzle/issues/2735 + 'sink' => fopen("php://temp", "w+"), + ]); } catch (TooManyRedirectsException $e) { throw new HTTPException( @@ -269,7 +272,7 @@ final class HTTPRequest { if ($this->replyBody === null) { $bodyLength = 0; while (!$this->response->getBody()->eof()) { - $toRead = 1024; + $toRead = 8192; if (isset($this->options['maxLength'])) { $toRead = min($toRead, $this->options['maxLength'] - $bodyLength); } -- 2.20.1