Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't guess encoding for xsendfile, only content type
mod_xsendfile intentionally drops the Content-Encoding header[0] when responding to a request, but mimetypes.guess_type returns a tuple of ('Content-Type', 'Content-Encoding'). We were already ignoring the encoding component of this tuple, so if mimetypes.guess_type does guess that a non-None encoding value should be returned, all x_send would use was the type component, resulting in the incorrect type being used in the response. For example: By default, mimetypes.guess_type returns ('text/xml', 'gzip') for a file name like 'metadata.xml.gz', so xsendfile's response incorrectly responds with the 'text/xml' Content-Type header. This change makes mimetypes return ('application/gzip', None) instead, hopefully resulting in a happy client. [0]: https://tn123.org/mod_xsendfile -- search for "Content-Encoding" closes #1781 https://pulp.plan.io/issues/1781
- Loading branch information