Fix HEAD requests with `accept-encoding` header set
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 9 Oct 2020 13:47:20 +0000 (15:47 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 9 Oct 2020 13:47:20 +0000 (15:47 +0200)
This backports the change in guzzle/guzzle#2804.

wcfsetup/install/files/lib/system/api/composer.lock
wcfsetup/install/files/lib/system/api/composer/installed.json
wcfsetup/install/files/lib/system/api/guzzlehttp/guzzle/src/Handler/CurlFactory.php

index 399dc02aecb74c9a3d7a11b64a7a56040ef50ffe..86b3664373f24331c47658c9ced69f610d789680 100644 (file)
             "source": {
                 "type": "git",
                 "url": "https://github.com/WoltLab/guzzle",
-                "reference": "2d4592a12d3d6757f9969122730e69d6b7c82af0"
+                "reference": "40e0ba7d933ec47237adb4f35ba363c3d8ffe453"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/WoltLab/guzzle/zipball/2d4592a12d3d6757f9969122730e69d6b7c82af0",
-                "reference": "2d4592a12d3d6757f9969122730e69d6b7c82af0",
+                "url": "https://api.github.com/repos/WoltLab/guzzle/zipball/40e0ba7d933ec47237adb4f35ba363c3d8ffe453",
+                "reference": "40e0ba7d933ec47237adb4f35ba363c3d8ffe453",
                 "shasum": ""
             },
             "require": {
                 "rest",
                 "web service"
             ],
-            "time": "2020-09-30T10:06:20+00:00"
+            "time": "2020-10-09T13:06:06+00:00"
         },
         {
             "name": "guzzlehttp/promises",
index 0cc5f5690e2fcf74e936a87be54b8bc2d40028e7..9b678851b0529c933670709d24ca5fdc00ac6315 100644 (file)
         "source": {
             "type": "git",
             "url": "https://github.com/WoltLab/guzzle",
-            "reference": "2d4592a12d3d6757f9969122730e69d6b7c82af0"
+            "reference": "40e0ba7d933ec47237adb4f35ba363c3d8ffe453"
         },
         "dist": {
             "type": "zip",
-            "url": "https://api.github.com/repos/WoltLab/guzzle/zipball/2d4592a12d3d6757f9969122730e69d6b7c82af0",
-            "reference": "2d4592a12d3d6757f9969122730e69d6b7c82af0",
+            "url": "https://api.github.com/repos/WoltLab/guzzle/zipball/40e0ba7d933ec47237adb4f35ba363c3d8ffe453",
+            "reference": "40e0ba7d933ec47237adb4f35ba363c3d8ffe453",
             "shasum": ""
         },
         "require": {
         "suggest": {
             "psr/log": "Required for using the Log middleware"
         },
-        "time": "2020-09-30T10:06:20+00:00",
+        "time": "2020-10-09T13:06:06+00:00",
         "type": "library",
         "extra": {
             "branch-alias": {
index 48d909383c008ad1954f873cb2875ced0ef45fae..4bcbb35ade95f03bd6179cac457a2fc5ad3ba9e2 100644 (file)
@@ -375,30 +375,27 @@ class CurlFactory implements CurlFactoryInterface
             }
         }
 
-        // Do not connect a sink for HEAD requests.
-        if ($easy->request->getMethod() !== 'HEAD') {
-            if (!isset($options['sink'])) {
-                // Use a default temp stream if no sink was set.
-                $options['sink'] = \fopen('php://temp', 'w+');
-            }
-            $sink = $options['sink'];
-            if (!is_string($sink)) {
-                $sink = \GuzzleHttp\Psr7\stream_for($sink);
-            } elseif (!is_dir(dirname($sink))) {
-                // Ensure that the directory exists before failing in curl.
-                throw new \RuntimeException(sprintf(
-                    'Directory %s does not exist for sink value of %s',
-                    dirname($sink),
-                    $sink
-                ));
-            } else {
-                $sink = new LazyOpenStream($sink, 'w+');
-            }
-            $easy->sink = $sink;
-            $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) {
-                return $sink->write($write);
-            };
+        if (!isset($options['sink'])) {
+            // Use a default temp stream if no sink was set.
+            $options['sink'] = \fopen('php://temp', 'w+');
+        }
+        $sink = $options['sink'];
+        if (!is_string($sink)) {
+            $sink = \GuzzleHttp\Psr7\stream_for($sink);
+        } elseif (!is_dir(dirname($sink))) {
+            // Ensure that the directory exists before failing in curl.
+            throw new \RuntimeException(sprintf(
+                'Directory %s does not exist for sink value of %s',
+                dirname($sink),
+                $sink
+            ));
+        } else {
+            $sink = new LazyOpenStream($sink, 'w+');
         }
+        $easy->sink = $sink;
+        $conf[CURLOPT_WRITEFUNCTION] = function ($ch, $write) use ($sink) {
+            return $sink->write($write);
+        };
 
         $timeoutRequiresNoSignal = false;
         if (isset($options['timeout'])) {