Fossil SCM
Increase the default HTTP request timeout to 10 minutes. Provide the FOSSIL_DEFAULT_TIMEOUT compile-time option for setting an alternative default.
Commit
7979989dff34a2797dd917c881fe47df15d541cc514bf5fe2204840f93cd294d
Parent
9044fd2dbe7a8ac…
1 file changed
+15
-4
+15
-4
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -58,10 +58,19 @@ | ||
| 58 | 58 | #endif |
| 59 | 59 | #ifdef HAVE_BACKTRACE |
| 60 | 60 | # include <execinfo.h> |
| 61 | 61 | #endif |
| 62 | 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 | + | |
| 63 | 72 | /* |
| 64 | 73 | ** Maximum number of auxiliary parameters on reports |
| 65 | 74 | */ |
| 66 | 75 | #define MX_AUX 5 |
| 67 | 76 | |
| @@ -1949,11 +1958,11 @@ | ||
| 1949 | 1958 | ** into FILE. |
| 1950 | 1959 | ** |
| 1951 | 1960 | ** errorlog: FILE Warnings, errors, and panics written to FILE. |
| 1952 | 1961 | ** |
| 1953 | 1962 | ** timeout: SECONDS Do not run for longer than SECONDS. The default |
| 1954 | -** timeout is 300 seconds. | |
| 1963 | +** timeout is FOSSIL_DEFAULT_TIMEOUT (600) seconds. | |
| 1955 | 1964 | ** |
| 1956 | 1965 | ** extroot: DIR Directory that is the root of the sub-CGI tree |
| 1957 | 1966 | ** on the /ext page. |
| 1958 | 1967 | ** |
| 1959 | 1968 | ** redirect: REPO URL Extract the "name" query parameter and search |
| @@ -1984,11 +1993,11 @@ | ||
| 1984 | 1993 | g.httpOut = stdout; |
| 1985 | 1994 | g.httpIn = stdin; |
| 1986 | 1995 | fossil_binary_mode(g.httpOut); |
| 1987 | 1996 | fossil_binary_mode(g.httpIn); |
| 1988 | 1997 | g.cgiOutput = 1; |
| 1989 | - fossil_set_timeout(300); | |
| 1998 | + fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT); | |
| 1990 | 1999 | blob_read_from_file(&config, zFile, ExtFILE); |
| 1991 | 2000 | while( blob_line(&config, &line) ){ |
| 1992 | 2001 | if( !blob_token(&line, &key) ) continue; |
| 1993 | 2002 | if( blob_buffer(&key)[0]=='#' ) continue; |
| 1994 | 2003 | if( blob_eq(&key, "repository:") && blob_tail(&line, &value) ){ |
| @@ -2114,11 +2123,11 @@ | ||
| 2114 | 2123 | } |
| 2115 | 2124 | if( blob_eq(&key, "timeout:") && blob_token(&line, &value) ){ |
| 2116 | 2125 | /* timeout: SECONDS |
| 2117 | 2126 | ** |
| 2118 | 2127 | ** 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. | |
| 2120 | 2129 | */ |
| 2121 | 2130 | fossil_set_timeout(atoi(blob_str(&value))); |
| 2122 | 2131 | continue; |
| 2123 | 2132 | } |
| 2124 | 2133 | if( blob_eq(&key, "HOME:") && blob_token(&line, &value) ){ |
| @@ -2570,11 +2579,11 @@ | ||
| 2570 | 2579 | int isUiCmd; /* True if command is "ui", not "server' */ |
| 2571 | 2580 | const char *zNotFound; /* The --notfound option or NULL */ |
| 2572 | 2581 | int flags = 0; /* Server flags */ |
| 2573 | 2582 | #if !defined(_WIN32) |
| 2574 | 2583 | 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 */ | |
| 2576 | 2585 | #endif |
| 2577 | 2586 | int allowRepoList; /* List repositories on URL "/" */ |
| 2578 | 2587 | const char *zAltBase; /* Argument to the --baseurl option */ |
| 2579 | 2588 | const char *zFileGlob; /* Static content must match this */ |
| 2580 | 2589 | char *zIpAddr = 0; /* Bind to this IP address */ |
| @@ -2722,10 +2731,12 @@ | ||
| 2722 | 2731 | ** child process, the HTTP or SCGI request is pending on file |
| 2723 | 2732 | ** descriptor 0 and the reply should be written to file descriptor 1. |
| 2724 | 2733 | */ |
| 2725 | 2734 | if( zTimeout ){ |
| 2726 | 2735 | fossil_set_timeout(atoi(zTimeout)); |
| 2736 | + }else{ | |
| 2737 | + fossil_set_timeout(FOSSIL_DEFAULT_TIMEOUT); | |
| 2727 | 2738 | } |
| 2728 | 2739 | g.httpIn = stdin; |
| 2729 | 2740 | g.httpOut = stdout; |
| 2730 | 2741 | |
| 2731 | 2742 | #if !defined(_WIN32) |
| 2732 | 2743 |
| --- 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 |