"GOT", but the "O" is a cute, smiling sun Index | Thread

From:
Omar Polo <op@omarpolo.com>
Subject:
Re: gotwebd.conf: remove fcgi_socket keyword
To:
Stefan Sperling <stsp@stsp.name>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 21 Aug 2022 00:23:21 +0200

Download raw body.

On 2022/08/20 22:15:51 +0200, Stefan Sperling <stsp@stsp.name> wrote:
> 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.

As far as i can see we're storing the port number in hots byte order,
in fact getservice does ntohs on the port returned by getservbyname
(which is in network byte order) and then we convert them to network
byte order in sockets_create_socket.

however, the NUMBER part of the fcgiport grammar rule parse the number
and converts it to network byte order.  the we will convert it again
to network byte order in sockets_create_socket...

> > @@ -159,7 +159,7 @@ fcgiport	: NUMBER {
> >  				yyerror("invalid port: %lld", $1);
> >  				YYERROR;
> >  			}
> > -			$$ = htons($1);
> > +			$$ = $1;
> >  		}
> >  		| STRING {
> >  			int	 val;