[nginx] Update mime-types
Maxim Dounin
mdounin at mdounin.ru
Sun Feb 25 23:08:23 UTC 2024
Hello!
On Sun, Feb 25, 2024 at 03:33:32PM +0300, Izorkin wrote:
> Hello, Maksim.
>
> Like that?
>
> # HG changeset patch
> # User Yuriy Izorkin <lafiel at elven.pw>
> # Date 1708074268 -10800
> # Fri Feb 16 12:04:28 2024 +0300
> # Branch update-mime-types
> # Node ID 2343683b93bc2144073e4c808a3951de83b67d95
> # Parent 89bff782528a91ad123b63b624f798e6fd9c8e68
> MIME: change type image/x-ms-bmp to image/image
>
> For .bmp and .dib files the image/bmp mime type is used according to IANA
> [1].
> Apache also uses this type [2].
>
> The .dib file is a BMP file without the 14-byte file header [3].
>
> Extension usage statistics, according to httparhcive.org:
> $ awk 'NR==1||/^bmp,/||/^dib,/' httparchive_exts.csv
> ext,total_pages,total_requests
> bmp,17013,37954
> dib,22,28
>
> The csv file was made with the following query:
>
> SELECT
> ext,
> COUNT(distinct pageid) total_pages,
> COUNT(0) total_requests
> FROM
> `httparchive.summary_requests.2024_01_01_desktop`
> GROUP BY
> ext
> ORDER BY
> total_requests DESC
>
> Link for reference:
>
> [1] https://www.iana.org/assignments/media-types/image/bmp
> [2] https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
> [3] http://fileformats.archiveteam.org/wiki/BMP
> [4] https://httparchive.org
Something like, except that the data as provided make it clear
that:
1. There are two changes, one to change the MIME type for bmp
files, and another one to add dib files.
2. The "dib" extension is not really used, as shown by
the httparchive.org data. And even if used, it does not really mean
the contents are the same as in BMP files, but "sometimes
indicates that the file lacks a file header" (quote from the [3]
link).
Also, most of the information can be used during initial
preparation of the patch set, that is, to filter out irrelevant
changes and new types and extensions which aren't used in
practice.
> This will require a lot of free time :(
That's a work which needs to be done anyway. I did it myself for
the first several patches you've submitted, and the outcome is
that only the bmp MIME type change from image/x-ms-bmp to
image/bmp looks legitimate (and mostly because of browser
handling, which changed over time).
> Maxim Dounin писал(а) 2024-02-24 05:01:
> > I would suggest to provide more details and rationale for each
> > change suggested: why the change is needed, which problems it
> > solves, if there are any compatibility concerns, and so on.
>
>
> I tried to cover all possible options so that wouldn't have to manually
> change the conf/mime.types file if needed. For example. This is
> problematic to do in NixOS, because will need to make changes at the OS
> level, because by default the file is locked for modification.
Note that it is generally trivial to add additional types in
nginx.conf, without touching the mime.types file, with something
like:
include mime.types;
types {
image/bmp dib;
image/foo foo;
}
It is also possible to redefine types for extensions which are
already in mime.types, though nginx will warn when you redefine an
extension to a different type.
> > Note well that nginx (and freenginx) does not try to provide all
> > existing MIME types and extensions in the mime.types file, but
> > rather lists most common ones. As such, it when adding new types
> > and extensions there should be some justification that it needs to
> > be added (httparchive.org might be a good data source here).
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list