From c4d46c7035d07070ac1ebf0c0b44df927358687f Mon Sep 17 00:00:00 2001 From: Lars Hjemli Date: Fri, 13 Feb 2009 20:43:30 +0100 Subject: Add support for mime type registration and lookup This patch makes it possible to register mappings from filename extension to mime type in cgitrc and use this mapping when returning blob content in `plain` view. The reason for adding this mapping to cgitrc (as opposed to parsing something like /etc/mime.types) is to allow quick lookup of a limited number of filename extensions (/etc/mime-types on my machine currently contains over 700 entries). NB: A nice addition to this patch would be to parse /etc/mime.types when `plain` view is requested for a file with an extension for which there is no mapping registered in cgitrc. Signed-off-by: Lars Hjemli --- cgitrc.5.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'cgitrc.5.txt') diff --git a/cgitrc.5.txt b/cgitrc.5.txt index a207fe0..7256ec0 100644 --- a/cgitrc.5.txt +++ b/cgitrc.5.txt @@ -147,6 +147,10 @@ max-stats:: "month", "quarter" and "year". If unspecified, statistics are disabled. Default value: none. See also: "repo.max-stats". +mimetype.:: + Set the mimetype for the specified filename extension. This is used + by the `plain` command when returning blob content. + module-link:: Text which will be used as the formatstring for a hyperlink when a submodule is printed in a directory listing. The arguments for the @@ -324,6 +328,19 @@ root-readme=/var/www/htdocs/about.html snapshots=tar.gz tar.bz2 zip +## +## List of common mimetypes +## + +mimetype.git=image/git +mimetype.html=text/html +mimetype.jpg=image/jpeg +mimetype.jpeg=image/jpeg +mimetype.pdf=application/pdf +mimetype.png=image/png +mimetype.svg=image/svg+xml + + ## ## List of repositories. ## PS: Any repositories listed when repo.group is unset will not be -- cgit v1.2.3-59-g8ed1b