Fossil SCM

Increase the default HTTP request timeout to 10 minutes. Provide the FOSSIL_DEFAULT_TIMEOUT compile-time option for setting an alternative default.

drh 2019-08-19 13:04 trunk
Commit 7979989dff34a2797dd917c881fe47df15d541cc514bf5fe2204840f93cd294d
1 file changed +15 -4
+15 -4
--- src/main.c
+++ src/main.c
@@ -58,10 +58,19 @@
5858
#endif
5959
#ifdef HAVE_BACKTRACE
6060
# include <execinfo.h>
6161
#endif
6262
63
+/*
64
+** Default length of a timeout for serving an HTTP request. Changable
65
+** using the "--timeout N" command-line option or via "timeout: N" in the
66
+** CGI script.
67
+*/
68
+#ifndef FOSSIL_DEFAULT_TIMEOUT
69
+# define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */
70
+#endif
71
+
6372
/*
6473
** Maximum number of auxiliary parameters on reports
6574
*/
6675
#define MX_AUX 5
6776
@@ -1949,11 +1958,11 @@
19491958
** into FILE.
19501959
**
19511960
** errorlog: FILE Warnings, errors, and panics written to FILE.
19521961
**
19531962
** timeout: SECONDS Do not run for longer than SECONDS. The default
1954
-** timeout is 300 seconds.
1963
+** timeout is FOSSIL_DEFAULT_TIMEOUT (600) seconds.
19551964
**
19561965
** extroot: DIR Directory that is the root of the sub-CGI tree
19571966
** on the /ext page.
19581967
**
19591968
** redirect: REPO URL Extract the "name" query parameter and search
@@ -1984,11 +1993,11 @@
19841993
g.httpOut = stdout;
19851994
g.httpIn = stdin;
19861995
fossil_binary_mode(g.httpOut);
19871996
fossil_binary_mode(g.httpIn);
19881997
g.cgiOutput = 1;
1989
- fossil_set_timeout(300);
1998
+ fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT);
19901999
blob_read_from_file(&config, zFile, ExtFILE);
19912000
while( blob_line(&config, &line) ){
19922001
if( !blob_token(&line, &key) ) continue;
19932002
if( blob_buffer(&key)[0]=='#' ) continue;
19942003
if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
@@ -2114,11 +2123,11 @@
21142123
}
21152124
if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){
21162125
/* timeout: SECONDS
21172126
**
21182127
** Set an alarm() that kills the process after SECONDS. The
2119
- ** default value is 300 seconds.
2128
+ ** default value is FOSSIL_DEFAULT_TIMEOUT (600) seconds.
21202129
*/
21212130
fossil_set_timeout(atoi(blob_str(&value)));
21222131
continue;
21232132
}
21242133
if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){
@@ -2570,11 +2579,11 @@
25702579
int isUiCmd; /* True if command is "ui", not "server' */
25712580
const char *zNotFound; /* The --notfound option or NULL */
25722581
int flags = 0; /* Server flags */
25732582
#if !defined(_WIN32)
25742583
int noJail; /* Do not enter the chroot jail */
2575
- const char *zTimeout = "300"; /* Max runtime of any single HTTP request */
2584
+ const char *zTimeout = 0; /* Max runtime of any single HTTP request */
25762585
#endif
25772586
int allowRepoList; /* List repositories on URL "/" */
25782587
const char *zAltBase; /* Argument to the --baseurl option */
25792588
const char *zFileGlob; /* Static content must match this */
25802589
char *zIpAddr = 0; /* Bind to this IP address */
@@ -2722,10 +2731,12 @@
27222731
** child process, the HTTP or SCGI request is pending on file
27232732
** descriptor 0 and the reply should be written to file descriptor 1.
27242733
*/
27252734
if( zTimeout ){
27262735
fossil_set_timeout(atoi(zTimeout));
2736
+ }else{
2737
+ fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT);
27272738
}
27282739
g.httpIn = stdin;
27292740
g.httpOut = stdout;
27302741
27312742
#if !defined(_WIN32)
27322743
--- src/main.c
+++ src/main.c
@@ -58,10 +58,19 @@
58 #endif
59 #ifdef HAVE_BACKTRACE
60 # include <execinfo.h>
61 #endif
62
 
 
 
 
 
 
 
 
 
