commit - 88971f9a4e71c199c28fac3a1e9ccf39f44279f1
commit + ee219d702e4b1db5a985be5087f0e682b567618b
blob - 277372063b5c9e4c49479f3b4cf70f482053676c
blob + 47fd2c60dfa4090b5f3e89aa5883fd9f4ffa3a34
--- parse.y
+++ parse.y
static struct vhost *host;
static struct location *loc;
static struct proxy *proxy;
+static char *current_media;
static int errors;
typedef struct {
%token PARAM PORT PREFORK PROTO PROTOCOLS PROXY
%token RELAY_TO REQUIRE RETURN ROOT
%token SERVER SNI SPAWN STRIP
-%token TCP TOEXT TYPE
+%token TCP TOEXT TYPE TYPES
%token USE_TLS USER
%token VERIFYNAME
%token <v.number> NUM
%type <v.number> bool
-%type <v.string> string
+%type <v.string> string numberstring
%%
| conf varset '\n'
| conf option '\n'
| conf vhost '\n'
+ | conf types '\n'
| conf error '\n' { file->errors++; }
;
| STRING
;
+numberstring : NUM {
+ char *s;
+ if (asprintf(&s, "%d", $1) == -1) {
+ yyerror("asprintf: number");
+ YYERROR;
+ }
+ $$ = s;
+ }
+ | STRING
+ ;
+
varset : STRING '=' string {
char *s = $1;
while (*s++) {
only_oncei(loc->fcgi, "fastcgi");
loc->fcgi = fastcgi_conf($2, $4, NULL);
}
+ ;
+
+types : TYPES '{' optnl mediaopts_l '}'
;
+mediaopts_l : mediaopts_l mediaoptsl nl
+ | mediaoptsl nl
+ ;
+
+mediaoptsl : STRING { current_media = $1; } medianames_l optsemicolon
+ | include
+ ;
+
+medianames_l : medianames_l medianamesl
+ | medianamesl
+ ;
+
+medianamesl : numberstring { add_mime(&conf.mime, current_media, $1); }
+ ;
+
+nl : '\n' optnl
+ ;
+
optnl : '\n' optnl /* zero or more newlines */
| ';' optnl /* semicolons too */
| /*empty*/
;
+optsemicolon : ';'
+ |
+ ;
+
%%
static struct keyword {
{"tcp", TCP},
{"to-ext", TOEXT},
{"type", TYPE},
+ {"types", TYPES},
{"use-tls", USE_TLS},
{"user", USER},
{"verifyname", VERIFYNAME},