Commit Diff
Diff:
9b6499535963c128de4a5a891a70b2636a54dad1
54203115cd0121ee0e44f5e58202a4d8054b9c09
Commit:
54203115cd0121ee0e44f5e58202a4d8054b9c09
Tree:
d28758a8d5ce0dd1448ba2e35e30de6d9bbe6b2d
Author:
Omar Polo <op@omarpolo.com>
Date:
Fri Apr 8 13:52:35 2022 UTC
Message:
don't load the built-in list when using `types'
commit - 9b6499535963c128de4a5a891a70b2636a54dad1
commit + 54203115cd0121ee0e44f5e58202a4d8054b9c09
blob - 111d5ea0bc22828298c7315cfc3d5e10ada1c086
blob + 21ac1f758c05dd9302104324ebb876a2e81b1871
--- gmid.c
+++ gmid.c
@@ -251,7 +251,7 @@ listener_main(struct imsgbuf *ibuf)
listener_main(struct imsgbuf *ibuf)
{
drop_priv();
- if (load_default_mime(&conf.mime) == -1)
+ if (!conf.mime.skip_defaults && load_default_mime(&conf.mime) == -1)
fatal("load_default_mime: %s", strerror(errno));
load_vhosts();
loop(ctx, sock4, sock6, ibuf);
blob - 4acbf715fa474db6c4559bdaaef5630d7de8182a
blob + 3bf9798e546420f85e88c85e773f7f3aca1c4b8c
--- gmid.h
+++ gmid.h
@@ -182,8 +182,15 @@ struct mime {
struct mime {
struct etm *t;
- size_t len;
- size_t cap;
+ 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 - ed1481005769d7bfa3eafb5f51022517d9c285a1
blob + ca3fb43936b83582fcdd3ca327cb1adc7a79d713
--- parse.y
+++ parse.y
@@ -475,7 +475,9 @@ types : TYPES '{' optnl mediaopts_l '}'
}
;
-types : TYPES '{' optnl mediaopts_l '}'
+types : TYPES '{' optnl mediaopts_l '}' {
+ conf.mime.skip_defaults = 1;
+ }
;
mediaopts_l : mediaopts_l mediaoptsl nl
Omar Polo