[prev in list] [next in list] [prev in thread] [next in thread]
List: openbsd-tech
Subject: Re: httpd: default to text/plain for .diff and .patch
From: Omar Polo <op () omarpolo ! com>
Date: 2022-09-24 7:47:24
Message-ID: 2V11BS8CURHF9.28U9U652HUJ6X () venera
[Download RAW message or body]
On 2022/09/23 21:37:13 +0000, Klemens Nanni <kn@openbsd.org> wrote:
> In the few places I run httpd(8) patches usually float around and I do
> look at them with Firefox.
>
> But unless httpd.conf(5) contains `types { text/plain diff patch }' the
> browser will download the file instead of displaying it as text.
>
> Would it be sensible to add them to the default list so this line is not
> needed?
>
> Not sure what implications this could have and/or what other web
> browers do by default, that should probably be evaluated first.
>
> At least GitHub delivers .diff and .patch links with this content type,
> but it is also a slightly different scenario since GitHub, cgit, etc.
> generate and know the actual content type whereas httpd like type merely
> matches based on the filename suffix.
>
> $ curl -sI https://github.com/openbsd/src/commit/HEAD.patch |
> grep -i content-type
> content-type: text/plain; charset=utf-8
> x-content-type-options: nosniff
>
> Feedback?
not opposed to the idea, fwiw i like it, but shoudln't we add
something to /usr/shar/misc/mime.types too then?
> Index: http.h
> ===================================================================
> RCS file: /cvs/src/usr.sbin/httpd/http.h,v
> retrieving revision 1.16
> diff -u -p -r1.16 http.h
> --- http.h 12 Sep 2020 07:34:17 -0000 1.16
> +++ http.h 23 Sep 2022 21:26:23 -0000
> @@ -217,6 +217,8 @@ struct http_mediatype {
> { "css", "text", "css" }, \
> { "html", "text", "html" }, \
> { "txt", "text", "plain" }, \
> + { "diff", "text", "plain" }, \
> + { "patch", "text", "plain" }, \
> { "gif", "image", "gif" }, \
> { "jpeg", "image", "jpeg" }, \
> { "jpg", "image", "jpeg" }, \
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic