aboutsummaryrefslogtreecommitdiff
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
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.
-rw-r--r--gmid.16
-rw-r--r--parse.y23
2 files changed, 16 insertions, 13 deletions
diff --git a/gmid.1 b/gmid.1
index 11c017e..baa7565 100644
--- a/gmid.1
+++ b/gmid.1
@@ -297,7 +297,7 @@ is set to
Handle all the requests for the current virtual host using the
CGI script at
.Pa path .
-.It Ic env Ar name Ar value
+.It Ic env Ar name Cm => Ar value
Set the environment variable
.Ar name
to
@@ -306,7 +306,7 @@ when executing CGI scripts.
Can be provided more than once.
.\" don't document the "spawn <prog>" form because it probably won't
.\" be kept.
-.It Ic fastcgi Oo Ic tcp Oc Pa socket Oo Ar port Oc
+.It Ic fastcgi Oo Ic tcp Oc Pa socket Oo Cm port Ar port Oc
Enable FastCGI instead of serving files.
The
.Pa socket
@@ -359,7 +359,7 @@ except
.Ic entrypoint No and Ic cgi .
.It Ic log Ar bool
Enable or disable the logging for the current server or location block.
-.It Ic param Ar name Ar value
+.It Ic param Ar name Cm => Ar value
Set the param
.Ar name
to
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;
}