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.
Commit
6a59d33e3d1f95022c7e75705bf3d85540d54d90725bbdbe97d8e3e2124a40e6
Parent
f304ba31fe42e2d…
1 file changed
+10
-5
+10
-5
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1994,21 +1994,26 @@ | ||
| 1994 | 1994 | char **azRedirect = 0; /* List of repositories to redirect to */ |
| 1995 | 1995 | int nRedirect = 0; /* Number of entries in azRedirect */ |
| 1996 | 1996 | Glob *pFileGlob = 0; /* Pattern for files */ |
| 1997 | 1997 | int allowRepoList = 0; /* Allow lists of repository files */ |
| 1998 | 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 | - } | |
| 1999 | + /* Initialize the CGI environment. */ | |
| 2004 | 2000 | g.httpOut = stdout; |
| 2005 | 2001 | g.httpIn = stdin; |
| 2006 | 2002 | fossil_binary_mode(g.httpOut); |
| 2007 | 2003 | fossil_binary_mode(g.httpIn); |
| 2008 | 2004 | g.cgiOutput = 1; |
| 2009 | 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. */ | |
| 2010 | 2015 | blob_read_from_file(&config, zFile, ExtFILE); |
| 2011 | 2016 | while( blob_line(&config, &line) ){ |
| 2012 | 2017 | if( !blob_token(&line, &key) ) continue; |
| 2013 | 2018 | if( blob_buffer(&key)[0]=='#' ) continue; |
| 2014 | 2019 | if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){ |
| 2015 | 2020 |
| --- 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 |