From f566d66e420439e62af8add7bb282782b423f300 Mon Sep 17 00:00:00 2001 From: Dean C Date: Sat, 15 May 2021 20:42:16 -0400 Subject: [PATCH] filter out empty headers Fixes issues #157 & #171. It turns out that ListBuckets does not work on non-amazon services due to a 403 SignatureDoesNotMatch error caused by the empty headers. --- S3.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/S3.php b/S3.php index b10d441e..85bddee9 100644 --- a/S3.php +++ b/S3.php @@ -2004,7 +2004,7 @@ public static function __getSignatureV4($amzHeaders, $headers, $method, $uri, $p // CanonicalHeaders foreach ($headers as $k => $v) - $combinedHeaders[strtolower($k)] = trim($v); + if (!empty($v)) $combinedHeaders[strtolower($k)] = trim($v); foreach ($amzHeaders as $k => $v) $combinedHeaders[strtolower($k)] = trim($v); uksort($combinedHeaders, array('self', '__sortMetaHeadersCmp'));