[nginx] Update mime-types

Maxim Dounin mdounin at mdounin.ru
Sat Feb 24 02:01:26 UTC 2024


Hello!

On Fri, Feb 23, 2024 at 12:18:13PM +0300, Lafiel wrote:

> Hello!
> 
> Patch to update current MIME types.
> Most of information is taken from IANA and Wikipedia.
> 
> Initial discussion:
> https://mailman.nginx.org/pipermail/nginx-ru/2023-November/36Z6S37IZQQWYQXJGFKOMQXFL2XQUJM2.html

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.

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).

For example, below are comments for the first several patches:

> # HG changeset patch
> # User Yuriy Izorkin

Nitpicking: no email address.

> # 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
> 
> According to IANA, the image/bmp type is used for bmp and dib files.
> 
> diff -r 89bff782528a -r 714041fa3c62 conf/mime.types
> --- a/conf/mime.types   Wed Feb 14 20:03:00 2024 +0400
> +++ b/conf/mime.types   Fri Feb 16 12:04:28 2024 +0300
> @@ -16,6 +16,7 @@
>      text/x-component                                 htc;
> 
>      image/avif                                       avif;
> +    image/bmp                                        bmp dib;
>      image/png                                        png;
>      image/svg+xml                                    svg svgz;
>      image/tiff                                       tif tiff;
> @@ -23,7 +24,6 @@
>      image/webp                                       webp;
>      image/x-icon                                     ico;
>      image/x-jng                                      jng;
> -    image/x-ms-bmp                                   bmp;
> 
>      font/woff                                        woff;
>      font/woff2                                       woff2;

What are "dib" files (in particular, this extension isn't in 
Apache mime.types[1])?  Are are they actually used anywhere except 
being listed in RFC 7903, and might be some internal Microsoft 
sources?  From the httparchive.org data it looks like the "dib" 
extension is almost never used (legend: line number in the list of 
extensions sorted by total requests as shown by "grep -n", 
extension, total pages, total requests):

$ grep -n '^jpg,\|^bmp,\|^dib,' httparchive_exts.csv 
4:jpg,9165719,135508292
64:bmp,17013,37954
2118: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

Are there any compatibility concerns (looks like the new 
MIME type is is better handled at least in Chrome, see [3])?

Link for reference:

[1] https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
[2] https://www.iana.org/assignments/media-types/image/bmp
[3] https://bugzilla.mozilla.org/show_bug.cgi?id=1422725

> # HG changeset patch
> # User Yuriy Izorkin
> # Date 1708074468 -10800
> #      Fri Feb 16 12:07:48 2024 +0300
> # Branch update-mime-types
> # Node ID ddf871e6c8eeea2715d332ba48f77662cbb0cb4d
> # Parent  2343683b93bc2144073e4c808a3951de83b67d95
> MIME: update application/postscript type
> 
> According to IANA, the application/postscript type is used for ps,
> ai, eps, epsi, epsf, eps2 and eps3 files.
> 
> diff -r 2343683b93bc -r ddf871e6c8ee conf/mime.types
> --- a/conf/mime.types   Fri Feb 16 12:04:28 2024 +0300
> +++ b/conf/mime.types   Fri Feb 16 12:07:48 2024 +0300
> @@ -33,7 +33,7 @@
>      application/mac-binhex40                         hqx;
>      application/msword                               doc;
>      application/pdf                                  pdf;
> -    application/postscript                           ps eps ai;
> +    application/postscript                           ps ai eps epsi epsf eps2 eps3;
>      application/rtf                                  rtf;
>      application/vnd.apple.mpegurl                    m3u8;
>      application/vnd.google-earth.kml+xml             kml;

Same here: what are epsi epsf eps2 eps3 files, and if there are 
any reasons to add them (just in case, httparchive does not seem 
to see any requests with these extensions)?  Further, IANA does 
not seem to list these extensions, so the existing commit log 
looks incorrect and misleading:

https://www.iana.org/assignments/media-types/media-types.xhtml
https://www.iana.org/assignments/media-types/application/postscript

> # HG changeset patch
> # User Yuriy Izorkin
> # Date 1708074518 -10800
> #      Fri Feb 16 12:08:38 2024 +0300
> # Branch update-mime-types
> # Node ID 509e72ea0a5f9431e3415c34fdb4c5d223523ae4
> # Parent  ddf871e6c8eeea2715d332ba48f77662cbb0cb4d
> MIME: update application/vnd.apple.mpegurl type
> 
> According to IANA, the application/vnd.apple.mpegurl type is used
> for m3u and msu8 files.

Typo, should be m3u8 instead of "msu8".

> 
> diff -r ddf871e6c8ee -r 509e72ea0a5f conf/mime.types
> --- a/conf/mime.types   Fri Feb 16 12:07:48 2024 +0300
> +++ b/conf/mime.types   Fri Feb 16 12:08:38 2024 +0300
> @@ -35,7 +35,7 @@
>      application/pdf                                  pdf;
>      application/postscript                           ps ai eps epsi epsf eps2 eps3;
>      application/rtf                                  rtf;
> -    application/vnd.apple.mpegurl                    m3u8;
> +    application/vnd.apple.mpegurl                    m3u m3u8;
>      application/vnd.google-earth.kml+xml             kml;
>      application/vnd.google-earth.kmz                 kmz;
>      application/vnd.ms-excel                         xls;

Are m3u playlists actually used in practice?

$ grep -n '^m3u8,\|^m3u,' httparchive_exts.csv 
23:m3u8,68033,503050
495:m3u,15,302

Note well that m3u implies quite different handling of the file 
contents, and it might not be a good idea to list it with the same 
MIME type.  For example, Apache uses audio/x-mpegurl, which 
corresponds to the original Winamp mp3 playlists.

And so on.

While some suggested changes are probably good enough and should 
be accepted (from the patches above, bmp change to image/bmp seems 
legit), this patch series certainly needs more work and major 
cleanup.

[...]

-- 
Maxim Dounin
http://mdounin.ru/



More information about the nginx-devel mailing list