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.

drh 2019-12-11 11:59 trunk
Commit 20dc0099099effe24d2e7bf848603eba07e5d4b65ceebdbdcf334a98350c2f38
1 file changed +11 -11
+11 -11
--- src/main.c
+++ src/main.c
@@ -2042,11 +2042,11 @@
20422042
g.httpIn = stdin;
20432043
fossil_binary_mode(g.httpOut);
20442044
fossil_binary_mode(g.httpIn);
20452045
g.cgiOutput = 1;
20462046
fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT);
2047
- /* Read and parse the CGI control file. */
2047
+ /* Find the name of the CGI control file */
20482048
if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){
20492049
zFile = g.argv[2];
20502050
}else if( g.argc>=2 ){
20512051
zFile = g.argv[1];
20522052
}else{
@@ -2147,20 +2147,10 @@
21472147
fossil_setenv(blob_str(&value), blob_str(&value2));
21482148
blob_reset(&value);
21492149
blob_reset(&value2);
21502150
continue;
21512151
}
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
- }
21622152
if( blob_eq(&key, "errorlog:") && blob_token(&line, &value) ){
21632153
/* errorlog: FILENAME
21642154
**
21652155
** Causes messages from warnings, errors, and panics to be appended
21662156
** to FILENAME.
@@ -2206,10 +2196,20 @@
22062196
** this directive is a silent no-op.
22072197
*/
22082198
skin_use_alternative(blob_str(&value));
22092199
blob_reset(&value);
22102200
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;
22112211
}
22122212
}
22132213
blob_reset(&config);
22142214
if( g.db==0 && g.zRepositoryName==0 && nRedirect==0 ){
22152215
cgi_panic("Unable to find or open the project repository");
22162216
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button