Stream HTTPRequest responses only of a maximum length is desired
authorTim Düsterhus <duesterhus@woltlab.com>
Mon, 1 Feb 2021 10:37:09 +0000 (11:37 +0100)
committerTim Düsterhus <duesterhus@woltlab.com>
Mon, 1 Feb 2021 10:37:09 +0000 (11:37 +0100)
cURL is not supported for streaming responses. As we process the full response
body for requests without a maximum length there is no benefit to streaming the
response, because we lose cURL support.

wcfsetup/install/files/lib/util/HTTPRequest.class.php

index 11aa2c611e85651829fca7e19f74db9e84d1b670..efcc294c20c076623623e598ead5c7e35f7baef8 100644 (file)
@@ -173,8 +173,10 @@ final class HTTPRequest {
                                'track_redirects' => true,
                                'on_redirect' => $redirectHandler,
                        ],
-                       'stream' => true,
                ];
+               if (isset($this->options['maxLength'])) {
+                       $options['stream'] = true;
+               }
                if (isset($this->options['auth'])) {
                        $options['auth'] = [
                                $this->options['auth']['username'],