Commit Diff


commit - 509d0509a50883a6f8407b63774f40dd1e41dadf
commit + a7a998ac9b5c17d6e689569d8284ac288c64bf09
blob - 2f85a660d177ee24bd720b00b0195502c7766fc8
blob + d6e2bd5c17c4e555851933288772291e929ca4aa
--- parse.y
+++ parse.y
@@ -144,7 +144,7 @@ typedef struct {
 %token	<v.number>	NUM
 
 %type	<v.number>	bool proxy_port
-%type	<v.string>	string numberstring
+%type	<v.string>	string numberstring listen_addr
 
 %%
 
@@ -296,6 +296,10 @@ servbody	: /* empty */
 		| servbody servopt optnl
 		| servbody location optnl
 		| servbody proxy optnl
+		;
+
+listen_addr	: '*' { $$ = NULL; }
+		| STRING
 		;
 
 servopt		: ALIAS string {
@@ -324,12 +328,12 @@ servopt		: ALIAS string {
 		| PARAM string '=' string {
 			add_param($2, $4);
 		}
-		| LISTEN ON STRING PORT STRING {
+		| LISTEN ON listen_addr PORT STRING {
 			listen_on($3, $5);
 			free($3);
 			free($5);
 		}
-		| LISTEN ON STRING PORT NUM {
+		| LISTEN ON listen_addr PORT NUM {
 			char portno[32];
 			int r;
 
@@ -1256,9 +1260,6 @@ listen_on(const char *hostname, const char *servname)
 	struct addrinfo hints, *res, *res0;
 	int error;
 
-	if (!strcmp(hostname, "*"))
-		hostname = NULL;
-
 	memset(&hints, 0, sizeof(hints));
 	hints.ai_family = AF_UNSPEC;
 	hints.ai_socktype = SOCK_STREAM;