Skip to content

Commit

Permalink
filter out empty headers
Browse files Browse the repository at this point in the history
Fixes issues tpyo#157 & tpyo#171.

It turns out that ListBuckets does not work on non-amazon services due to a 403 SignatureDoesNotMatch error caused by the empty headers.
  • Loading branch information
dcmexy committed May 16, 2021
1 parent 81a35c6 commit f566d66
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion S3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down

0 comments on commit f566d66

Please sign in to comment.