Fossil

Check-in [7b028d74a6]
Login

Check-in [7b028d74a6]

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

Overview
Comment:If the first term of the PATH_INFO is "skn_X" where X is one of the built-in skin names, then use that built-in skin rather than whatever is configured.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 7b028d74a6acd6d5794d78ef00e280208b23cf4ebfa277702bd1eaaa6f23075f
User & Date: drh 2021-01-27 17:22:23.349
Context
2021-01-27
19:50
Update the built-in SQLite to the latest 3.35 alpha for testing. ... (check-in: 8f8b6e33cd user: drh tags: trunk)
17:22
If the first term of the PATH_INFO is "skn_X" where X is one of the built-in skin names, then use that built-in skin rather than whatever is configured. ... (check-in: 7b028d74a6 user: drh tags: trunk)
14:40
Begin a change log for version 2.15. ... (check-in: 0412039ef1 user: drh tags: trunk)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/main.c.
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797






1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812

















1813


1814
1815
1816
1817
1818
1819
1820
        fprintf(stderr, "# translated g.zBaseURL = [%s]\n", g.zBaseURL);
      }
    }
  }

  /* At this point, the appropriate repository database file will have
  ** been opened.
  **
  ** Check to see if the PATH_INFO begins with "draft[1-9]" and if
  ** so activate the special handling for draft skins






  */
  if( zPathInfo && strncmp(zPathInfo,"/draft",6)==0
   && zPathInfo[6]>='1' && zPathInfo[6]<='9'
   && (zPathInfo[7]=='/' || zPathInfo[7]==0)
  ){
    int iSkin = zPathInfo[6] - '0';
    char *zNewScript;
    skin_use_draft(iSkin);
    zNewScript = mprintf("%T/draft%d", P("SCRIPT_NAME"), iSkin);
    if( g.zTop ) g.zTop = mprintf("%R/draft%d", iSkin);
    if( g.zBaseURL ) g.zBaseURL = mprintf("%s/draft%d", g.zBaseURL, iSkin);
    zPathInfo += 7;
    cgi_replace_parameter("PATH_INFO", zPathInfo);
    cgi_replace_parameter("SCRIPT_NAME", zNewScript);
    etag_cancel();

















  }



  /* If the content type is application/x-fossil or 
  ** application/x-fossil-debug, then a sync/push/pull/clone is
  ** desired, so default the PATH_INFO to /xfer
  */
  if( g.zContentType &&
      strncmp(g.zContentType, "application/x-fossil", 20)==0 ){







|
|
|
>
>
>
>
>
>















>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
>
>







1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
        fprintf(stderr, "# translated g.zBaseURL = [%s]\n", g.zBaseURL);
      }
    }
  }

  /* At this point, the appropriate repository database file will have
  ** been opened.
  */


  /*
  ** Check to see if the first term of PATH_INFO specifies an alternative
  ** skin.  This will be the case if the first term of PATH_INFO
  ** begins with "draftN/" where N is an integer between 1 and 9 or
  ** if it is "skn_X/" where X is one of the built-in skin names.
  ** If either is true, then activate the alternative skin.
  */
  if( zPathInfo && strncmp(zPathInfo,"/draft",6)==0
   && zPathInfo[6]>='1' && zPathInfo[6]<='9'
   && (zPathInfo[7]=='/' || zPathInfo[7]==0)
  ){
    int iSkin = zPathInfo[6] - '0';
    char *zNewScript;
    skin_use_draft(iSkin);
    zNewScript = mprintf("%T/draft%d", P("SCRIPT_NAME"), iSkin);
    if( g.zTop ) g.zTop = mprintf("%R/draft%d", iSkin);
    if( g.zBaseURL ) g.zBaseURL = mprintf("%s/draft%d", g.zBaseURL, iSkin);
    zPathInfo += 7;
    cgi_replace_parameter("PATH_INFO", zPathInfo);
    cgi_replace_parameter("SCRIPT_NAME", zNewScript);
    etag_cancel();
  }else if( zPathInfo && strncmp(zPathInfo, "/skn_", 5)==0 ){
    int i;
    char *zAlt;
    char *zErr;
    for(i=5; zPathInfo[i] && zPathInfo[i]!='/'; i++){}
    zAlt = mprintf("%.*s", i-5, zPathInfo+5);
    zErr = skin_use_alternative(zAlt);
    if( zErr ){
      fossil_free(zErr);
    }else{
      char *zNewScript;
      zNewScript = mprintf("%T/skn_%s", P("SCRIPT_NAME"), zAlt);
      if( g.zTop ) g.zTop = mprintf("%R/skn_%s", zAlt);
      if( g.zBaseURL ) g.zBaseURL = mprintf("%s/skn_%s", g.zBaseURL, zAlt);
      zPathInfo += i;
      cgi_replace_parameter("PATH_INFO", zPathInfo);
      cgi_replace_parameter("SCRIPT_NAME", zNewScript);
    }
    fossil_free(zAlt);
  }  

  /* If the content type is application/x-fossil or 
  ** application/x-fossil-debug, then a sync/push/pull/clone is
  ** desired, so default the PATH_INFO to /xfer
  */
  if( g.zContentType &&
      strncmp(g.zContentType, "application/x-fossil", 20)==0 ){