diff options
author | Omar Polo <op@omarpolo.com> | 2021-06-11 15:49:46 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2021-06-11 15:49:46 +0000 |
commit | c92b802b6a78a4281f66b02d935391086959dc4b (patch) | |
tree | 8901dc1d51c20d27173ee5a703f7aafc0c5df04d /parse.y | |
parent | f740b61b03c9e31f4915ee7d7444d64fc320b41c (diff) |
add `param' keyword
Diffstat (limited to 'parse.y')
-rw-r--r-- | parse.y | 36 |
1 files changed, 26 insertions, 10 deletions
@@ -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); +} |