aboutsummaryrefslogtreecommitdiff
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
parentf740b61b03c9e31f4915ee7d7444d64fc320b41c (diff)
add `param' keyword
-rw-r--r--ChangeLog2
-rw-r--r--lex.l1
-rw-r--r--parse.y36
3 files changed, 29 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 075bad8..d4b2817 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,7 @@
2021-06-11 Omar Polo <op@omarpolo.com>
+ * parse.y (servopt): add `param' keyword
+
* fcgi.c (send_fcgi_req): send GATEWAY_INTERFACE, AUTH_TYPE,
REMOTE_USER, TLS_CLIENT_ISSUER, TLS_CLIENT_HASH, TLS_VERSION,
TLS_CIPHER, TLS_CIPHER_STRENGTH and TLS_CLIENT_NOT_BEFORE/AFTER.
diff --git a/lex.l b/lex.l
index eadbb18..5e1f973 100644
--- a/lex.l
+++ b/lex.l
@@ -70,6 +70,7 @@ lang return TLANG;
location return TLOCATION;
log return TLOG;
mime return TMIME;
+param return TPARAM;
port return TPORT;
prefork return TPREFORK;
protocols return TPROTOCOLS;
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);
+}