aboutsummaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-06-11 15:49:46 +0000
committerOmar Polo <op@omarpolo.com>2021-06-11 15:49:46 +0000
commitc92b802b6a78a4281f66b02d935391086959dc4b (patch)
tree8901dc1d51c20d27173ee5a703f7aafc0c5df04d /parse.y
parentf740b61b03c9e31f4915ee7d7444d64fc320b41c (diff)
add `param' keyword
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y36
1 files changed, 26 insertions, 10 deletions
diff --git a/parse.y b/parse.y
index fe4b6c4..661e8e8 100644
--- a/parse.y
+++ b/parse.y
@@ -49,6 +49,7 @@ void advance_loc(void);
void only_once(const void*, const char*);
void only_oncei(int, const char*);
int fastcgi_conf(char *, char *, char *);
+void add_param(char *, char *, int);
%}
@@ -63,7 +64,7 @@ int fastcgi_conf(char *, char *, 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
+%token TFASTCGI TSPAWN TPARAM
%token TERR
@@ -150,20 +151,15 @@ servopt : TALIAS TSTRING {
host->entrypoint = $2;
}
| TENV TSTRING TSTRING {
- struct envlist *e;
-
- e = xcalloc(1, sizeof(*e));
- e->name = $2;
- e->value = $3;
- if (TAILQ_EMPTY(&host->env))
- TAILQ_INSERT_HEAD(&host->env, e, envs);
- else
- TAILQ_INSERT_TAIL(&host->env, e, envs);
+ add_param($2, $3, 1);
}
| TKEY TSTRING {
only_once(host->key, "key");
host->key = ensure_absolute_path($2);
}
+ | TPARAM TSTRING TSTRING {
+ add_param($2, $3, 0);
+ }
| locopt
;
@@ -422,3 +418,23 @@ fastcgi_conf(char *path, char *port, char *prog)
yyerror("too much `fastcgi' rules defined.");
return -1;
}
+
+void
+add_param(char *name, char *val, int env)
+{
+ struct envlist *e;
+ struct envhead *h;
+
+ if (env)
+ h = &host->env;
+ else
+ h = &host->params;
+
+ e = xcalloc(1, sizeof(*e));
+ e->name = name;
+ e->value = val;
+ if (TAILQ_EMPTY(h))
+ TAILQ_INSERT_HEAD(h, e, envs);
+ else
+ TAILQ_INSERT_TAIL(h, e, envs);
+}