Commit Diff
Diff:
aa9543b9fd1963d86f63fda13addb356f9039c37
cd5826b8ba3b43ed9802309688ae029c0f5c4081
Commit:
cd5826b8ba3b43ed9802309688ae029c0f5c4081
Tree:
6de2abea6c0b82ca7084526815a8715263809254
Author:
Omar Polo <op@omarpolo.com>
Date:
Sat Sep 10 09:43:57 2022 UTC
Message:
retire the deprecated `mime' and `map' config options
commit - aa9543b9fd1963d86f63fda13addb356f9039c37
commit + cd5826b8ba3b43ed9802309688ae029c0f5c4081
blob - 92ff26b20ef67f8d5ebebd288adc52ad7c0eb4a0
blob + c1fc46e96eca9891cfa22d572767138f6fb39bbe
--- gmid.c
+++ gmid.c
@@ -186,7 +186,7 @@ listener_main(struct imsgbuf *ibuf)
listener_main(struct imsgbuf *ibuf)
{
drop_priv();
- if (!conf.mime.skip_defaults && load_default_mime(&conf.mime) == -1)
+ if (load_default_mime(&conf.mime) == -1)
fatal("load_default_mime: %s", strerror(errno));
sort_mime(&conf.mime);
load_vhosts();
blob - 3d2540328660d03c37085e73e52452cd378f9786
blob + 68026c0fe0e03c50a8ae4784be3874df9db9a2fa
--- gmid.h
+++ gmid.h
@@ -186,13 +186,6 @@ struct mime {
struct etm *t;
size_t len;
size_t cap;
-
- /*
- * Backward compatibility: types override the built-in list,
- * but the deprecated `mime' and `map' don't. It's still too
- * early to remove `mime' and `map' from the config parser.
- */
- int skip_defaults;
};
struct conf {
blob - ad338f0dfabf4f046f9d7b62e998cf6200680282
blob + 1586cf8944d2df4b4ac5f54a3c5aad03db82f13a
--- mime.c
+++ mime.c
@@ -82,6 +82,10 @@ load_default_mime(struct mime *mime)
{NULL, NULL}
}, *i;
+ /* don't load the default if `types' was used. */
+ if (mime->len != 0)
+ return 0;
+
for (i = m; i->mime != NULL; ++i) {
if (add_mime(mime, i->mime, i->ext) == -1)
return -1;
blob - 6a664f93c5375543aa7f3cf6a5573a3b9312ed1d
blob + c48c046301402665bfc1c1d7e14475d43a460393
--- parse.y
+++ parse.y
@@ -123,7 +123,6 @@ typedef struct {
%token INCLUDE INDEX IPV6
%token KEY
%token LANG LOCATION LOG
-%token MAP MIME
%token OCSP OFF ON
%token PARAM PORT PREFORK PROTO PROTOCOLS PROXY
%token RELAY_TO REQUIRE RETURN ROOT
@@ -219,24 +218,6 @@ option : CHROOT string {
free($2);
}
| IPV6 bool { conf.ipv6 = $2; }
- | MIME STRING string {
- yywarn("`mime MIME EXT' is deprecated and will be "
- "removed in a future version, please use the new "
- "`types' block.");
- if (add_mime(&conf.mime, $2, $3) == -1)
- err(1, "add_mime");
- free($2);
- free($3);
- }
- | MAP string TOEXT string {
- yywarn("`map mime to-ext' is deprecated and will be "
- "removed in a future version, please use the new "
- "`types' block.");
- if (add_mime(&conf.mime, $2, $4) == -1)
- err(1, "add_mime");
- free($2);
- free($4);
- }
| PORT NUM { conf.port = check_port_num($2); }
| PREFORK NUM { conf.prefork = check_prefork_num($2); }
| PROTOCOLS string {
@@ -472,10 +453,7 @@ types : TYPES '{' optnl mediaopts_l '}' {
}
;
-types : TYPES '{' optnl mediaopts_l '}' {
- conf.mime.skip_defaults = 1;
- }
- ;
+types : TYPES '{' optnl mediaopts_l '}' ;
mediaopts_l : mediaopts_l mediaoptsl nl
| mediaoptsl nl
@@ -535,8 +513,6 @@ static const struct keyword {
{"lang", LANG},
{"location", LOCATION},
{"log", LOG},
- {"map", MAP},
- {"mime", MIME},
{"ocsp", OCSP},
{"off", OFF},
{"on", ON},
Omar Polo