summaryrefslogtreecommitdiff
path: root/src/configfile.c
diff options
context:
space:
mode:
authorGlenn Strauss <gstrauss@gluelogic.com>2017-02-11 14:35:28 -0500
committerGlenn Strauss <gstrauss@gluelogic.com>2017-02-11 14:59:15 -0500
commit8f651a2b305f638ff2abec93a04a9ef2d967242a (patch)
tree6005da2ae8d4da25b467e476a7950c27ac11eee7 /src/configfile.c
parentaa923e05f6af9a51681c1bc50fc840976e5536fd (diff)
downloadlighttpd-git-8f651a2b305f638ff2abec93a04a9ef2d967242a.tar.gz
[core] config opt to intercept dynamic handler err (fixes #974)
new directive server.error-intercept = [ "enable" | "disable" ] to intercept 4xx and 5xx responses from dynamic handlers (e.g. CGI, FastCGI, SCGI, proxy) Intercepted HTTP error status are then handled by one of server.error-handler server.error-handler-404 server.errorfile-prefix (if configured) Do not use server.error-intercept with locations handled by mod_webdav! x-ref: "would like something similar to nginx proxy_intercept_errors" https://redmine.lighttpd.net/issues/974
Diffstat (limited to 'src/configfile.c')
-rw-r--r--src/configfile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/configfile.c b/src/configfile.c
index beea7552..577ba6cd 100644
--- a/src/configfile.c
+++ b/src/configfile.c
@@ -163,6 +163,7 @@ static int config_insert(server *srv) {
{ "server.stream-request-body", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 76 */
{ "server.stream-response-body", NULL, T_CONFIG_SHORT, T_CONFIG_SCOPE_CONNECTION }, /* 77 */
{ "server.max-request-field-size", NULL, T_CONFIG_INT, T_CONFIG_SCOPE_SERVER }, /* 78 */
+ { "server.error-intercept", NULL, T_CONFIG_BOOLEAN, T_CONFIG_SCOPE_CONNECTION }, /* 79 */
{ NULL, NULL, T_CONFIG_UNSET, T_CONFIG_SCOPE_UNSET }
};
@@ -254,6 +255,7 @@ static int config_insert(server *srv) {
s->listen_backlog = (0 == i ? 1024 : srv->config_storage[0]->listen_backlog);
s->stream_request_body = 0;
s->stream_response_body = 0;
+ s->error_intercept = 0;
/* all T_CONFIG_SCOPE_CONNECTION options */
cv[2].destination = s->errorfile_prefix;
@@ -319,6 +321,7 @@ static int config_insert(server *srv) {
#endif
cv[76].destination = &(s->stream_request_body);
cv[77].destination = &(s->stream_response_body);
+ cv[79].destination = &(s->error_intercept);
srv->config_storage[i] = s;
@@ -514,6 +517,7 @@ int config_setup_connection(server *srv, connection *con) {
PATCH(use_xattr);
PATCH(error_handler);
PATCH(error_handler_404);
+ PATCH(error_intercept);
PATCH(errorfile_prefix);
#ifdef HAVE_LSTAT
PATCH(follow_symlink);
@@ -569,6 +573,8 @@ int config_patch_connection(server *srv, connection *con) {
PATCH(error_handler);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.error-handler-404"))) {
PATCH(error_handler_404);
+ } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.error-intercept"))) {
+ PATCH(error_intercept);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.errorfile-prefix"))) {
PATCH(errorfile_prefix);
} else if (buffer_is_equal_string(du->key, CONST_STR_LEN("mimetype.assign"))) {