Fossil

View Ticket
Login

View Ticket

Ticket Hash: e704dbd96760f6817bc156a8b510bd15430e81b9
Title: server command doesn't accept --localhost
Status: Fixed Type: Code_Defect
Severity: Important Priority:
Subsystem: Resolution: Fixed
Last Modified: 2013-06-24 10:35:49
12.78 years ago
Created: 2013-06-24 08:58:42
12.78 years ago
Version Found In: ae0124439685c110
User Comments:
mjanssen added on 2013-06-24 08:58:42:
The server command doesn't accept --localhost. The reason is that in main.c the argument count check for the server command is done before the check for the --localhost option.

Diff below should fix it (can't test atm)

Index: src/main.c
==================================================================
--- src/main.c
+++ src/main.c
@@ -1803,18 +1803,19 @@
   zPort = find_option("port", "P", 1);
   zNotFound = find_option("notfound", 0, 1);
   zAltBase = find_option("baseurl", 0, 1);
   if( zAltBase ){
     set_base_url(zAltBase);
+  }
+  if ( find_option("localhost", 0, 0)!=0 ){
+    flags |= HTTP_SERVER_LOCALHOST;
   }
   if( g.argc!=2 && g.argc!=3 ) usage("?REPOSITORY?");
   isUiCmd = g.argv[1][0]=='u';
   if( isUiCmd ){
     flags |= HTTP_SERVER_LOCALHOST;
     g.useLocalauth = 1;
-  }else if ( find_option("localhost", 0, 0)!=0 ){
-    flags |= HTTP_SERVER_LOCALHOST;
   }
   find_server_repository(isUiCmd && zNotFound==0);
   if( zPort ){
     int i;
     for(i=strlen(zPort)-1; i>=0 && zPort[i]!=':'; i--){}