From: Stefan Sperling Subject: gotwebd.conf: remove fcgi_socket keyword To: gameoftrees@openbsd.org Date: Sat, 20 Aug 2022 06:16:50 +0200 Drop the fgci_socket keyword and move "listen on" into the per-server context. A valid config now looks like this: [[[ prefork 1 server "localhost-unix" { repos_path "/got/public" unix_socket_name "/run/gotweb.sock" } server "localhost-tcp" { repos_path "/got/public" unix_socket off listen on 127.0.0.1 port 9000 } ]]] ok? My end goal is to allow a server instance to listen on multiple ports and/or addresses, like this: server "default" { unix_socket_name "/run/gotweb.sock" listen on 127.0.0.1 port 9000 listen on ::1 port 9000 listen on 192.168.1.1 port 9001 } More changes will be needed to achieve this, but getting rid of the "fcgi_socket" keyword is an important step. diff 6d22ddcbe3fad88cb86835fb75bb5e83511c81dd e0f3111b2098f51871d71f353d40adbd3bdb925d commit - 6d22ddcbe3fad88cb86835fb75bb5e83511c81dd commit + e0f3111b2098f51871d71f353d40adbd3bdb925d blob - 5e0cace3988998b75c7ea3fce9383982b42a2465 blob + 8f4ee1d28753902fcec64871a26da0743969ae6d --- gotwebd/parse.y +++ gotwebd/parse.y @@ -118,7 +118,7 @@ typedef struct { %token LISTEN WWW_PATH MAX_REPOS SITE_NAME SITE_OWNER SITE_LINK LOGO %token LOGO_URL SHOW_REPO_OWNER SHOW_REPO_AGE SHOW_REPO_DESCRIPTION %token MAX_REPOS_DISPLAY REPOS_PATH MAX_COMMITS_DISPLAY ON ERROR -%token SHOW_SITE_OWNER SHOW_REPO_CLONEURL PORT PREFORK FCGI_SOCKET +%token SHOW_SITE_OWNER SHOW_REPO_CLONEURL PORT PREFORK %token UNIX_SOCKET UNIX_SOCKET_NAME SERVER CHROOT CUSTOM_CSS %token STRING @@ -334,12 +334,29 @@ serveropts1 : REPOS_PATH STRING { if ($2 > 0) new_srv->max_commits_display = $2; } - | FCGI_SOCKET boolean { - new_srv->fcgi_socket = $2; + | LISTEN ON STRING { + n = strlcpy(new_srv->fcgi_socket_bind, $3, + sizeof(new_srv->fcgi_socket_bind)); + if (n >= sizeof(new_srv->fcgi_socket_bind)) { + yyerror("%s: fcgi_socket_bind truncated", + __func__); + free($3); + YYERROR; + } + new_srv->fcgi_socket = 1; + free($3); } - | FCGI_SOCKET boolean { - new_srv->fcgi_socket = $2; - } '{' optnl socketopts2 '}' + | PORT fcgiport { + struct server *srv; + + TAILQ_FOREACH(srv, &gotwebd->servers, entry) { + if (srv->fcgi_socket_port == $2) { + yyerror("port already assigned"); + YYERROR; + } + } + new_srv->fcgi_socket_port = $2; + } | UNIX_SOCKET boolean { new_srv->unix_socket = $2; } @@ -363,34 +380,6 @@ serveropts2 : serveropts2 serveropts1 nl | serveropts1 optnl ; -socketopts1 : LISTEN ON STRING { - n = strlcpy(new_srv->fcgi_socket_bind, $3, - sizeof(new_srv->fcgi_socket_bind)); - if (n >= sizeof(new_srv->fcgi_socket_bind)) { - yyerror("%s: fcgi_socket_bind truncated", - __func__); - free($3); - YYERROR; - } - free($3); - } - | PORT fcgiport { - struct server *srv; - - TAILQ_FOREACH(srv, &gotwebd->servers, entry) { - if (srv->fcgi_socket_port == $2) { - yyerror("port already assigned"); - YYERROR; - } - } - new_srv->fcgi_socket_port = $2; - } - ; - -socketopts2 : socketopts2 socketopts1 nl - | socketopts1 optnl - ; - nl : '\n' optnl ; @@ -434,7 +423,6 @@ lookup(char *s) static const struct keywords keywords[] = { { "chroot", CHROOT }, { "custom_css", CUSTOM_CSS }, - { "fcgi_socket", FCGI_SOCKET }, { "listen", LISTEN }, { "logo", LOGO }, { "logo_url" , LOGO_URL },