63 /*
64 ** Maximum number of auxiliary parameters on reports
65 */
66 #define MX_AUX 5
67
@@ -1949,11 +1958,11 @@
1949 ** into FILE.
1950 **
1951 ** errorlog: FILE Warnings, errors, and panics written to FILE.
1952 **
1953 ** timeout: SECONDS Do not run for longer than SECONDS. The default
1954 ** timeout is 300 seconds.
1955 **
1956 ** extroot: DIR Directory that is the root of the sub-CGI tree
1957 ** on the /ext page.
1958 **
1959 ** redirect: REPO URL Extract the "name" query parameter and search
@@ -1984,11 +1993,11 @@
1984 g.httpOut = stdout;
1985 g.httpIn = stdin;
1986 fossil_binary_mode(g.httpOut);
1987 fossil_binary_mode(g.httpIn);
1988 g.cgiOutput = 1;
1989 fossil_set_timeout(300);
1990 blob_read_from_file(&config, zFile, ExtFILE);
1991 while( blob_line(&config, &line) ){
1992 if( !blob_token(&line, &key) ) continue;
1993 if( blob_buffer(&key)[0]=='#' ) continue;
1994 if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
@@ -2114,11 +2123,11 @@
2114 }
2115 if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){
2116 /* timeout: SECONDS
2117 **
2118 ** Set an alarm() that kills the process after SECONDS. The
2119 ** default value is 300 seconds.
2120 */
2121 fossil_set_timeout(atoi(blob_str(&value)));
2122 continue;
2123 }
2124 if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){
@@ -2570,11 +2579,11 @@
2570 int isUiCmd; /* True if command is "ui", not "server' */
2571 const char *zNotFound; /* The --notfound option or NULL */
2572 int flags = 0; /* Server flags */
2573 #if !defined(_WIN32)
2574 int noJail; /* Do not enter the chroot jail */
2575 const char *zTimeout = "300"; /* Max runtime of any single HTTP request */
2576 #endif
2577 int allowRepoList; /* List repositories on URL "/" */
2578 const char *zAltBase; /* Argument to the --baseurl option */
2579 const char *zFileGlob; /* Static content must match this */
2580 char *zIpAddr = 0; /* Bind to this IP address */
@@ -2722,10 +2731,12 @@
2722 ** child process, the HTTP or SCGI request is pending on file
2723 ** descriptor 0 and the reply should be written to file descriptor 1.
2724 */
2725 if( zTimeout ){
2726 fossil_set_timeout(atoi(zTimeout));
 
 
2727 }
2728 g.httpIn = stdin;
2729 g.httpOut = stdout;
2730
2731 #if !defined(_WIN32)
2732
--- src/main.c
+++ src/main.c
@@ -58,10 +58,19 @@
58 #endif
59 #ifdef HAVE_BACKTRACE
60 # include <execinfo.h>
61 #endif
62
63 /*
64 ** Default length of a timeout for serving an HTTP request. Changable
65 ** using the "--timeout N" command-line option or via "timeout: N" in the
66 ** CGI script.
67 */
68 #ifndef FOSSIL_DEFAULT_TIMEOUT
69 # define FOSSIL_DEFAULT_TIMEOUT 600 /* 10 minutes */
70 #endif
71
72 /*
73 ** Maximum number of auxiliary parameters on reports
74 */
75 #define MX_AUX 5
76
@@ -1949,11 +1958,11 @@
1958 ** into FILE.
1959 **
1960 ** errorlog: FILE Warnings, errors, and panics written to FILE.
1961 **
1962 ** timeout: SECONDS Do not run for longer than SECONDS. The default
1963 ** timeout is FOSSIL_DEFAULT_TIMEOUT (600) seconds.
1964 **
1965 ** extroot: DIR Directory that is the root of the sub-CGI tree
1966 ** on the /ext page.
1967 **
1968 ** redirect: REPO URL Extract the "name" query parameter and search
@@ -1984,11 +1993,11 @@
1993 g.httpOut = stdout;
1994 g.httpIn = stdin;
1995 fossil_binary_mode(g.httpOut);
1996 fossil_binary_mode(g.httpIn);
1997 g.cgiOutput = 1;
1998 fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT);
1999 blob_read_from_file(&config, zFile, ExtFILE);
2000 while( blob_line(&config, &line) ){
2001 if( !blob_token(&line, &key) ) continue;
2002 if( blob_buffer(&key)[0]=='#' ) continue;
2003 if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){
@@ -2114,11 +2123,11 @@
2123 }
2124 if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){
2125 /* timeout: SECONDS
2126 **
2127 ** Set an alarm() that kills the process after SECONDS. The
2128 ** default value is FOSSIL_DEFAULT_TIMEOUT (600) seconds.
2129 */
2130 fossil_set_timeout(atoi(blob_str(&value)));
2131 continue;
2132 }
2133 if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){
@@ -2570,11 +2579,11 @@
2579 int isUiCmd; /* True if command is "ui", not "server' */
2580 const char *zNotFound; /* The --notfound option or NULL */
2581 int flags = 0; /* Server flags */
2582 #if !defined(_WIN32)
2583 int noJail; /* Do not enter the chroot jail */
2584 const char *zTimeout = 0; /* Max runtime of any single HTTP request */
2585 #endif
2586 int allowRepoList; /* List repositories on URL "/" */
2587 const char *zAltBase; /* Argument to the --baseurl option */
2588 const char *zFileGlob; /* Static content must match this */
2589 char *zIpAddr = 0; /* Bind to this IP address */
@@ -2722,10 +2731,12 @@
2731 ** child process, the HTTP or SCGI request is pending on file
2732 ** descriptor 0 and the reply should be written to file descriptor 1.
2733 */
2734 if( zTimeout ){
2735 fossil_set_timeout(atoi(zTimeout));
2736 }else{
2737 fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT);
2738 }
2739 g.httpIn = stdin;
2740 g.httpOut = stdout;
2741
2742 #if !defined(_WIN32)
2743

Keyboard Shortcuts

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