Commit Diff


commit - 6f854dde056f82d0c757c720beed863fc557a1ca
commit + 3a1c1a1b20ae87fe3c8fe3d040d16e816ff0905c
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 - 1939f1bf7bd351ad2efa08577df37106511fd5d6
blob + cc7ccf7ef44f2f9a5f354959abcc57ee681162bf
--- gotwebd/parse.y
+++ gotwebd/parse.y
@@ -122,7 +122,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
@@ -339,6 +339,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;
@@ -368,23 +391,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
@@ -454,6 +460,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 },
 	};