The server does not recognize the video files like "mkv" and "mp4". Required to make these types of self in the /etc/lighttpd/mime-types.conf I note that the "mp4" is present in /etc/mime.types: ---------------- video/mp4 mp4 mp4v mpg4 --------------- In the case of mkv want to add: --------------- video/x-matroska mkv --------------- In /etc/lighttpd/mime-types.conf need to add both types of files, otherwise they will not play on the client side, as shown as application/octet-stream: --------------- ". mkv" => "video/x-matroska", ". mp4" => "video/mp4", ........ Reproducible: Always
This sounds like something we'll want upstream to support and can patch in the mean time. It'll be on the list for future ebuild versions and I'll send a bug report upstream.
Quick update: lighttpd ships a Perl script that will generate a mime-types.conf from the /etc/mime.types file on the host system. Lighttpd itself does not come with a "default MIME types" file, so we should find a way to generate it as needed. I'll mark this as IN_PROGRESS until I have a suitable solution.
".iso" => "application/x-iso9660-image", ".exe" => "application/x-exe"
Created attachment 686454 [details, diff] lighttpd-mime.patch Just switched to lighttpd and after finding cause of almost all files being generic "application/octet-stream" mime type discovered this nine (!) year old bug. Update with more modern commonly used file types without the bloat from generation from entire using entire /etc/mime.types source. Mildly sorted according to mime type and removed old vim tail.
Created attachment 686478 [details, diff] lighttpd-mime.patch Updated with a few more common mime-types.
Created attachment 686481 [details, diff] lighttpd-mime.patch Missed the docm's "application/" in mime type. Clutz. The lighttpd-angel test passes as usual.
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=bd3fc91341d2ef60881ebecce489e68b285426c8 commit bd3fc91341d2ef60881ebecce489e68b285426c8 Author: Alan Swanson <reiver@improbability.net> AuthorDate: 2021-02-17 17:56:16 +0000 Commit: Joonas Niilola <juippis@gentoo.org> CommitDate: 2021-02-22 14:47:16 +0000 www-servers/lighttpd: Update mime types, #399401 Update with commonly used file types without the bloat from generation using entire /etc/mime.types source. Closes: https://bugs.gentoo.org/399401 Signed-off-by: Alan Swanson <reiver@improbability.net> Closes: https://github.com/gentoo/gentoo/pull/19507 Signed-off-by: Joonas Niilola <juippis@gentoo.org> www-servers/lighttpd/files/conf/mime-types.conf | 127 ++++++++++++++++++++---- 1 file changed, 109 insertions(+), 18 deletions(-)
Alan, how was this list created? Since lighttpd 1.4.71 (released May 2023) -- a couple years after this bug -- lighttpd provides a builtin default for mimetype.assign if one is not specified in lighttpd.conf. The builtin defaults contain frequently used mime types for web resources, but not all of the items on the list added here. The lighttpd builtin mimetype.assign: https://git.lighttpd.net/lighttpd/lighttpd1.4/src/branch/master/src/configfile.c#L947 Should Gentoo lighttpd package use the lighttpd builtin mimetype.assign? I am open to adding select additional types to the builtin mimetype.assign, though not open to thousands of new types just for funsies or historical curiousity. Alternatively, the lighttpd release tarball also contains doc/config/conf.d/mime.conf which is generated from mime.types on a Fedora system, and has a much, much larger set of types defined. The Gentoo lighttpd package could deploy that instead of the custom list you created.
IIRC I just added what I perceived the most common mime types likely to be seen on the web and sorted the mime types alphabetically so it'd be easier to edit and see missing entries. (I've added a few more locally for weba, avif and jxl but should add step and stl files as quite common for 3D CAD too.) The lighttpd builtin within src/configfile.c is too limited. The Fedora derived doc/config/conf.d/mime.conf is maybe too large (though it's only 56Kb text file) and running create-mime.conf.pl during the ebuild on Gentoo would probably create the sameish. Maintainer choice!
Alan, thank you for the response. >I just added what I perceived the most common mime types likely to be seen on the web I have no doubt that you have seen these file types served. Do you perhaps have some other sources to support your assessment of "the most common mime types" ? I am interested in "common", as in "frequently used by a sizeable percentage of sites". > The lighttpd builtin within src/configfile.c is too limited. How so? For whom? lighttpd.conf mimetype.assign can be configured by anyone who needs to define additional mime types for use in HTTP response header Content-Type. As documented in the source code, the list builtin to lighttpd src/configfile.c was collated from * lighttpd doc/scripts/create-mime.pl * https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types * https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Image_types * https://docs.w3cub.com/http/basics_of_http/mime_types also referencing full /etc/mime.types from * http://www.iana.org/assignments/media-types/media-types.xhtml * https://salsa.debian.org/debian/media-types/-/blob/master/mime.types * https://src.fedoraproject.org/rpms/mailcap/tree/rawhide * https://pagure.io/mailcap/blob/master/f/mime.types The lighttpd builtin mimetype.assign list is not intended to be a complete list, as you have also noted that the full /etc/mime.types is much, much, much larger. Your list is more than 2x the entries in the list in lighttpd src/configfile.c. /etc/mime.types is 27x the entries in the list in lighttpd src/configfile.c The .rodata binary section in lighttpd is currently 46481 bytes in its entirety in my development branch. Adding the 100+ entries in your list would add ~4k (a bit under 10% increase) which is measurable. Adding the full /etc/mime.types would add some 72k (!), which as you also noted, is a very large increase. --- Anyone who needs a different or larger list of mime types can define their own or use the doc/scripts/create-mime.pl script shipped with lighttpd to generate a large list from /etc/mime.types. ==> Why should the Gentoo basic lighttpd.conf define mimetype.assign instead of using the lighttpd builtin mimetype.assign default? (or, as some other popular distros do, use create-mime.pl to create a very large list from /etc/mime.types?) Also, as I posted previously: >> I am open to adding select additional types to the lighttpd builtin mimetype.assign, though not open to thousands of new types just for funsies or historical curiousity.
I don't have a statistical study showing the most common mime types on the web hence my "perceived" additions. This saves users on Gentoo all needing to manually add the same missing mime types themselves reducing maintenance burden. The mime types in src/configfile.c at config_mimetypes_default() can only be described as the bare minimum. So it's a balance between bare minimum and whole shebang (for which 72Kb rodata is nothing).
I will try to ask again more directly: Would you please provide sources for your judgements? You described the list in src/configfile.c as the bare minimum. I provided my sources for how that list was compiled and it is intended to be a decent coverage typical web and media types *commonly* used. You have not provided any source or any statistics or anything other than "feelings" about what you have "perceived" is "most common". It is difficult to have a constructive debate about your perceived feelings. By what criteria do you judge "bare minimum"? If someone is serving files that are not commonly used, they probably do not have a simple website running on bare-bones hardware and so they can configure lighttpd with the whole shebang of mimetype.assign generated from /etc/mime.types without noticing the slight change in memory use. Should mimetype.assign generated from /etc/mime.types be the default for Gentoo users? Those on memory constrained systems (where 72k makes a difference) can then tune lighttpd with guidance for small systems. https://wiki.lighttpd.net/Docs_ResourceTuning https://wiki.lighttpd.net/Docs_Performance One more thing: there are some items in your list of "most common" types which are ABSENT from the much, much longer list of /etc/mime.types (checked on a Fedora system).
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fbed65cb012aaff7314ceb8025a2982d7f6742d7 commit fbed65cb012aaff7314ceb8025a2982d7f6742d7 Author: Glenn Strauss <gstrauss@gluelogic.com> AuthorDate: 2024-03-16 23:04:10 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2024-05-06 16:32:46 +0000 www-servers/lighttpd: use builtin mimetype.assign * use lighttpd builtin mimetype.assign by default (can be overridden) [sam: I've rebased this to fork the changes into a new ebuild revision (1.4.75-r1). Any errors in rebasing are mine and not Glenn's.] Bug: https://bugs.gentoo.org/399401 Bug: https://github.com/gentoo/gentoo/pull/19507 Signed-off-by: Glenn Strauss <gstrauss@gluelogic.com> Signed-off-by: Sam James <sam@gentoo.org> www-servers/lighttpd/files/conf/lighttpd.conf-r2 | 5 ----- www-servers/lighttpd/lighttpd-1.4.75-r1.ebuild | 1 - 2 files changed, 6 deletions(-)