aboutsummaryrefslogtreecommitdiff
path: root/parse.y
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-07-08 20:41:43 +0000
committerOmar Polo <op@omarpolo.com>2021-07-09 08:30:55 +0200
commit762b9b991f373e5077d7e49396af62a34fa1c1ff (patch)
tree54df1927e78e706b1a92e44a28263fecf9a93281 /parse.y
parentff954a3e7641e83cca043ecc30789132478c7acd (diff)
add => in env/param and `port' between hostname and port for fastcgi
In the same spite of the last commit, add the missing separators between strings to avoid the auto-concat pitfalls. `=>' is used to separate between `env' and `param' arguments, while for `fastcgi' the keyword `port' is required between the hostname/ip address and the port (if provided). Since `env', `param' and `fastcgi' are all new stuff, there's no need to keep compatibility.
Diffstat (limited to 'parse.y')
-rw-r--r--parse.y23
1 files changed, 13 insertions, 10 deletions
diff --git a/parse.y b/parse.y
index 4ecee63..6563791 100644
--- a/parse.y
+++ b/parse.y
@@ -88,7 +88,7 @@ char *symget(const 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 TPARAM TMAP TTOEXT
+%token TFASTCGI TSPAWN TPARAM TMAP TTOEXT TARROW
%token TERR
@@ -210,15 +210,15 @@ servopt : TALIAS string {
memmove($2, $2+1, strlen($2));
host->entrypoint = $2;
}
- | TENV string string {
- add_param($2, $3, 1);
+ | TENV string TARROW string {
+ add_param($2, $4, 1);
}
| TKEY string {
only_once(host->key, "key");
host->key = ensure_absolute_path($2);
}
- | TPARAM string string {
- add_param($2, $3, 0);
+ | TPARAM string TARROW string {
+ add_param($2, $4, 0);
}
| locopt
;
@@ -294,9 +294,9 @@ fastcgi : TSPAWN string {
only_oncei(loc->fcgi, "fastcgi");
loc->fcgi = fastcgi_conf($1, NULL, NULL);
}
- | TTCP string TNUM {
+ | TTCP string TPORT TNUM {
char *c;
- if (asprintf(&c, "%d", $3) == -1)
+ if (asprintf(&c, "%d", $4) == -1)
err(1, "asprintf");
only_oncei(loc->fcgi, "fastcgi");
loc->fcgi = fastcgi_conf($2, c, NULL);
@@ -305,9 +305,9 @@ fastcgi : TSPAWN string {
only_oncei(loc->fcgi, "fastcgi");
loc->fcgi = fastcgi_conf($2, xstrdup("9000"), NULL);
}
- | TTCP string string {
+ | TTCP string TPORT string {
only_oncei(loc->fcgi, "fastcgi");
- loc->fcgi = fastcgi_conf($2, $3, NULL);
+ loc->fcgi = fastcgi_conf($2, $4, NULL);
}
;
@@ -429,7 +429,10 @@ repeat:
yylval.lineno++;
goto repeat;
case '=':
- return c;
+ if ((c = getc(yyfp)) == '>')
+ return TARROW;
+ ungetc(c, yyfp);
+ return '=';
case EOF:
goto eof;
}