aboutsummaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-07-08 20:29:05 +0000
committerOmar Polo <op@omarpolo.com>2021-07-09 08:30:55 +0200
commitd19951cf0373f6217bce2f97489bc46d6a8837ef (patch)
tree49178f6fd091b2723d3c001c58bde8c57c276a5a /parse.y
parentd93c819182ba6decf8f7f1787c6ba416f76c315a (diff)
rename `mime MIME EXT' to `map MIME to-ext EXT'
With the newish automatic string concatenation, options like `mime' that accepts two strings as parameter start to become ambiguous: which strings gets concatenated? Instead of trying to document in the manpage which argument(s) is subject to string concatenation, do the concat always and introduce a separator. In the case of mime, `to-ext' now acts as a separator to distinguish. While there, also use a new keyword because it sounds better. It's dead-easy to upgrade to the new configuration, possibly with some sed magic, but for the moment the old `mime' form is preserved: (with a warning!) Will be dropped in the next release.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y13
1 files changed, 11 insertions, 2 deletions
diff --git a/parse.y b/parse.y
index a71c6bf..a504b27 100644
--- a/parse.y
+++ b/parse.y
@@ -88,7 +88,7 @@ char *symget(const char *);
%token TIPV6 TPORT TPROTOCOLS TMIME TDEFAULT TTYPE TCHROOT TUSER TSERVER
%token TPREFORK TLOCATION TCERT TKEY TROOT TCGI TENV TLANG TLOG TINDEX TAUTO
%token TSTRIP TBLOCK TRETURN TENTRYPOINT TREQUIRE TCLIENT TCA TALIAS TTCP
-%token TFASTCGI TSPAWN TPARAM
+%token TFASTCGI TSPAWN TPARAM TMAP TTOEXT
%token TERR
@@ -138,7 +138,14 @@ var : TSTRING '=' string {
option : TCHROOT string { conf.chroot = $2; }
| TIPV6 TBOOL { conf.ipv6 = $2; }
- | TMIME TSTRING string { add_mime(&conf.mime, $2, $3); }
+ | TMIME TSTRING string {
+ fprintf(stderr, "%s:%d: `mime MIME EXT' is deprecated and "
+ "will be removed in a future version, "
+ "please use the new syntax: `map MIME to-ext EXT'",
+ config_path, yylval.lineno+1);
+ add_mime(&conf.mime, $2, $3);
+ }
+ | TMAP string TTOEXT string { add_mime(&conf.mime, $3, $5); }
| TPORT TNUM { conf.port = $2; }
| TPREFORK TNUM { conf.prefork = check_prefork_num($2); }
| TPROTOCOLS string {
@@ -360,6 +367,7 @@ static struct keyword {
{"lang", TLANG},
{"location", TLOCATION},
{"log", TLOG},
+ {"map", TMAP},
{"mime", TMIME},
{"param", TPARAM},
{"port", TPORT},
@@ -372,6 +380,7 @@ static struct keyword {
{"spawn", TSPAWN},
{"strip", TSTRIP},
{"tcp", TTCP},
+ {"to-ext", TTOEXT},
{"type", TTYPE},
{"user", TUSER},
};