Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Add comments the CGI-script parser. Move the most commonly seen lines to the top of the if-then-else chain. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA1: |
236087b98e559e3ed21ae85819f60e57 |
| User & Date: | drh 2015-01-22 13:44:44.728 |
Context
|
2015-01-22
| ||
| 15:32 | Add missing style to the default skin CSS. Also, correct some comments. ... (check-in: 03a75d7cb5 user: mistachkin tags: trunk) | |
| 15:23 | Add the ability to bring up a web server that uses a different skin from the default, and have multiple servers going at the same time, each using a different skin. Currently enabled for unix only. (Later:) Upon further reflection, I'm not convinced this is a good idea, so the code is moved into a branch. ... (Closed-Leaf check-in: b36e241100 user: drh tags: multiple-skins) | |
| 13:44 | Add comments the CGI-script parser. Move the most commonly seen lines to the top of the if-then-else chain. ... (check-in: 236087b98e user: drh tags: trunk) | |
| 12:37 | Add a few "const" qualifiers in appropriate places, and remove some unnecessary end-of-line spaces. No change in functionality. ... (check-in: f6c285f88c user: jan.nijtmans tags: trunk) | |
Changes
Changes to src/main.c.
| ︙ | ︙ | |||
1785 1786 1787 1788 1789 1790 1791 |
fossil_binary_mode(g.httpOut);
fossil_binary_mode(g.httpIn);
g.cgiOutput = 1;
blob_read_from_file(&config, zFile);
while( blob_line(&config, &line) ){
if( !blob_token(&line, &key) ) continue;
if( blob_buffer(&key)[0]=='#' ) continue;
| < < < < < < < < < < < < < < < > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 1785 1786 1787 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 1846 1847 1848 1849 1850 1851 1852 1853 1854 1855 1856 1857 1858 1859 1860 1861 1862 1863 1864 1865 1866 1867 1868 1869 1870 1871 1872 1873 1874 1875 1876 1877 1878 1879 1880 1881 1882 1883 1884 1885 1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896 1897 1898 1899 1900 1901 1902 1903 1904 1905 1906 1907 1908 |
fossil_binary_mode(g.httpOut);
fossil_binary_mode(g.httpIn);
g.cgiOutput = 1;
blob_read_from_file(&config, zFile);
while( blob_line(&config, &line) ){
if( !blob_token(&line, &key) ) continue;
if( blob_buffer(&key)[0]=='#' ) continue;
if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
/* repository: FILENAME
**
** The name of the Fossil repository to be served via CGI. Most
** fossil CGI scripts have a single non-comment line that contains
** this one entry.
*/
blob_trim(&value);
db_open_repository(blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "directory:") && blob_token(&line, &value) ){
/* directory: DIRECTORY
**
** If repository: is omitted, then terms of the PATH_INFO cgi parameter
** are appended to DIRECTORY looking for a repository (whose name ends
** in ".fossil") or a file in "files:".
*/
db_close(1);
g.zRepositoryName = mprintf("%s", blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "notfound:") && blob_token(&line, &value) ){
/* notfound: URL
**
** If using directory: and no suitable repository or file is found,
** then redirect to URL.
*/
zNotFound = mprintf("%s", blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "localauth") ){
/* localauth
**
** Grant "administrator" privileges to users connecting with HTTP
** from IP address 127.0.0.1. Do not bother checking credentials.
*/
g.useLocalauth = 1;
continue;
}
if( blob_eq(&key, "redirect:") && blob_token(&line, &value)
&& blob_token(&line, &value2) ){
/* See the header comment on the redirect_web_page() function
** above for details. */
nRedirect++;
azRedirect = fossil_realloc(azRedirect, 2*nRedirect*sizeof(char*));
azRedirect[nRedirect*2-2] = mprintf("%s", blob_str(&value));
azRedirect[nRedirect*2-1] = mprintf("%s", blob_str(&value2));
blob_reset(&value);
blob_reset(&value2);
continue;
}
if( blob_eq(&key, "files:") && blob_token(&line, &value) ){
/* files: GLOBLIST
**
** GLOBLIST is a comma-separated list of filename globs. For
** example: *.html,*.css,*.js
**
** If the repository: line is omitted and then PATH_INFO is searched
** for files that match any of these GLOBs and if any such file is
** found it is returned verbatim. This feature allows "fossil server"
** to function as a primitive web-server delivering arbitrary content.
*/
pFileGlob = glob_create(blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "setenv:") && blob_token(&line, &value)
&& blob_token(&line, &value2) ){
/* setenv: NAME VALUE
**
** Sets environment variable NAME to VALUE
*/
fossil_setenv(blob_str(&value), blob_str(&value2));
blob_reset(&value);
blob_reset(&value2);
continue;
}
if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){
/* debug: FILENAME
**
** Causes output from cgi_debug() and CGIDEBUG(()) calls to go
** into FILENAME.
*/
g.fDebug = fossil_fopen(blob_str(&value), "ab");
blob_reset(&value);
continue;
}
if( blob_eq(&key, "errorlog:") && blob_token(&line, &value) ){
/* errorlog: FILENAME
**
** Causes messages from warnings, errors, and panics to be appended
** to FILENAME.
*/
g.zErrlog = mprintf("%s", blob_str(&value));
blob_reset(&value);
continue;
}
if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){
/* HOME: VALUE
**
** Set CGI parameter "HOME" to VALUE. This is legacy. Use
** setenv: instead.
*/
cgi_setenv("HOME", blob_str(&value));
blob_reset(&value);
continue;
}
}
blob_reset(&config);
if( g.db==0 && g.zRepositoryName==0 && nRedirect==0 ){
cgi_panic("Unable to find or open the project repository");
}
cgi_init();
|
| ︙ | ︙ |