Fossil

Changes On Branch altBaseUrlRepoDir
Login

Changes On Branch altBaseUrlRepoDir

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch altBaseUrlRepoDir Excluding Merge-Ins

This is equivalent to a diff from 93f514ca2c to 45ed23d946

2016-03-17
19:32
Simpler alternative to [7063f8d4cc]. Skips initial directory portion of PATH_INFO when building the g.zBaseURL and g.zTop used with a directory of repositories. ... (check-in: abb19e8864 user: mistachkin tags: trunk)
2016-03-08
19:37
Cleanup, modularize, and robustify all test setup and cleanup. ... (check-in: fa59221693 user: mistachkin tags: trunk)
2016-03-06
06:38
Merge updates from trunk. ... (check-in: ccf01b243f user: mistachkin tags: stash-fixes)
06:35
Merge updates from trunk. ... (Closed-Leaf check-in: ff4a4fe6b2 user: mistachkin tags: pending-review)
06:35
Merge updates from trunk. ... (Closed-Leaf check-in: 4bd2b54592 user: mistachkin tags: pending-review)
06:34
Merge updates from trunk. ... (Closed-Leaf check-in: 370c003d15 user: mistachkin tags: baruch_timeline_fixes)
06:28
Merge updates from trunk. ... (Closed-Leaf check-in: 45ed23d946 user: mistachkin tags: altBaseUrlRepoDir)
06:26
Merge updates from trunk. ... (check-in: abd131b83c user: mistachkin tags: mvHardDirFix)
2016-03-05
20:01
Added add_content_sql_commands() to /admin_sql, as per ML discussion. ... (check-in: 93f514ca2c user: stephan tags: trunk)
2016-03-02
02:10
Permit the TH1 hooks subsystem to check for the configuration without raising a 'fatal' error. ... (check-in: b06cd631f1 user: mistachkin tags: trunk)
2016-02-02
04:18
Simpler alternative to [7063f8d4cc]. Skips initial directory portion of PATH_INFO when building the g.zBaseURL and g.zTop used with a directory of repositories. ... (check-in: 7d5307b44f user: mistachkin tags: altBaseUrlRepoDir)

Changes to src/main.c.

1591
1592
1593
1594
1595
1596
1597

1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612










1613
1614
1615
1616
1617
1618
1619
*/
static void process_one_web_page(
  const char *zNotFound,      /* Redirect here on a 404 if not NULL */
  Glob *pFileGlob,            /* Deliver static files matching */
  int allowRepoList           /* Send repo list for "/" URL */
){
  const char *zPathInfo;

  char *zPath = NULL;
  int idx;
  int i;

  /* Handle universal query parameters */
  if( PB("utc") ){
    g.fTimeFormat = 1;
  }else if( PB("localtime") ){
    g.fTimeFormat = 2;
  }

  /* If the repository has not been opened already, then find the
  ** repository based on the first element of PATH_INFO and open it.
  */
  zPathInfo = PD("PATH_INFO","");










  if( !g.repositoryOpen ){
    char *zRepo, *zToFree;
    const char *zOldScript = PD("SCRIPT_NAME", "");
    char *zNewScript;
    int j, k;
    i64 szFile;








>














|
>
>
>
>
>
>
>
>
>
>







1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
*/
static void process_one_web_page(
  const char *zNotFound,      /* Redirect here on a 404 if not NULL */
  Glob *pFileGlob,            /* Deliver static files matching */
  int allowRepoList           /* Send repo list for "/" URL */
){
  const char *zPathInfo;
  const char *zDirPathInfo;
  char *zPath = NULL;
  int idx;
  int i;

  /* Handle universal query parameters */
  if( PB("utc") ){
    g.fTimeFormat = 1;
  }else if( PB("localtime") ){
    g.fTimeFormat = 2;
  }

  /* If the repository has not been opened already, then find the
  ** repository based on the first element of PATH_INFO and open it.
  */
  zDirPathInfo = zPathInfo = PD("PATH_INFO","");
  /* For the PATH_INFO that will be used to help build the final
  ** g.zBaseURL and g.zTop (only), skip over the initial directory
  ** portion of PATH_INFO; otherwise, it may be duplicated.
  */
  if( g.zTop ){
    int nTop = strlen(g.zTop);
    if ( strncmp(zDirPathInfo, g.zTop, nTop)==0 ){
      zDirPathInfo += nTop;
    }
  }
  if( !g.repositoryOpen ){
    char *zRepo, *zToFree;
    const char *zOldScript = PD("SCRIPT_NAME", "");
    char *zNewScript;
    int j, k;
    i64 szFile;

1643
1644
1645
1646
1647
1648
1649

1650
1651

1652
1653
1654
1655
1656
1657
1658
      }
      if( szFile==0 && sqlite3_strglob("*/.fossil",zRepo)!=0 ){
        if( zRepo[0]=='/' && zRepo[1]=='/' ){ zRepo++; j--; }
        szFile = file_size(zRepo);
        /* this should only be set from the --baseurl option, not CGI  */
        if( g.zBaseURL && g.zBaseURL[0]!=0 && g.zTop && g.zTop[0]!=0 &&
            file_isdir(g.zRepositoryName)==1 ){

          g.zBaseURL = mprintf("%s%.*s", g.zBaseURL, i, zPathInfo);
          g.zTop = mprintf("%s%.*s", g.zTop, i, zPathInfo);

        }
      }
      if( szFile<0 && i>0 ){
        const char *zMimetype;
        assert( fossil_strcmp(&zRepo[j], ".fossil")==0 );
        zRepo[j] = 0;
        if( zPathInfo[i]=='/' && file_isdir(zRepo)==1 ){







>
|
|
>







1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
      }
      if( szFile==0 && sqlite3_strglob("*/.fossil",zRepo)!=0 ){
        if( zRepo[0]=='/' && zRepo[1]=='/' ){ zRepo++; j--; }
        szFile = file_size(zRepo);
        /* this should only be set from the --baseurl option, not CGI  */
        if( g.zBaseURL && g.zBaseURL[0]!=0 && g.zTop && g.zTop[0]!=0 &&
            file_isdir(g.zRepositoryName)==1 ){
          if( zPathInfo==zDirPathInfo ){
            g.zBaseURL = mprintf("%s%.*s", g.zBaseURL, i, zPathInfo);
            g.zTop = mprintf("%s%.*s", g.zTop, i, zPathInfo);
          }
        }
      }
      if( szFile<0 && i>0 ){
        const char *zMimetype;
        assert( fossil_strcmp(&zRepo[j], ".fossil")==0 );
        zRepo[j] = 0;
        if( zPathInfo[i]=='/' && file_isdir(zRepo)==1 ){