-
Notifications
You must be signed in to change notification settings - Fork 1.6k
http
: add xml
support to http::mime_types::mappings
#2725
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
Conversation
It seems strange that `xml` isn't supported as a `mime` type here. We expect all S3 REST error responses to be returned with a `Content-Type` header of `application/xml`, so being able to map the extension here makes life a lot easier for testing with imposter `http` S3 servers/services.
Perhaps we should load /etc/mime-types (and merge with the built-in set of mappings) |
There's |
Note that although set_mime_type() exists, there are other methods which take only that fixed set of mime types, which is silly. So for example when in ScyllaDB Alternator I had the same problem - I wanted to use
And then override it later with
This is ugly, and need to be rethought. I don't think adding one or 17 more mime types to the list really solves this problem. |
Similar to @nyh's problem above, using
I'm getting around this currently via a new impl for |
I have an idea: What if when the mime type contains a slash, we use it without looking it up in any tables? |
You mean the |
Ah, it's the |
Yes, I claim that this distinction, between "content type" and "mime type" is simply unnecessary and even misleading (as the set_content_type() today specifies the extension not a MIME or HTTP Content-Type). As you can see in the MIME RFC 2045 section 5.1, https://datatracker.ietf.org/doc/html/rfc2045#section-5.1, a full MIME type always needs to look like type/subtype. E.g., I propose the following fix instead of this patch:
I think this fix will be very easy to do and will avoid a deluge of patches like this one each adding their favorite MIME type. I'll also use the new patch in ScyllaDB instead of an ugly workaround (as I explained above). I'll open an issue asking for this. |
I see that despite my recommendation, Avi merged this match. I'll send a patch to do it. |
It seems strange that
xml
isn't supported as amime
type here.In particular, we expect all S3 REST error responses to be returned with a
Content-Type
header ofapplication/xml
, so being able to map the extension makes life a lot easier for testing with imposterhttp
S3 servers/services.