Diff
Not logged in

Differences From:

File src/main.c part of check-in [844718abbf] - Make attempts to add _FOSSIL_, manifest, and manifest.uuid warnings, not fatal errors. This allows users to say things like "fossil add *" when initially populating a new project repository. by drh on 2008-05-13 13:20:27. [view]

To:

File src/main.c part of check-in [c7c81df138] - Add the "Index Page" setup option to allow each site to configure a page to appear when no URL is specified or when the "Home" menu option is selected. by drh on 2008-05-16 13:31:51. [view]

@@ -466,20 +466,18 @@
 static void process_one_web_page(void){
   const char *zPathInfo;
   char *zPath = NULL;
   int idx;
-  int i, j;
+  int i;
 
   /* Find the page that the user has requested, construct and deliver that
   ** page.
   */
+  set_base_url();
   zPathInfo = P("PATH_INFO");
-  if( zPathInfo==0 || zPathInfo[0]==0 ){
-    const char *zUri;
-    zUri = PD("REQUEST_URI","/");
-    for(i=0; zUri[i] && zUri[i]!='?' && zUri[i]!='#'; i++){}
-    for(j=i; j>0 && zUri[j-1]!='/'; j--){}
-    cgi_redirectf("%.*s/index", i, zUri);
+  if( zPathInfo==0 || zPathInfo[0]==0
+      || (zPathInfo[0]=='/' && zPathInfo[1]==0) ){
+    cgi_redirectf("%s%s", g.zBaseURL, db_get("index-page", "/index"));
   }else{
     zPath = mprintf("%s", zPathInfo);
   }
 
@@ -492,9 +490,8 @@
     g.zExtra = &zPath[i+1];
   }else{
     g.zExtra = 0;
   }
-  set_base_url();
   if( g.zExtra ){
     /* CGI parameters get this treatment elsewhere, but places like getfile
     ** will use g.zExtra directly.
     */