Commit Diff


commit - f2fc8ce0a3b225e5408c9b26476e395ca7109e63
commit + bea82c4f04244e6cbe016b150601e00a7f26bfe8
blob - b4e0de13f6815e574fd25d6bedfbc78012e4e88c
blob + edb02bbb81fe636132e1112244651da491c0b4b6
--- gotwebd/gotwebd.conf.5
+++ gotwebd/gotwebd.conf.5
@@ -115,6 +115,10 @@ argument then
 will obtain the list of addresses on this interface only on startup.
 Any future changes to the address configuration of the interface will
 be ignored.
+.It Ic listen on socket off
+Disable use of unix socket.
+.It Ic listen on socket Ar path
+Set the path to the unix socket used by the server.
 .It Ic logo Ar path
 Set the path to an image file containing a logo to be displayed.
 .It Ic logo_url Ar url
@@ -166,10 +170,6 @@ Set the displayed site name title.
 Set the displayed site owner.
 .It Ic show_site_owner Ar on | off
 Toggle display of the site owner.
-.It Ic unix_socket Ar on | off
-Enable or disable use of unix sockets.
-.It Ic unix_socket_name Ar path
-Set the path to the unix socket used by the server.
 .El
 .Sh FILES
 .Bl -tag -width Ds -compact
@@ -192,7 +192,7 @@ prefork 1
 
 server "localhost-unix" {
 	repos_path "/got/public"
-	unix_socket_name "/run/gotweb.sock"
+	listen on socket "/run/gotweb.sock"
 
 	site_name       "my public repos"
 	site_owner      "Got Owner"
@@ -218,7 +218,7 @@ server "localhost-unix" {
 # Example server context for FCGI over TCP connections:
 #server "localhost-tcp" {
 #	repos_path "/got/public"
-#	unix_socket		off
+#	listen on socket off
 #	listen on 127.0.0.1 port 9000
 #	listen on ::1 port 9000
 #}
blob - 14b36a770b7090ae028cbbee4652e8ee38432b55
blob + d301c7c41d8d692c1af309d7e273f275871d7eea
--- gotwebd/parse.y
+++ gotwebd/parse.y
@@ -121,7 +121,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 RESPECT_EXPORTOK
-%token	UNIX_SOCKET UNIX_SOCKET_NAME SERVER CHROOT CUSTOM_CSS
+%token	UNIX_SOCKET UNIX_SOCKET_NAME SERVER CHROOT CUSTOM_CSS SOCKET
 
 %token	<v.string>	STRING
 %type	<v.port>	fcgiport
@@ -338,6 +338,29 @@ serveropts1	: REPOS_PATH STRING {
 			}
 			new_srv->fcgi_socket = 1;
 		}
+		| LISTEN ON SOCKET STRING {
+			if (!strcasecmp($4, "off") ||
+			    !strcasecmp($4, "no")) {
+				new_srv->unix_socket = 0;
+				free($4);
+				YYACCEPT;
+			}
+
+			new_srv->unix_socket = 1;
+
+			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, $4);
+			if (n < 0 ||
+			    (size_t)n >= sizeof(new_srv->unix_socket_name)) {
+				yyerror("%s: unix_socket_name truncated",
+				    __func__);
+				free($4);
+				YYERROR;
+			}
+			free($4);
+		}
 		| MAX_REPOS NUMBER {
 			if ($2 > 0)
 				new_srv->max_repos = $2;
@@ -367,23 +390,6 @@ serveropts1	: REPOS_PATH STRING {
 			if ($2 > 0)
 				new_srv->max_commits_display = $2;
 		}
-		| UNIX_SOCKET boolean {
-			new_srv->unix_socket = $2;
-		}
-		| UNIX_SOCKET_NAME 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);
-			if (n < 0 ||
-			    (size_t)n >= sizeof(new_srv->unix_socket_name)) {
-				yyerror("%s: unix_socket_name truncated",
-				    __func__);
-				free($2);
-				YYERROR;
-			}
-			free($2);
-		}
 		;
 
 serveropts2	: serveropts2 serveropts1 nl
@@ -453,6 +459,7 @@ 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 },
 	};