Commit Diff
Diff:
f740b61b03c9e31f4915ee7d7444d64fc320b41c
c92b802b6a78a4281f66b02d935391086959dc4b
Commit:
c92b802b6a78a4281f66b02d935391086959dc4b
Tree:
8901dc1d51c20d27173ee5a703f7aafc0c5df04d
Author:
Omar Polo <op@omarpolo.com>
Date:
Fri Jun 11 15:49:46 2021 UTC
Message:
add `param' keyword
commit - f740b61b03c9e31f4915ee7d7444d64fc320b41c
commit + c92b802b6a78a4281f66b02d935391086959dc4b
blob - 075bad82960d843caa4917a2cd470ad4f9569a4e
blob + d4b2817de405f6e7ad844320f087918583e7c904
--- ChangeLog
+++ ChangeLog
@@ -1,4 +1,6 @@
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,
blob - eadbb188679b6f05a7cac3d47d401f6520cc3f67
blob + 5e1f973cca7bc13c0addb7d3c4cd716f287ba83c
--- lex.l
+++ lex.l
@@ -70,6 +70,7 @@ port return TPORT;
location return TLOCATION;
log return TLOG;
mime return TMIME;
+param return TPARAM;
port return TPORT;
prefork return TPREFORK;
protocols return TPROTOCOLS;
blob - fe4b6c4c7123a049f5eb14a268a5cb3a37731974
blob + 661e8e8d488d78b891d79af2f58cb8265cd18d43
--- parse.y
+++ parse.y
@@ -49,6 +49,7 @@ int fastcgi_conf(char *, char *, char *);
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,19 +151,14 @@ 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
;
@@ -421,4 +417,24 @@ 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);
}
Omar Polo