Fossil SCM

Ouput an error if the CGI control file is missing on the command line. This prevents IIS to fall in a endless loop.

tsbg 2019-08-31 13:04 trunk
Commit 6a59d33e3d1f95022c7e75705bf3d85540d54d90725bbdbe97d8e3e2124a40e6
1 file changed +10 -5
+10 -5
--- src/main.c
+++ src/main.c
@@ -1994,21 +1994,26 @@
19941994
char **azRedirect = 0; /* List of repositories to redirect to */
19951995
int nRedirect = 0; /* Number of entries in azRedirect */
19961996
Glob *pFileGlob = 0; /* Pattern for files */
19971997
int allowRepoList = 0; /* Allow lists of repository files */
19981998
Blob config, line, key, value, value2;
1999
- if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){
2000
- zFile = g.argv[2];
2001
- }else{
2002
- zFile = g.argv[1];
2003
- }
1999
+ /* Initialize the CGI environment. */
20042000
g.httpOut = stdout;
20052001
g.httpIn = stdin;
20062002
fossil_binary_mode(g.httpOut);
20072003
fossil_binary_mode(g.httpIn);
20082004
g.cgiOutput = 1;
20092005
fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT);
2006
+ /* Read and parse the CGI control file. */
2007
+ if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){
2008
+ zFile = g.argv[2];
2009
+ }else if( g.argc>=2 ){
2010
+ zFile = g.argv[1];
2011
+ }else{
2012
+ cgi_panic("No CGI control file specified");
2013
+ }
2014
+ /* Read and parse the CGI control file. */
20102015
blob_read_from_file(&config, zFile, ExtFILE);
20112016
while( blob_line(&config, &line) ){
20122017
if( !blob_token(&line, &key) ) continue;
20132018
if( blob_buffer(&key)[0]=='#' ) continue;
20142019
if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
20152020
--- src/main.c
+++ src/main.c
@@ -1994,21 +1994,26 @@
1994 char **azRedirect = 0; /* List of repositories to redirect to */
1995 int nRedirect = 0; /* Number of entries in azRedirect */
1996 Glob *pFileGlob = 0; /* Pattern for files */
1997 int allowRepoList = 0; /* Allow lists of repository files */
1998 Blob config, line, key, value, value2;
1999 if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){
2000 zFile = g.argv[2];
2001 }else{
2002 zFile = g.argv[1];
2003 }
2004 g.httpOut = stdout;
2005 g.httpIn = stdin;
2006 fossil_binary_mode(g.httpOut);
2007 fossil_binary_mode(g.httpIn);
2008 g.cgiOutput = 1;
2009 fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT);
 
 
 
 
 
 
 
 
 
2010 blob_read_from_file(&config, zFile, ExtFILE);
2011 while( blob_line(&config, &line) ){
2012 if( !blob_token(&line, &key) ) continue;
2013 if( blob_buffer(&key)[0]=='#' ) continue;
2014 if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
2015
--- src/main.c
+++ src/main.c
@@ -1994,21 +1994,26 @@
1994 char **azRedirect = 0; /* List of repositories to redirect to */
1995 int nRedirect = 0; /* Number of entries in azRedirect */
1996 Glob *pFileGlob = 0; /* Pattern for files */
1997 int allowRepoList = 0; /* Allow lists of repository files */
1998 Blob config, line, key, value, value2;
1999 /* Initialize the CGI environment. */
 
 
 
 
2000 g.httpOut = stdout;
2001 g.httpIn = stdin;
2002 fossil_binary_mode(g.httpOut);
2003 fossil_binary_mode(g.httpIn);
2004 g.cgiOutput = 1;
2005 fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT);
2006 /* Read and parse the CGI control file. */
2007 if( g.argc==3 && fossil_strcmp(g.argv[1],"cgi")==0 ){
2008 zFile = g.argv[2];
2009 }else if( g.argc>=2 ){
2010 zFile = g.argv[1];
2011 }else{
2012 cgi_panic("No CGI control file specified");
2013 }
2014 /* Read and parse the CGI control file. */
2015 blob_read_from_file(&config, zFile, ExtFILE);
2016 while( blob_line(&config, &line) ){
2017 if( !blob_token(&line, &key) ) continue;
2018 if( blob_buffer(&key)[0]=='#' ) continue;
2019 if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
2020

Keyboard Shortcuts

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