From: Stefan Sperling Subject: Re: gotwebd.conf: remove fcgi_socket keyword To: Omar Polo Cc: gameoftrees@openbsd.org Date: Sat, 20 Aug 2022 22:15:51 +0200 On Sat, Aug 20, 2022 at 05:08:36PM +0200, Omar Polo wrote: > I had an issue with it: gotwebd binds the wrong port. I think there's > an extra `htons' in the fcgiport rule. with that dropped, i can > happily have gotwebd listen on localhost:9000. Ah, thanks. I will take a look. > > 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 > > } > > would be nice to have > > listen on socket "/run/gotweb.sock" > > too for consistency while we're here. What do you think? I prefer this syntax, too. ok stsp@ > diff /home/op/w/got > commit - 438e87b74a836380405f370795b7846968f79212 > path + /home/op/w/got > blob - 8f4ee1d28753902fcec64871a26da0743969ae6d > file + gotwebd/parse.y > --- gotwebd/parse.y > +++ gotwebd/parse.y > @@ -119,7 +119,7 @@ typedef struct { > %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 > -%token UNIX_SOCKET UNIX_SOCKET_NAME SERVER CHROOT CUSTOM_CSS > +%token UNIX_SOCKET SOCKET SERVER CHROOT CUSTOM_CSS > > %token STRING > %type fcgiport > @@ -159,7 +159,7 @@ fcgiport : NUMBER { > yyerror("invalid port: %lld", $1); > YYERROR; > } > - $$ = htons($1); > + $$ = $1; > } > | STRING { > int val; > @@ -360,19 +360,19 @@ serveropts1 : REPOS_PATH STRING { > | UNIX_SOCKET boolean { > new_srv->unix_socket = $2; > } > - | UNIX_SOCKET_NAME STRING { > + | LISTEN ON SOCKET STRING { > n = snprintf(new_srv->unix_socket_name, > sizeof(new_srv->unix_socket_name), "%s%s", > strlen(gotwebd->httpd_chroot) ? > - gotwebd->httpd_chroot : D_HTTPD_CHROOT, $2); > + gotwebd->httpd_chroot : D_HTTPD_CHROOT, $4); > if (n < 0 || > (size_t)n >= sizeof(new_srv->unix_socket_name)) { > yyerror("%s: unix_socket_name truncated", > __func__); > - free($2); > + free($4); > YYERROR; > } > - free($2); > + free($4); > } > ; > > @@ -442,8 +442,8 @@ lookup(char *s) > { "site_link", SITE_LINK }, > { "site_name", SITE_NAME }, > { "site_owner", SITE_OWNER }, > + { "socket", SOCKET }, > { "unix_socket", UNIX_SOCKET }, > - { "unix_socket_name", UNIX_SOCKET_NAME }, > }; > const struct keywords *p; > > >