commit - d93c819182ba6decf8f7f1787c6ba416f76c315a
commit + d19951cf0373f6217bce2f97489bc46d6a8837ef
blob - 960228998852e8bdd9bf588c2ef07bd034704b57
blob + d60c900a549371abb7163f884116e2e8af7303ed
--- ChangeLog
+++ ChangeLog
+2021-07-08 Omar Polo <op@omarpolo.com>
+
+ * parse.y (option): rename `mime MIME EXT' to `map MIME to-ext EXT', but retain the old `mime' for compatibility.
+
2021-07-06 Omar Polo <op@omarpolo.com>
* regress/gg.c (main): add -T timeout
blob - ff4e363058d1ea6ab0c666d760f78986aa64c2e7
blob + 11c017ea01d9e617708fea4f92e0cf5acc7feeb2
--- gmid.1
+++ gmid.1
.It Ic ipv6 Ar bool
Enable or disable IPv6 support.
By default is off.
-.It Ic mime Ar mime-type Ar file-extension
-Add a mapping for the given
+.It Ic map Ar mime-type Cm to-ext Ar file-extension
+Add a mapping for
.Ar file-extension
to the given
.Ar mime-type .
looks at the file extension and consults its internal table.
By default the following mappings are loaded, but they can be
overridden or extended using the
-.Ic mime
+.Ic map
configuration option.
If no MIME is found, the value of
.Ic default type
protocols "tlsv1.3"
-mime "application/rtf" "rtf"
+map "application/rtf" to-ext "rtf"
server "example.com" {
cert "/path/to/cert.pem"
blob - a71c6bf8e593911e0538d542291af4b5b0712292
blob + a504b274a7e55b6b90d886cc429bf2923ab4a2de
--- parse.y
+++ parse.y
%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
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 {
{"lang", TLANG},
{"location", TLOCATION},
{"log", TLOG},
+ {"map", TMAP},
{"mime", TMIME},
{"param", TPARAM},
{"port", TPORT},
{"spawn", TSPAWN},
{"strip", TSTRIP},
{"tcp", TTCP},
+ {"to-ext", TTOEXT},
{"type", TTYPE},
{"user", TUSER},
};
blob - b3fc52f71c32825a3c44a61fd7e7d38a8038dbce
blob + ce8cdd77530f5a1c3966a715974f97a22a159bbc
--- regress/runtime
+++ regress/runtime
check "should be running"
# try with custom mime
-config 'mime "text/x-funny-text" "gmi"' 'default type "application/x-trash"'
+config 'map "text/x-funny-text" to-ext "gmi"' 'default type "application/x-trash"'
checkconf
restart