Feature #2642
closedadd option for "fail on warning"
Description
I'd really like to see an option to treat warnings as errors, ergo terminate execution if a warning occurs, somewhat like the -Werror option of gcc.
The reason behind this is, that I'd rather like my web server not to start at all than have it go up in a potentially insecure configuration due to accidental misconfiguration.
If for instance an unknown config-key warning occurs, it makes sense to sort that out before resuming operation, as it indicates that the config is not understood by lighttpd in the way the user intended.
Since I assume that not everybody shares my "safety first" attitude regarding this matter, I propose to make that behaviour optional, perhaps by adding a command line parameter or an option in the config file.
Updated by gstrauss almost 9 years ago
This might be obtainable with lighttpd config test mode:
-t test the config-file, and exit
If successful, "Syntax OK" is printed to stdout. You might treat any warning output (to stderr) as indication of a config error.
Updated by gstrauss over 8 years ago
Related ticket https://redmine.lighttpd.net/issues/411
Updated by gstrauss over 8 years ago
- Status changed from New to Fixed
- Target version changed from 1.4.x to 1.4.40
https://github.com/lighttpd/lighttpd1.4/pull/44 was committed in r3130
lighttpd -tt (two -tt) processes the config file up through the unknown config key warnings, actually initializing all modules (except binding to sockets and opening log files). While this exits 0 unless there is an error, you can easily write a script to capture stderr and to treat any output to stderr as an error.
Updated by gstrauss over 8 years ago
- Status changed from Fixed to Patch Pending
I missed adding preflight checks around mod_fastcgi and mod_scgi spawning of local backend processes. Please apply this additional patch.
diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c index 9c50fa7..a9c300a 100644 --- a/src/mod_fastcgi.c +++ b/src/mod_fastcgi.c @@ -1428,7 +1428,8 @@ SETDEFAULTS_FUNC(mod_fastcgi_set_defaults) { "\n\tcurrent:", pno, "/", host->max_procs); } - if (fcgi_spawn_connection(srv, p, host, proc)) { + if (!srv->srvconf.preflight_check + && fcgi_spawn_connection(srv, p, host, proc)) { log_error_write(srv, __FILE__, __LINE__, "s", "[ERROR]: spawning fcgi failed."); fastcgi_process_free(proc); diff --git a/src/mod_scgi.c b/src/mod_scgi.c index b7b6b3b..308c9df 100644 --- a/src/mod_scgi.c +++ b/src/mod_scgi.c @@ -1189,7 +1189,8 @@ SETDEFAULTS_FUNC(mod_scgi_set_defaults) { "\n\tcurrent:", pno, "/", df->min_procs); } - if (scgi_spawn_connection(srv, p, df, proc)) { + if (!srv->srvconf.preflight_check + && scgi_spawn_connection(srv, p, df, proc)) { log_error_write(srv, __FILE__, __LINE__, "s", "[ERROR]: spawning fcgi failed."); scgi_process_free(proc);
Also available in: Atom