From 0c9b4d42ffc5f6184558b11b53b3a0be88d2b88f Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Fri, 15 Jul 2005 13:26:16 +0000 Subject: [PATCH] made errorfile-prefix conditional git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@446 152afb58-edef-0310-8abb-c4023f1b3aa9 --- src/base.h | 2 +- src/config.c | 8 +++++++- src/connections.c | 4 ++-- src/server.c | 2 -- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/base.h b/src/base.h index ddb09606..d5f1f3d8 100644 --- a/src/base.h +++ b/src/base.h @@ -224,6 +224,7 @@ typedef struct { buffer *server_tag; buffer *dirlist_css; buffer *dirlist_encoding; + buffer *errorfile_prefix; unsigned short dir_listing; unsigned short hide_dotfiles; @@ -407,7 +408,6 @@ typedef struct { buffer *username; buffer *groupname; - buffer *errorfile_prefix; buffer *license; buffer *pid_file; diff --git a/src/config.c b/src/config.c index 65484f2a..2e6ce0dd 100644 --- a/src/config.c +++ b/src/config.c @@ -93,7 +93,6 @@ static int config_insert(server *srv) { /* 0 */ cv[0].destination = srv->srvconf.bindhost; cv[1].destination = srv->srvconf.error_logfile; - cv[2].destination = srv->srvconf.errorfile_prefix; cv[3].destination = srv->srvconf.changeroot; cv[4].destination = srv->srvconf.username; cv[5].destination = srv->srvconf.groupname; @@ -127,6 +126,7 @@ static int config_insert(server *srv) { s->ssl_ca_file = buffer_init(); s->error_handler = buffer_init(); s->server_tag = buffer_init(); + s->errorfile_prefix = buffer_init(); s->dirlist_css = buffer_init(); s->dirlist_encoding = buffer_init(); s->max_keep_alive_requests = 128; @@ -143,6 +143,8 @@ static int config_insert(server *srv) { s->global_bytes_per_second_cnt = 0; s->global_bytes_per_second_cnt_ptr = &s->global_bytes_per_second_cnt; + cv[2].destination = s->errorfile_prefix; + cv[7].destination = s->server_tag; cv[8].destination = &(s->use_ipv6); @@ -208,11 +210,13 @@ int config_setup_connection(server *srv, connection *con) { PATCH(max_write_idle); PATCH(use_xattr); PATCH(error_handler); + PATCH(errorfile_prefix); PATCH(follow_symlink); PATCH(server_tag); PATCH(kbytes_per_second); PATCH(global_kbytes_per_second); PATCH(global_bytes_per_second_cnt); + con->conf.global_bytes_per_second_cnt_ptr = &s->global_bytes_per_second_cnt; buffer_copy_string_buffer(con->server_name, s->server_name); @@ -254,6 +258,8 @@ int config_patch_connection(server *srv, connection *con, const char *stage, siz PATCH(dirlist_encoding); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.error-handler-404"))) { PATCH(error_handler); + } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.errorfi"))) { + PATCH(errorfile_prefix); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("server.indexfiles"))) { PATCH(indexfiles); } else if (buffer_is_equal_string(du->key, CONST_STR_LEN("mimetype.assign"))) { diff --git a/src/connections.c b/src/connections.c index 470d0a78..d89a542b 100644 --- a/src/connections.c +++ b/src/connections.c @@ -322,8 +322,8 @@ static int connection_handle_write_prepare(server *srv, connection *con) { */ buffer_reset(con->physical.path); - if (srv->srvconf.errorfile_prefix->used) { - buffer_copy_string_buffer(con->physical.path, srv->srvconf.errorfile_prefix); + if (con->conf.errorfile_prefix->used) { + buffer_copy_string_buffer(con->physical.path, con->conf.errorfile_prefix); buffer_append_string(con->physical.path, get_http_status_body_name(con->http_status)); } diff --git a/src/server.c b/src/server.c index a720a4d7..e042cea2 100644 --- a/src/server.c +++ b/src/server.c @@ -136,7 +136,6 @@ static server *server_init(void) { CLEAN(srvconf.username); CLEAN(srvconf.changeroot); CLEAN(srvconf.bindhost); - CLEAN(srvconf.errorfile_prefix); CLEAN(srvconf.license); CLEAN(srvconf.event_handler); CLEAN(srvconf.pid_file); @@ -216,7 +215,6 @@ static void server_free(server *srv) { CLEAN(srvconf.username); CLEAN(srvconf.changeroot); CLEAN(srvconf.bindhost); - CLEAN(srvconf.errorfile_prefix); CLEAN(srvconf.license); CLEAN(srvconf.event_handler); CLEAN(srvconf.pid_file);