Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP header names are case-insensitive #406

Closed
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/ObjectStore/v1/Models/MetadataTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,12 @@ public function parseMetadata(ResponseInterface $response): array
$metadata = [];

foreach ($response->getHeaders() as $header => $value) {
if (0 === strpos($header, static::METADATA_PREFIX)) {
if (0 === stripos($header, static::METADATA_PREFIX)) {
$name = substr($header, strlen(static::METADATA_PREFIX));
$metadata[$name] = $response->getHeader($header)[0];
if ($name !== strtolower($name)) {
drzraf marked this conversation as resolved.
Show resolved Hide resolved
$metadata[strtolower($name)] = $response->getHeader($header)[0];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm also not sure we need this at all. It might break the backward compatibility as swift metadata would have double keys.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It allows my $container->getMetadata()["temp-url-key"] code to work indistinctly on both OVH swift 2.33 (and its all-lowercase headers) but also on another provider's Swift 2.25 with mixed-case headers' names.

}
}
}

Expand Down
Loading