retire the deprecated `mime' and `map' config options

This commit is contained in:
Omar Polo 2022-09-10 09:43:57 +00:00
parent aa9543b9fd
commit cd5826b8ba
4 changed files with 6 additions and 33 deletions

2
gmid.c
View File

@ -186,7 +186,7 @@ static int
listener_main(struct imsgbuf *ibuf) listener_main(struct imsgbuf *ibuf)
{ {
drop_priv(); 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)); fatal("load_default_mime: %s", strerror(errno));
sort_mime(&conf.mime); sort_mime(&conf.mime);
load_vhosts(); load_vhosts();

7
gmid.h
View File

@ -186,13 +186,6 @@ struct mime {
struct etm *t; struct etm *t;
size_t len; size_t len;
size_t cap; 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 { struct conf {

4
mime.c
View File

@ -82,6 +82,10 @@ load_default_mime(struct mime *mime)
{NULL, NULL} {NULL, NULL}
}, *i; }, *i;
/* don't load the default if `types' was used. */
if (mime->len != 0)
return 0;
for (i = m; i->mime != NULL; ++i) { for (i = m; i->mime != NULL; ++i) {
if (add_mime(mime, i->mime, i->ext) == -1) if (add_mime(mime, i->mime, i->ext) == -1)
return -1; return -1;

26
parse.y
View File

@ -123,7 +123,6 @@ typedef struct {
%token INCLUDE INDEX IPV6 %token INCLUDE INDEX IPV6
%token KEY %token KEY
%token LANG LOCATION LOG %token LANG LOCATION LOG
%token MAP MIME
%token OCSP OFF ON %token OCSP OFF ON
%token PARAM PORT PREFORK PROTO PROTOCOLS PROXY %token PARAM PORT PREFORK PROTO PROTOCOLS PROXY
%token RELAY_TO REQUIRE RETURN ROOT %token RELAY_TO REQUIRE RETURN ROOT
@ -219,24 +218,6 @@ option : CHROOT string {
free($2); free($2);
} }
| IPV6 bool { conf.ipv6 = $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); } | PORT NUM { conf.port = check_port_num($2); }
| PREFORK NUM { conf.prefork = check_prefork_num($2); } | PREFORK NUM { conf.prefork = check_prefork_num($2); }
| PROTOCOLS string { | PROTOCOLS string {
@ -472,10 +453,7 @@ fastcgi : SPAWN string {
} }
; ;
types : TYPES '{' optnl mediaopts_l '}' { types : TYPES '{' optnl mediaopts_l '}' ;
conf.mime.skip_defaults = 1;
}
;
mediaopts_l : mediaopts_l mediaoptsl nl mediaopts_l : mediaopts_l mediaoptsl nl
| mediaoptsl nl | mediaoptsl nl
@ -535,8 +513,6 @@ static const struct keyword {
{"lang", LANG}, {"lang", LANG},
{"location", LOCATION}, {"location", LOCATION},
{"log", LOG}, {"log", LOG},
{"map", MAP},
{"mime", MIME},
{"ocsp", OCSP}, {"ocsp", OCSP},
{"off", OFF}, {"off", OFF},
{"on", ON}, {"on", ON},