Navigation Menu

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

Sends multiple content-type headers #8999

Closed
cyberduck opened this issue Sep 3, 2015 · 3 comments
Closed

Sends multiple content-type headers #8999

cyberduck opened this issue Sep 3, 2015 · 3 comments
Assignees
Labels
bug fixed high priority s3 AWS S3 Protocol Implementation
Milestone

Comments

@cyberduck
Copy link
Collaborator

b60eb40 created the issue

Ceph RadosGW, as used in DreamHost's DreamObjects, sends back the Content-Type header as "Content-type", with the "t" on "type" in lowercase.

If you try to edit the metadata on an object, and leave that header with lowercase "type" as is for editing, AND on submission of changes Cyberduck sends an ADDITIONAL "Content-Type" header with the initial capitalization, and trips up in the JetS3 library.

JetS3 throws this error:
HTTP header name occurs multiple times in request with different values, probably due to mismatched capitalization when setting metadata names. Duplicate metadata name: 'Content-Type', All metadata:
{Content-type=image/jpeg, x-amz-metadata-directive=REPLACE, Cache-Control=public,max-age=2592000, x-amz-copy-source=/CENSORED/CENSORED/CENSORED.jpg, x-amz-storage-class=STANDARD, Content-Type=application/octet-stream}

The HTTP specification declares a few things that need to be considered for this:

  1. Field names are case-insensitive.

  2. Multiple instances of a field with the same name should be treated as if concatenated with a comma, but are ONLY valid if the field takes a list.
    http://greenbytes.de/tech/webdav/rfc2616.html#message.headers

  3. The Content-Type field must have a value of "type/subtype*(parameter)"
    http://greenbytes.de/tech/webdav/rfc2616.html#media.types

Therefore, some changes are required:
A. The edit interface for metadata/headers must prohibit the addition of multiple headers that are the same when considered without case.
B. The client should NOT silently add the extra Content-Type header.

Trying to send multiple content-type capitalizations to AmazonS3 causes S3 to claim there is a signature mismatch.
(As an aside, I'm fixing the Ceph RADOSGW to have the common capitalization of Content-Type, but CyberDuck should be fixed as well).

@cyberduck
Copy link
Collaborator Author

@dkocher commented

Add failing test in 4cfeaa5.

@cyberduck
Copy link
Collaborator Author

@cyberduck
Copy link
Collaborator Author

@dkocher commented

In e826016.

@iterate-ch iterate-ch locked as resolved and limited conversation to collaborators Nov 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug fixed high priority s3 AWS S3 Protocol Implementation
Projects
None yet
Development

No branches or pull requests

2 participants