Fossil SCM
Fix an incorrect comment in the CGI handler. When parsing the CGI control file, check for "debug:" last, as it is the most infrequent option.
Commit
20dc0099099effe24d2e7bf848603eba07e5d4b65ceebdbdcf334a98350c2f38
Parent
edcde1fdaef5193…
1 file changed
+11
-11
+11
-11
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -2042,11 +2042,11 @@ | ||
| 2042 | 2042 | g.httpIn = stdin; |
| 2043 | 2043 | fossil_binary_mode(g.httpOut); |
| 2044 | 2044 | fossil_binary_mode(g.httpIn); |
| 2045 | 2045 | g.cgiOutput = 1; |
| 2046 | 2046 | fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT); |
| 2047 | - /* Read and parse the CGI control file. */ | |
| 2047 | + /* Find the name of the CGI control file */ | |
| 2048 | 2048 | if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){ |
| 2049 | 2049 | zFile = g.argv[2]; |
| 2050 | 2050 | }else if( g.argc>=2 ){ |
| 2051 | 2051 | zFile = g.argv[1]; |
| 2052 | 2052 | }else{ |
| @@ -2147,20 +2147,10 @@ | ||
| 2147 | 2147 | fossil_setenv(blob_str(&value), blob_str(&value2)); |
| 2148 | 2148 | blob_reset(&value); |
| 2149 | 2149 | blob_reset(&value2); |
| 2150 | 2150 | continue; |
| 2151 | 2151 | } |
| 2152 | - if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){ | |
| 2153 | - /* debug: FILENAME | |
| 2154 | - ** | |
| 2155 | - ** Causes output from cgi_debug() and CGIDEBUG(()) calls to go | |
| 2156 | - ** into FILENAME. | |
| 2157 | - */ | |
| 2158 | - g.fDebug = fossil_fopen(blob_str(&value), "ab"); | |
| 2159 | - blob_reset(&value); | |
| 2160 | - continue; | |
| 2161 | - } | |
| 2162 | 2152 | if( blob_eq(&key, "errorlog:") && blob_token(&line, &value) ){ |
| 2163 | 2153 | /* errorlog: FILENAME |
| 2164 | 2154 | ** |
| 2165 | 2155 | ** Causes messages from warnings, errors, and panics to be appended |
| 2166 | 2156 | ** to FILENAME. |
| @@ -2206,10 +2196,20 @@ | ||
| 2206 | 2196 | ** this directive is a silent no-op. |
| 2207 | 2197 | */ |
| 2208 | 2198 | skin_use_alternative(blob_str(&value)); |
| 2209 | 2199 | blob_reset(&value); |
| 2210 | 2200 | continue; |
| 2201 | + } | |
| 2202 | + if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){ | |
| 2203 | + /* debug: FILENAME | |
| 2204 | + ** | |
| 2205 | + ** Causes output from cgi_debug() and CGIDEBUG(()) calls to go | |
| 2206 | + ** into FILENAME. | |
| 2207 | + */ | |
| 2208 | + g.fDebug = fossil_fopen(blob_str(&value), "ab"); | |
| 2209 | + blob_reset(&value); | |
| 2210 | + continue; | |
| 2211 | 2211 | } |
| 2212 | 2212 | } |
| 2213 | 2213 | blob_reset(&config); |
| 2214 | 2214 | if( g.db==0 && g.zRepositoryName==0 && nRedirect==0 ){ |
| 2215 | 2215 | cgi_panic("Unable to find or open the project repository"); |
| 2216 | 2216 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2042,11 +2042,11 @@ | |
| 2042 | g.httpIn = stdin; |
| 2043 | fossil_binary_mode(g.httpOut); |
| 2044 | fossil_binary_mode(g.httpIn); |
| 2045 | g.cgiOutput = 1; |
| 2046 | fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT); |
| 2047 | /* Read and parse the CGI control file. */ |
| 2048 | if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){ |
| 2049 | zFile = g.argv[2]; |
| 2050 | }else if( g.argc>=2 ){ |
| 2051 | zFile = g.argv[1]; |
| 2052 | }else{ |
| @@ -2147,20 +2147,10 @@ | |
| 2147 | fossil_setenv(blob_str(&value), blob_str(&value2)); |
| 2148 | blob_reset(&value); |
| 2149 | blob_reset(&value2); |
| 2150 | continue; |
| 2151 | } |
| 2152 | if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){ |
| 2153 | /* debug: FILENAME |
| 2154 | ** |
| 2155 | ** Causes output from cgi_debug() and CGIDEBUG(()) calls to go |
| 2156 | ** into FILENAME. |
| 2157 | */ |
| 2158 | g.fDebug = fossil_fopen(blob_str(&value), "ab"); |
| 2159 | blob_reset(&value); |
| 2160 | continue; |
| 2161 | } |
| 2162 | if( blob_eq(&key, "errorlog:") && blob_token(&line, &value) ){ |
| 2163 | /* errorlog: FILENAME |
| 2164 | ** |
| 2165 | ** Causes messages from warnings, errors, and panics to be appended |
| 2166 | ** to FILENAME. |
| @@ -2206,10 +2196,20 @@ | |
| 2206 | ** this directive is a silent no-op. |
| 2207 | */ |
| 2208 | skin_use_alternative(blob_str(&value)); |
| 2209 | blob_reset(&value); |
| 2210 | continue; |
| 2211 | } |
| 2212 | } |
| 2213 | blob_reset(&config); |
| 2214 | if( g.db==0 && g.zRepositoryName==0 && nRedirect==0 ){ |
| 2215 | cgi_panic("Unable to find or open the project repository"); |
| 2216 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -2042,11 +2042,11 @@ | |
| 2042 | g.httpIn = stdin; |
| 2043 | fossil_binary_mode(g.httpOut); |
| 2044 | fossil_binary_mode(g.httpIn); |
| 2045 | g.cgiOutput = 1; |
| 2046 | fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT); |
| 2047 | /* Find the name of the CGI control file */ |
| 2048 | if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){ |
| 2049 | zFile = g.argv[2]; |
| 2050 | }else if( g.argc>=2 ){ |
| 2051 | zFile = g.argv[1]; |
| 2052 | }else{ |
| @@ -2147,20 +2147,10 @@ | |
| 2147 | fossil_setenv(blob_str(&value), blob_str(&value2)); |
| 2148 | blob_reset(&value); |
| 2149 | blob_reset(&value2); |
| 2150 | continue; |
| 2151 | } |
| 2152 | if( blob_eq(&key, "errorlog:") && blob_token(&line, &value) ){ |
| 2153 | /* errorlog: FILENAME |
| 2154 | ** |
| 2155 | ** Causes messages from warnings, errors, and panics to be appended |
| 2156 | ** to FILENAME. |
| @@ -2206,10 +2196,20 @@ | |
| 2196 | ** this directive is a silent no-op. |
| 2197 | */ |
| 2198 | skin_use_alternative(blob_str(&value)); |
| 2199 | blob_reset(&value); |
| 2200 | continue; |
| 2201 | } |
| 2202 | if( blob_eq(&key, "debug:") && blob_token(&line, &value) ){ |
| 2203 | /* debug: FILENAME |
| 2204 | ** |
| 2205 | ** Causes output from cgi_debug() and CGIDEBUG(()) calls to go |
| 2206 | ** into FILENAME. |
| 2207 | */ |
| 2208 | g.fDebug = fossil_fopen(blob_str(&value), "ab"); |
| 2209 | blob_reset(&value); |
| 2210 | continue; |
| 2211 | } |
| 2212 | } |
| 2213 | blob_reset(&config); |
| 2214 | if( g.db==0 && g.zRepositoryName==0 && nRedirect==0 ){ |
| 2215 | cgi_panic("Unable to find or open the project repository"); |
| 2216 |