diff --git a/src/base.h b/src/base.h index db6bdee5..dfca5f03 100644 --- a/src/base.h +++ b/src/base.h @@ -257,7 +257,7 @@ struct connection { array environment; /* used to pass lighttpd internal stuff to the FastCGI/CGI apps, setenv does that */ - unsigned int mode; /* DIRECT (0) or plugin id */ + int mode; /* DIRECT (0) or plugin id */ int async_callback; log_error_st *errh; diff --git a/src/connections.c b/src/connections.c index d7408542..1861a180 100644 --- a/src/connections.c +++ b/src/connections.c @@ -144,7 +144,7 @@ static int connection_close(server *srv, connection *con) { plugin *p = ((plugin **)(srv->plugins.ptr))[i]; plugin_data *pd = p->data; if (!pd || NULL == con->plugin_ctx[pd->id]) continue; - log_error_write(srv, __FILE__, __LINE__, "sb", + log_error_write(srv, __FILE__, __LINE__, "ss", "missing cleanup in", p->name); con->plugin_ctx[pd->id] = NULL; } diff --git a/src/mod_access.c b/src/mod_access.c index 280127f6..8f6148bb 100644 --- a/src/mod_access.c +++ b/src/mod_access.c @@ -201,7 +201,7 @@ URIHANDLER_FUNC(mod_access_uri_handler) { int mod_access_plugin_init(plugin *p); int mod_access_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("access"); + p->name = "access"; p->init = mod_access_init; p->set_defaults = mod_access_set_defaults; @@ -209,7 +209,5 @@ int mod_access_plugin_init(plugin *p) { p->handle_subrequest_start = mod_access_uri_handler; p->cleanup = mod_access_free; - p->data = NULL; - return 0; } diff --git a/src/mod_accesslog.c b/src/mod_accesslog.c index 092bc678..8e45e7cb 100644 --- a/src/mod_accesslog.c +++ b/src/mod_accesslog.c @@ -1141,7 +1141,7 @@ REQUESTDONE_FUNC(log_access_write) { int mod_accesslog_plugin_init(plugin *p); int mod_accesslog_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("accesslog"); + p->name = "accesslog"; p->init = mod_accesslog_init; p->set_defaults= log_access_open; @@ -1151,7 +1151,5 @@ int mod_accesslog_plugin_init(plugin *p) { p->handle_trigger = log_access_periodic_flush; p->handle_sighup = log_access_cycle; - p->data = NULL; - return 0; } diff --git a/src/mod_alias.c b/src/mod_alias.c index 33f02890..389a5276 100644 --- a/src/mod_alias.c +++ b/src/mod_alias.c @@ -209,14 +209,12 @@ PHYSICALPATH_FUNC(mod_alias_physical_handler) { int mod_alias_plugin_init(plugin *p); int mod_alias_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("alias"); + p->name = "alias"; p->init = mod_alias_init; p->handle_physical= mod_alias_physical_handler; p->set_defaults = mod_alias_set_defaults; p->cleanup = mod_alias_free; - p->data = NULL; - return 0; } diff --git a/src/mod_auth.c b/src/mod_auth.c index 2777fda2..93ccdf11 100644 --- a/src/mod_auth.c +++ b/src/mod_auth.c @@ -490,14 +490,12 @@ static handler_t mod_auth_uri_handler(server *srv, connection *con, void *p_d) { int mod_auth_plugin_init(plugin *p); int mod_auth_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("auth"); + p->name = "auth"; p->init = mod_auth_init; p->set_defaults = mod_auth_set_defaults; p->handle_uri_clean = mod_auth_uri_handler; p->cleanup = mod_auth_free; - p->data = NULL; - return 0; } diff --git a/src/mod_authn_file.c b/src/mod_authn_file.c index c6f1bf51..8cd5d0d4 100644 --- a/src/mod_authn_file.c +++ b/src/mod_authn_file.c @@ -769,12 +769,10 @@ static handler_t mod_authn_file_htpasswd_basic(server *srv, connection *con, voi int mod_authn_file_plugin_init(plugin *p); int mod_authn_file_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("authn_file"); + p->name = "authn_file"; p->init = mod_authn_file_init; p->set_defaults= mod_authn_file_set_defaults; p->cleanup = mod_authn_file_free; - p->data = NULL; - return 0; } diff --git a/src/mod_authn_gssapi.c b/src/mod_authn_gssapi.c index 3897e9cd..23154d98 100644 --- a/src/mod_authn_gssapi.c +++ b/src/mod_authn_gssapi.c @@ -810,13 +810,11 @@ CONNECTION_FUNC(mod_authn_gssapi_handle_reset) { int mod_authn_gssapi_plugin_init(plugin *p); int mod_authn_gssapi_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("authn_gssapi"); + p->name = "authn_gssapi"; p->init = mod_authn_gssapi_init; p->set_defaults= mod_authn_gssapi_set_defaults; p->cleanup = mod_authn_gssapi_free; p->connection_reset = mod_authn_gssapi_handle_reset; - p->data = NULL; - return 0; } diff --git a/src/mod_authn_ldap.c b/src/mod_authn_ldap.c index 4c810cc2..ee2c5503 100644 --- a/src/mod_authn_ldap.c +++ b/src/mod_authn_ldap.c @@ -685,12 +685,10 @@ static handler_t mod_authn_ldap_basic(server *srv, connection *con, void *p_d, c int mod_authn_ldap_plugin_init(plugin *p); int mod_authn_ldap_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("authn_ldap"); + p->name = "authn_ldap"; p->init = mod_authn_ldap_init; p->set_defaults = mod_authn_ldap_set_defaults; p->cleanup = mod_authn_ldap_free; - p->data = NULL; - return 0; } diff --git a/src/mod_authn_mysql.c b/src/mod_authn_mysql.c index 6e41c5fb..dc11a706 100644 --- a/src/mod_authn_mysql.c +++ b/src/mod_authn_mysql.c @@ -544,12 +544,10 @@ static handler_t mod_authn_mysql_digest(server *srv, connection *con, void *p_d, int mod_authn_mysql_plugin_init(plugin *p); int mod_authn_mysql_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("authn_mysql"); + p->name = "authn_mysql"; p->init = mod_authn_mysql_init; p->set_defaults= mod_authn_mysql_set_defaults; p->cleanup = mod_authn_mysql_free; - p->data = NULL; - return 0; } diff --git a/src/mod_authn_pam.c b/src/mod_authn_pam.c index 7b7cbbea..c9676b93 100644 --- a/src/mod_authn_pam.c +++ b/src/mod_authn_pam.c @@ -174,8 +174,7 @@ static handler_t mod_authn_pam_basic(server *srv, connection *con, void *p_d, co int mod_authn_pam_plugin_init(plugin *p); int mod_authn_pam_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("authn_pam"); - p->data = NULL; + p->name = "authn_pam"; p->init = mod_authn_pam_init; p->cleanup = mod_authn_pam_free; p->set_defaults= mod_authn_pam_set_defaults; diff --git a/src/mod_authn_sasl.c b/src/mod_authn_sasl.c index 4a8b162a..83d06408 100644 --- a/src/mod_authn_sasl.c +++ b/src/mod_authn_sasl.c @@ -274,12 +274,10 @@ static handler_t mod_authn_sasl_basic(server *srv, connection *con, void *p_d, c int mod_authn_sasl_plugin_init(plugin *p); int mod_authn_sasl_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("authn_sasl"); + p->name = "authn_sasl"; p->init = mod_authn_sasl_init; p->set_defaults= mod_authn_sasl_set_defaults; p->cleanup = mod_authn_sasl_free; - p->data = NULL; - return 0; } diff --git a/src/mod_cgi.c b/src/mod_cgi.c index 89bc0ce5..1bad2e67 100644 --- a/src/mod_cgi.c +++ b/src/mod_cgi.c @@ -1052,7 +1052,7 @@ static handler_t cgi_waitpid_cb(server *srv, void *p_d, pid_t pid, int status) { int mod_cgi_plugin_init(plugin *p); int mod_cgi_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("cgi"); + p->name = "cgi"; p->connection_reset = cgi_connection_close_callback; p->handle_subrequest_start = cgi_is_handled; @@ -1062,7 +1062,5 @@ int mod_cgi_plugin_init(plugin *p) { p->cleanup = mod_cgi_free; p->set_defaults = mod_fastcgi_set_defaults; - p->data = NULL; - return 0; } diff --git a/src/mod_cml.c b/src/mod_cml.c index 8b26d5f5..aa448eb3 100644 --- a/src/mod_cml.c +++ b/src/mod_cml.c @@ -324,7 +324,7 @@ URIHANDLER_FUNC(mod_cml_is_handled) { int mod_cml_plugin_init(plugin *p); int mod_cml_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("cache"); + p->name = "cache"; p->init = mod_cml_init; p->cleanup = mod_cml_free; @@ -333,7 +333,5 @@ int mod_cml_plugin_init(plugin *p) { p->handle_subrequest_start = mod_cml_is_handled; p->handle_physical = mod_cml_power_magnet; - p->data = NULL; - return 0; } diff --git a/src/mod_compress.c b/src/mod_compress.c index b14e2067..b34be15d 100644 --- a/src/mod_compress.c +++ b/src/mod_compress.c @@ -1009,14 +1009,12 @@ PHYSICALPATH_FUNC(mod_compress_physical) { int mod_compress_plugin_init(plugin *p); int mod_compress_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("compress"); + p->name = "compress"; p->init = mod_compress_init; p->set_defaults = mod_compress_setdefaults; p->handle_subrequest_start = mod_compress_physical; p->cleanup = mod_compress_free; - p->data = NULL; - return 0; } diff --git a/src/mod_deflate.c b/src/mod_deflate.c index 5a03fcb3..afe0ae6a 100644 --- a/src/mod_deflate.c +++ b/src/mod_deflate.c @@ -1273,7 +1273,7 @@ static handler_t mod_deflate_cleanup(server *srv, connection *con, void *p_d) { int mod_deflate_plugin_init(plugin *p); int mod_deflate_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("deflate"); + p->name = "deflate"; p->init = mod_deflate_init; p->cleanup = mod_deflate_free; @@ -1281,7 +1281,5 @@ int mod_deflate_plugin_init(plugin *p) { p->connection_reset = mod_deflate_cleanup; p->handle_response_start = mod_deflate_handle_response_start; - p->data = NULL; - return 0; } diff --git a/src/mod_dirlisting.c b/src/mod_dirlisting.c index 98c5ba99..3d7723ed 100644 --- a/src/mod_dirlisting.c +++ b/src/mod_dirlisting.c @@ -1187,14 +1187,12 @@ URIHANDLER_FUNC(mod_dirlisting_subrequest) { int mod_dirlisting_plugin_init(plugin *p); int mod_dirlisting_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("dirlisting"); + p->name = "dirlisting"; p->init = mod_dirlisting_init; p->handle_subrequest_start = mod_dirlisting_subrequest; p->set_defaults = mod_dirlisting_set_defaults; p->cleanup = mod_dirlisting_free; - p->data = NULL; - return 0; } diff --git a/src/mod_evasive.c b/src/mod_evasive.c index d7b8a693..1cba050e 100644 --- a/src/mod_evasive.c +++ b/src/mod_evasive.c @@ -192,14 +192,12 @@ URIHANDLER_FUNC(mod_evasive_uri_handler) { int mod_evasive_plugin_init(plugin *p); int mod_evasive_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("evasive"); + p->name = "evasive"; p->init = mod_evasive_init; p->set_defaults = mod_evasive_set_defaults; p->handle_uri_clean = mod_evasive_uri_handler; p->cleanup = mod_evasive_free; - p->data = NULL; - return 0; } diff --git a/src/mod_evhost.c b/src/mod_evhost.c index e5bb985d..da5f39d7 100644 --- a/src/mod_evhost.c +++ b/src/mod_evhost.c @@ -364,14 +364,12 @@ static handler_t mod_evhost_uri_handler(server *srv, connection *con, void *p_d) int mod_evhost_plugin_init(plugin *p); int mod_evhost_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("evhost"); + p->name = "evhost"; p->init = mod_evhost_init; p->set_defaults = mod_evhost_set_defaults; p->handle_docroot = mod_evhost_uri_handler; p->cleanup = mod_evhost_free; - p->data = NULL; - return 0; } diff --git a/src/mod_expire.c b/src/mod_expire.c index bfa44574..e99d1ca4 100644 --- a/src/mod_expire.c +++ b/src/mod_expire.c @@ -410,14 +410,12 @@ CONNECTION_FUNC(mod_expire_handler) { int mod_expire_plugin_init(plugin *p); int mod_expire_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("expire"); + p->name = "expire"; p->init = mod_expire_init; p->handle_response_start = mod_expire_handler; p->set_defaults = mod_expire_set_defaults; p->cleanup = mod_expire_free; - p->data = NULL; - return 0; } diff --git a/src/mod_extforward.c b/src/mod_extforward.c index 81f2dbb2..e9a93351 100644 --- a/src/mod_extforward.c +++ b/src/mod_extforward.c @@ -1168,7 +1168,7 @@ CONNECTION_FUNC(mod_extforward_handle_con_accept) int mod_extforward_plugin_init(plugin *p); int mod_extforward_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("extforward"); + p->name = "extforward"; p->init = mod_extforward_init; p->handle_connection_accept = mod_extforward_handle_con_accept; @@ -1180,8 +1180,6 @@ int mod_extforward_plugin_init(plugin *p) { p->set_defaults = mod_extforward_set_defaults; p->cleanup = mod_extforward_free; - p->data = NULL; - return 0; } diff --git a/src/mod_fastcgi.c b/src/mod_fastcgi.c index a188960c..544750c7 100644 --- a/src/mod_fastcgi.c +++ b/src/mod_fastcgi.c @@ -523,7 +523,7 @@ static handler_t fcgi_check_extension_2(server *srv, connection *con, void *p_d) int mod_fastcgi_plugin_init(plugin *p); int mod_fastcgi_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("fastcgi"); + p->name = "fastcgi"; p->init = gw_init; p->cleanup = gw_free; @@ -535,7 +535,5 @@ int mod_fastcgi_plugin_init(plugin *p) { p->handle_trigger = gw_handle_trigger; p->handle_waitpid = gw_handle_waitpid_cb; - p->data = NULL; - return 0; } diff --git a/src/mod_flv_streaming.c b/src/mod_flv_streaming.c index 4cf09a83..b26bcd4b 100644 --- a/src/mod_flv_streaming.c +++ b/src/mod_flv_streaming.c @@ -176,14 +176,12 @@ URIHANDLER_FUNC(mod_flv_streaming_path_handler) { int mod_flv_streaming_plugin_init(plugin *p); int mod_flv_streaming_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("flv_streaming"); + p->name = "flv_streaming"; p->init = mod_flv_streaming_init; p->handle_physical = mod_flv_streaming_path_handler; p->set_defaults = mod_flv_streaming_set_defaults; p->cleanup = mod_flv_streaming_free; - p->data = NULL; - return 0; } diff --git a/src/mod_geoip.c b/src/mod_geoip.c index 13e307b2..2968747f 100644 --- a/src/mod_geoip.c +++ b/src/mod_geoip.c @@ -291,14 +291,12 @@ CONNECTION_FUNC(mod_geoip_handle_request_env) { int mod_geoip_plugin_init(plugin *p); int mod_geoip_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("geoip"); + p->name = "geoip"; p->init = mod_geoip_init; p->handle_request_env = mod_geoip_handle_request_env; p->set_defaults = mod_geoip_set_defaults; p->cleanup = mod_geoip_free; - p->data = NULL; - return 0; } diff --git a/src/mod_indexfile.c b/src/mod_indexfile.c index f9280c37..6a54d422 100644 --- a/src/mod_indexfile.c +++ b/src/mod_indexfile.c @@ -221,14 +221,12 @@ URIHANDLER_FUNC(mod_indexfile_subrequest) { int mod_indexfile_plugin_init(plugin *p); int mod_indexfile_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("indexfile"); + p->name = "indexfile"; p->init = mod_indexfile_init; p->handle_subrequest_start = mod_indexfile_subrequest; p->set_defaults = mod_indexfile_set_defaults; p->cleanup = mod_indexfile_free; - p->data = NULL; - return 0; } diff --git a/src/mod_magnet.c b/src/mod_magnet.c index 8d8911f7..d2fbb65c 100644 --- a/src/mod_magnet.c +++ b/src/mod_magnet.c @@ -1103,7 +1103,7 @@ URIHANDLER_FUNC(mod_magnet_physical) { int mod_magnet_plugin_init(plugin *p); int mod_magnet_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("magnet"); + p->name = "magnet"; p->init = mod_magnet_init; p->handle_uri_clean = mod_magnet_uri_handler; @@ -1111,7 +1111,5 @@ int mod_magnet_plugin_init(plugin *p) { p->set_defaults = mod_magnet_set_defaults; p->cleanup = mod_magnet_free; - p->data = NULL; - return 0; } diff --git a/src/mod_maxminddb.c b/src/mod_maxminddb.c index 519187fb..cb817d20 100644 --- a/src/mod_maxminddb.c +++ b/src/mod_maxminddb.c @@ -73,7 +73,7 @@ CONNECTION_FUNC(mod_maxmind_handle_con_close); int mod_maxminddb_plugin_init(plugin *p); int mod_maxminddb_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("maxminddb"); + p->name = "maxminddb"; p->set_defaults = mod_maxmind_set_defaults; p->init = mod_maxmind_init; @@ -81,8 +81,6 @@ int mod_maxminddb_plugin_init(plugin *p) { p->handle_request_env = mod_maxmind_request_env_handler; p->handle_connection_close = mod_maxmind_handle_con_close; - p->data = NULL; - return 0; } @@ -96,7 +94,6 @@ typedef struct { typedef struct { PLUGIN_DATA; - int nconfig; plugin_config **config_storage; } plugin_data; diff --git a/src/mod_mysql_vhost.c b/src/mod_mysql_vhost.c index 5430c26c..709f65c4 100644 --- a/src/mod_mysql_vhost.c +++ b/src/mod_mysql_vhost.c @@ -367,7 +367,7 @@ ERR500: int mod_mysql_vhost_plugin_init(plugin *p); int mod_mysql_vhost_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("mysql_vhost"); + p->name = "mysql_vhost"; p->init = mod_mysql_vhost_init; p->cleanup = mod_mysql_vhost_cleanup; diff --git a/src/mod_openssl.c b/src/mod_openssl.c index e04d8416..d6cd20b8 100644 --- a/src/mod_openssl.c +++ b/src/mod_openssl.c @@ -2201,7 +2201,7 @@ int mod_openssl_plugin_init (plugin *p); int mod_openssl_plugin_init (plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("openssl"); + p->name = "openssl"; p->init = mod_openssl_init; p->cleanup = mod_openssl_free; p->priv_defaults= mod_openssl_set_defaults; @@ -2213,7 +2213,5 @@ int mod_openssl_plugin_init (plugin *p) p->handle_request_env = mod_openssl_handle_request_env; p->connection_reset = mod_openssl_handle_request_reset; - p->data = NULL; - return 0; } diff --git a/src/mod_proxy.c b/src/mod_proxy.c index 01d84526..b74ead44 100644 --- a/src/mod_proxy.c +++ b/src/mod_proxy.c @@ -1021,7 +1021,7 @@ static handler_t mod_proxy_check_extension(server *srv, connection *con, void *p int mod_proxy_plugin_init(plugin *p); int mod_proxy_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("proxy"); + p->name = "proxy"; p->init = mod_proxy_init; p->cleanup = mod_proxy_free; @@ -1032,7 +1032,5 @@ int mod_proxy_plugin_init(plugin *p) { p->handle_trigger = gw_handle_trigger; p->handle_waitpid = gw_handle_waitpid_cb; - p->data = NULL; - return 0; } diff --git a/src/mod_redirect.c b/src/mod_redirect.c index 90a5ddac..5b71a428 100644 --- a/src/mod_redirect.c +++ b/src/mod_redirect.c @@ -189,14 +189,12 @@ URIHANDLER_FUNC(mod_redirect_uri_handler) { int mod_redirect_plugin_init(plugin *p); int mod_redirect_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("redirect"); + p->name = "redirect"; p->init = mod_redirect_init; p->handle_uri_clean = mod_redirect_uri_handler; p->set_defaults = mod_redirect_set_defaults; p->cleanup = mod_redirect_free; - p->data = NULL; - return 0; } diff --git a/src/mod_rewrite.c b/src/mod_rewrite.c index 77b5b22d..d9988232 100644 --- a/src/mod_rewrite.c +++ b/src/mod_rewrite.c @@ -319,7 +319,7 @@ URIHANDLER_FUNC(mod_rewrite_uri_handler) { int mod_rewrite_plugin_init(plugin *p); int mod_rewrite_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("rewrite"); + p->name = "rewrite"; p->init = mod_rewrite_init; /* it has to stay _raw as we are matching on uri + querystring @@ -331,7 +331,5 @@ int mod_rewrite_plugin_init(plugin *p) { p->connection_reset = mod_rewrite_con_reset; p->set_defaults = mod_rewrite_set_defaults; - p->data = NULL; - return 0; } diff --git a/src/mod_rrdtool.c b/src/mod_rrdtool.c index 794b79a6..fb82424d 100644 --- a/src/mod_rrdtool.c +++ b/src/mod_rrdtool.c @@ -465,7 +465,7 @@ REQUESTDONE_FUNC(mod_rrd_account) { int mod_rrdtool_plugin_init(plugin *p); int mod_rrdtool_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("rrd"); + p->name = "rrd"; p->init = mod_rrd_init; p->cleanup = mod_rrd_free; @@ -475,7 +475,5 @@ int mod_rrdtool_plugin_init(plugin *p) { p->handle_waitpid = mod_rrd_waitpid_cb; p->handle_request_done = mod_rrd_account; - p->data = NULL; - return 0; } diff --git a/src/mod_scgi.c b/src/mod_scgi.c index 8c801f84..13e33a43 100644 --- a/src/mod_scgi.c +++ b/src/mod_scgi.c @@ -308,7 +308,7 @@ static handler_t scgi_check_extension_2(server *srv, connection *con, void *p_d) int mod_scgi_plugin_init(plugin *p); int mod_scgi_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("scgi"); + p->name = "scgi"; p->init = gw_init; p->cleanup = gw_free; @@ -320,7 +320,5 @@ int mod_scgi_plugin_init(plugin *p) { p->handle_trigger = gw_handle_trigger; p->handle_waitpid = gw_handle_waitpid_cb; - p->data = NULL; - return 0; } diff --git a/src/mod_secdownload.c b/src/mod_secdownload.c index b4cf6eb3..800e0adb 100644 --- a/src/mod_secdownload.c +++ b/src/mod_secdownload.c @@ -557,14 +557,12 @@ URIHANDLER_FUNC(mod_secdownload_uri_handler) { int mod_secdownload_plugin_init(plugin *p); int mod_secdownload_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("secdownload"); + p->name = "secdownload"; p->init = mod_secdownload_init; p->handle_physical = mod_secdownload_uri_handler; p->set_defaults = mod_secdownload_set_defaults; p->cleanup = mod_secdownload_free; - p->data = NULL; - return 0; } diff --git a/src/mod_setenv.c b/src/mod_setenv.c index e5339c5f..7b690c95 100644 --- a/src/mod_setenv.c +++ b/src/mod_setenv.c @@ -296,7 +296,7 @@ CONNECTION_FUNC(mod_setenv_reset) { int mod_setenv_plugin_init(plugin *p); int mod_setenv_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("setenv"); + p->name = "setenv"; p->init = mod_setenv_init; p->handle_uri_clean = mod_setenv_uri_handler; @@ -307,7 +307,5 @@ int mod_setenv_plugin_init(plugin *p) { p->connection_reset = mod_setenv_reset; - p->data = NULL; - return 0; } diff --git a/src/mod_simple_vhost.c b/src/mod_simple_vhost.c index 89e25481..1821e8ae 100644 --- a/src/mod_simple_vhost.c +++ b/src/mod_simple_vhost.c @@ -276,14 +276,12 @@ static handler_t mod_simple_vhost_docroot(server *srv, connection *con, void *p_ int mod_simple_vhost_plugin_init(plugin *p); int mod_simple_vhost_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("simple_vhost"); + p->name = "simple_vhost"; p->init = mod_simple_vhost_init; p->set_defaults = mod_simple_vhost_set_defaults; p->handle_docroot = mod_simple_vhost_docroot; p->cleanup = mod_simple_vhost_free; - p->data = NULL; - return 0; } diff --git a/src/mod_skeleton.c b/src/mod_skeleton.c index 35f59bf9..6a17e061 100644 --- a/src/mod_skeleton.c +++ b/src/mod_skeleton.c @@ -170,8 +170,7 @@ URIHANDLER_FUNC(mod_skeleton_uri_handler) { int mod_skeleton_plugin_init(plugin *p); int mod_skeleton_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("skeleton"); - p->data = NULL; + p->name = "skeleton"; p->init = mod_skeleton_init; p->cleanup = mod_skeleton_free; p->set_defaults= mod_skeleton_set_defaults; diff --git a/src/mod_sockproxy.c b/src/mod_sockproxy.c index 32761191..f365babe 100644 --- a/src/mod_sockproxy.c +++ b/src/mod_sockproxy.c @@ -162,7 +162,7 @@ static handler_t mod_sockproxy_connection_accept(server *srv, connection *con, v int mod_sockproxy_plugin_init(plugin *p); int mod_sockproxy_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("sockproxy"); + p->name = "sockproxy"; p->init = gw_init; p->cleanup = gw_free; @@ -173,7 +173,5 @@ int mod_sockproxy_plugin_init(plugin *p) { p->handle_trigger = gw_handle_trigger; p->handle_waitpid = gw_handle_waitpid_cb; - p->data = NULL; - return 0; } diff --git a/src/mod_ssi.c b/src/mod_ssi.c index d2e3eb4f..3d0d4f36 100644 --- a/src/mod_ssi.c +++ b/src/mod_ssi.c @@ -1354,7 +1354,7 @@ static handler_t mod_ssi_connection_reset(server *srv, connection *con, void *p_ int mod_ssi_plugin_init(plugin *p); int mod_ssi_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("ssi"); + p->name = "ssi"; p->init = mod_ssi_init; p->handle_subrequest_start = mod_ssi_physical_path; @@ -1363,7 +1363,5 @@ int mod_ssi_plugin_init(plugin *p) { p->set_defaults = mod_ssi_set_defaults; p->cleanup = mod_ssi_free; - p->data = NULL; - return 0; } diff --git a/src/mod_staticfile.c b/src/mod_staticfile.c index 3e1e85be..59701748 100644 --- a/src/mod_staticfile.c +++ b/src/mod_staticfile.c @@ -207,14 +207,12 @@ URIHANDLER_FUNC(mod_staticfile_subrequest) { int mod_staticfile_plugin_init(plugin *p); int mod_staticfile_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("staticfile"); + p->name = "staticfile"; p->init = mod_staticfile_init; p->handle_subrequest_start = mod_staticfile_subrequest; p->set_defaults = mod_staticfile_set_defaults; p->cleanup = mod_staticfile_free; - p->data = NULL; - return 0; } diff --git a/src/mod_status.c b/src/mod_status.c index 91cdf6d5..63c32bb6 100644 --- a/src/mod_status.c +++ b/src/mod_status.c @@ -791,6 +791,7 @@ static handler_t mod_status_handle_server_config(server *srv, connection *con, v plugin_data *p = p_d; buffer *b = chunkqueue_append_buffer_open(con->write_queue); buffer *m = p->module_list; + buffer_clear(m); buffer_copy_string_len(b, CONST_STR_LEN( "\n" @@ -820,16 +821,11 @@ static handler_t mod_status_handle_server_config(server *srv, connection *con, v mod_status_header_append(b, "Config-File-Settings"); for (uint32_t i = 0; i < srv->plugins.used; ++i) { - plugin **ps = srv->plugins.ptr; - - plugin *pl = ps[i]; - - if (i == 0) { - buffer_copy_buffer(m, pl->name); - } else { + const char *name = ((plugin **)srv->plugins.ptr)[i]->name; + if (i != 0) { buffer_append_string_len(m, CONST_STR_LEN("
")); - buffer_append_string_buffer(m, pl->name); } + buffer_append_string_len(m, name, strlen(name)); } mod_status_row_append(b, "Loaded Modules", m->ptr); @@ -954,7 +950,7 @@ REQUESTDONE_FUNC(mod_status_account) { int mod_status_plugin_init(plugin *p); int mod_status_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("status"); + p->name = "status"; p->init = mod_status_init; p->cleanup = mod_status_free; @@ -964,7 +960,5 @@ int mod_status_plugin_init(plugin *p) { p->handle_trigger = mod_status_trigger; p->handle_request_done = mod_status_account; - p->data = NULL; - return 0; } diff --git a/src/mod_trigger_b4_dl.c b/src/mod_trigger_b4_dl.c index 9a817a5b..4fe9145e 100644 --- a/src/mod_trigger_b4_dl.c +++ b/src/mod_trigger_b4_dl.c @@ -590,7 +590,7 @@ TRIGGER_FUNC(mod_trigger_b4_dl_handle_trigger) { int mod_trigger_b4_dl_plugin_init(plugin *p); int mod_trigger_b4_dl_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("trigger_b4_dl"); + p->name = "trigger_b4_dl"; p->init = mod_trigger_b4_dl_init; p->handle_uri_clean = mod_trigger_b4_dl_uri_handler; @@ -600,7 +600,5 @@ int mod_trigger_b4_dl_plugin_init(plugin *p) { #endif p->cleanup = mod_trigger_b4_dl_free; - p->data = NULL; - return 0; } diff --git a/src/mod_uploadprogress.c b/src/mod_uploadprogress.c index dae3e4f3..13b4bd54 100644 --- a/src/mod_uploadprogress.c +++ b/src/mod_uploadprogress.c @@ -393,7 +393,7 @@ REQUESTDONE_FUNC(mod_uploadprogress_request_done) { int mod_uploadprogress_plugin_init(plugin *p); int mod_uploadprogress_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("uploadprogress"); + p->name = "uploadprogress"; p->init = mod_uploadprogress_init; p->handle_uri_clean = mod_uploadprogress_uri_handler; @@ -401,7 +401,5 @@ int mod_uploadprogress_plugin_init(plugin *p) { p->set_defaults = mod_uploadprogress_set_defaults; p->cleanup = mod_uploadprogress_free; - p->data = NULL; - return 0; } diff --git a/src/mod_userdir.c b/src/mod_userdir.c index 038c2eeb..e6b9535a 100644 --- a/src/mod_userdir.c +++ b/src/mod_userdir.c @@ -335,14 +335,12 @@ URIHANDLER_FUNC(mod_userdir_docroot_handler) { int mod_userdir_plugin_init(plugin *p); int mod_userdir_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("userdir"); + p->name = "userdir"; p->init = mod_userdir_init; p->handle_physical = mod_userdir_docroot_handler; p->set_defaults = mod_userdir_set_defaults; p->cleanup = mod_userdir_free; - p->data = NULL; - return 0; } diff --git a/src/mod_usertrack.c b/src/mod_usertrack.c index f0d861b5..036c4d23 100644 --- a/src/mod_usertrack.c +++ b/src/mod_usertrack.c @@ -271,14 +271,12 @@ URIHANDLER_FUNC(mod_usertrack_uri_handler) { int mod_usertrack_plugin_init(plugin *p); int mod_usertrack_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("usertrack"); + p->name = "usertrack"; p->init = mod_usertrack_init; p->handle_uri_clean = mod_usertrack_uri_handler; p->set_defaults = mod_usertrack_set_defaults; p->cleanup = mod_usertrack_free; - p->data = NULL; - return 0; } diff --git a/src/mod_vhostdb.c b/src/mod_vhostdb.c index 192c22e8..183f1436 100644 --- a/src/mod_vhostdb.c +++ b/src/mod_vhostdb.c @@ -226,14 +226,12 @@ CONNECTION_FUNC(mod_vhostdb_handle_docroot) { int mod_vhostdb_plugin_init(plugin *p); int mod_vhostdb_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("vhostdb"); + p->name = "vhostdb"; p->init = mod_vhostdb_init; p->cleanup = mod_vhostdb_free; p->set_defaults = mod_vhostdb_set_defaults; p->handle_docroot = mod_vhostdb_handle_docroot; p->connection_reset = mod_vhostdb_handle_connection_close; - p->data = NULL; - return 0; } diff --git a/src/mod_vhostdb_dbi.c b/src/mod_vhostdb_dbi.c index 327bbc3e..6b751a9c 100644 --- a/src/mod_vhostdb_dbi.c +++ b/src/mod_vhostdb_dbi.c @@ -320,7 +320,7 @@ int mod_vhostdb_dbi_plugin_init (plugin *p); int mod_vhostdb_dbi_plugin_init (plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("vhostdb_dbi"); + p->name = "vhostdb_dbi"; p->init = mod_vhostdb_init; p->cleanup = mod_vhostdb_cleanup; diff --git a/src/mod_vhostdb_ldap.c b/src/mod_vhostdb_ldap.c index e8eea3ec..3f09234f 100644 --- a/src/mod_vhostdb_ldap.c +++ b/src/mod_vhostdb_ldap.c @@ -548,7 +548,7 @@ int mod_vhostdb_ldap_plugin_init (plugin *p); int mod_vhostdb_ldap_plugin_init (plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("vhostdb_ldap"); + p->name = "vhostdb_ldap"; p->init = mod_vhostdb_init; p->cleanup = mod_vhostdb_cleanup; diff --git a/src/mod_vhostdb_mysql.c b/src/mod_vhostdb_mysql.c index e617188a..753d0a9d 100644 --- a/src/mod_vhostdb_mysql.c +++ b/src/mod_vhostdb_mysql.c @@ -284,7 +284,7 @@ int mod_vhostdb_mysql_plugin_init (plugin *p); int mod_vhostdb_mysql_plugin_init (plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("vhostdb_mysql"); + p->name = "vhostdb_mysql"; p->init = mod_vhostdb_init; p->cleanup = mod_vhostdb_cleanup; diff --git a/src/mod_vhostdb_pgsql.c b/src/mod_vhostdb_pgsql.c index 36182213..261e4be2 100644 --- a/src/mod_vhostdb_pgsql.c +++ b/src/mod_vhostdb_pgsql.c @@ -261,7 +261,7 @@ int mod_vhostdb_pgsql_plugin_init (plugin *p); int mod_vhostdb_pgsql_plugin_init (plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("vhostdb_pgsql"); + p->name = "vhostdb_pgsql"; p->init = mod_vhostdb_init; p->cleanup = mod_vhostdb_cleanup; diff --git a/src/mod_webdav.c b/src/mod_webdav.c index 9229441f..66e19443 100644 --- a/src/mod_webdav.c +++ b/src/mod_webdav.c @@ -238,7 +238,7 @@ CONNECTION_FUNC(mod_webdav_handle_reset); int mod_webdav_plugin_init(plugin *p); int mod_webdav_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("webdav"); + p->name = "webdav"; p->init = mod_webdav_init; p->cleanup = mod_webdav_free; @@ -249,8 +249,6 @@ int mod_webdav_plugin_init(plugin *p) { p->handle_subrequest = mod_webdav_subrequest_handler; p->connection_reset = mod_webdav_handle_reset; - p->data = NULL; - return 0; } @@ -327,7 +325,6 @@ typedef struct { typedef struct { PLUGIN_DATA; - int nconfig; plugin_config **config_storage; } plugin_data; diff --git a/src/mod_wstunnel.c b/src/mod_wstunnel.c index 6b20d78b..a84c3b6c 100644 --- a/src/mod_wstunnel.c +++ b/src/mod_wstunnel.c @@ -638,7 +638,7 @@ TRIGGER_FUNC(mod_wstunnel_handle_trigger) { int mod_wstunnel_plugin_init(plugin *p); int mod_wstunnel_plugin_init(plugin *p) { p->version = LIGHTTPD_VERSION_ID; - p->name = buffer_init_string("wstunnel"); + p->name = "wstunnel"; p->init = mod_wstunnel_init; p->cleanup = mod_wstunnel_free; p->set_defaults = mod_wstunnel_set_defaults; @@ -647,7 +647,6 @@ int mod_wstunnel_plugin_init(plugin *p) { p->handle_subrequest = gw_handle_subrequest; p->handle_trigger = mod_wstunnel_handle_trigger; p->handle_waitpid = gw_handle_waitpid_cb; - p->data = NULL; return 0; } diff --git a/src/plugin.c b/src/plugin.c index ab02827c..b74734ce 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -65,26 +65,20 @@ static plugin *plugin_init(void) { } static void plugin_free(plugin *p) { -#if !defined(LIGHTTPD_STATIC) - int use_dlclose = 1; -#endif - - if (p->name) buffer_free(p->name); -#if defined(HAVE_VALGRIND_VALGRIND_H) && !defined(LIGHTTPD_STATIC) - /*if (RUNNING_ON_VALGRIND) use_dlclose = 0;*/ -#endif - -#if !defined(LIGHTTPD_STATIC) - if (use_dlclose && p->lib) { -#if defined(__WIN32) -) FreeLibrary(p->lib); -#else - dlclose(p->lib); -#endif - } -#endif - - free(p); + #if !defined(LIGHTTPD_STATIC) + if (p->lib) { + #if defined(HAVE_VALGRIND_VALGRIND_H) + /*if (!RUNNING_ON_VALGRIND) */ + #endif + #if defined(__WIN32) + FreeLibrary(p->lib); + #else + dlclose(p->lib); + #endif + } + #endif + + free(p); } static int plugins_register(server *srv, plugin *p) { @@ -455,7 +449,7 @@ handler_t plugins_call_init(server *srv) { if (p->init) { if (NULL == (p->data = p->init())) { - log_error_write(srv, __FILE__, __LINE__, "sb", + log_error_write(srv, __FILE__, __LINE__, "ss", "plugin-init failed for module", p->name); return HANDLER_ERROR; } @@ -464,12 +458,10 @@ handler_t plugins_call_init(server *srv) { ((plugin_data *)(p->data))->id = i + 1; if (p->version != LIGHTTPD_VERSION_ID) { - log_error_write(srv, __FILE__, __LINE__, "sb", + log_error_write(srv, __FILE__, __LINE__, "ss", "plugin-version doesn't match lighttpd-version for", p->name); return HANDLER_ERROR; } - } else { - p->data = NULL; } if (p->priv_defaults && HANDLER_ERROR==p->priv_defaults(srv, p->data)) { diff --git a/src/plugin.h b/src/plugin.h index 03864b2c..889ad9d4 100644 --- a/src/plugin.h +++ b/src/plugin.h @@ -27,23 +27,11 @@ #define REQUESTDONE_FUNC CONNECTION_FUNC #define URIHANDLER_FUNC CONNECTION_FUNC -#define PLUGIN_DATA size_t id +#define PLUGIN_DATA int id; int nconfig typedef struct { - size_t version; - - buffer *name; /* name of the plugin */ - - void *(* init) (); - handler_t (* priv_defaults) (server *srv, void *p_d); - handler_t (* set_defaults) (server *srv, void *p_d); - handler_t (* worker_init) (server *srv, void *p_d); /* at server startup (each worker after fork()) */ - handler_t (* cleanup) (server *srv, void *p_d); + void *data; /* is called ... */ - handler_t (* handle_trigger) (server *srv, void *p_d); /* once a second */ - handler_t (* handle_sighup) (server *srv, void *p_d); /* at a sighup */ - handler_t (* handle_waitpid) (server *srv, void *p_d, pid_t pid, int status); /* upon a child process exit */ - handler_t (* handle_uri_raw) (server *srv, connection *con, void *p_d); /* after uri_raw is set */ handler_t (* handle_uri_clean) (server *srv, connection *con, void *p_d); /* after uri is set */ handler_t (* handle_docroot) (server *srv, connection *con, void *p_d); /* getting the document-root */ @@ -53,21 +41,24 @@ typedef struct { handler_t (* handle_connection_accept) (server *srv, connection *con, void *p_d); /* after accept() socket */ handler_t (* handle_connection_shut_wr)(server *srv, connection *con, void *p_d); /* done writing to socket */ handler_t (* handle_connection_close) (server *srv, connection *con, void *p_d); /* before close() of socket */ - - - - handler_t (* handle_subrequest_start)(server *srv, connection *con, void *p_d); - - /* when a handler for the request - * has to be found - */ + handler_t (* handle_subrequest_start)(server *srv, connection *con, void *p_d); /* when handler for request not found yet */ handler_t (* handle_subrequest) (server *srv, connection *con, void *p_d); /* */ handler_t (* handle_response_start) (server *srv, connection *con, void *p_d); /* before response headers are written */ handler_t (* connection_reset) (server *srv, connection *con, void *p_d); /* after request done or request abort */ - void *data; - /* dlopen handle */ - void *lib; + handler_t (* handle_trigger) (server *srv, void *p_d); /* once a second */ + handler_t (* handle_sighup) (server *srv, void *p_d); /* at a sighup */ + handler_t (* handle_waitpid) (server *srv, void *p_d, pid_t pid, int status); /* upon a child process exit */ + + void *(* init) (); + handler_t (* priv_defaults) (server *srv, void *p_d); + handler_t (* set_defaults) (server *srv, void *p_d); + handler_t (* worker_init) (server *srv, void *p_d); /* at server startup (each worker after fork()) */ + handler_t (* cleanup) (server *srv, void *p_d); + + const char *name;/* name of the plugin */ + size_t version; + void *lib; /* dlopen handle */ } plugin; __attribute_cold__ diff --git a/src/server.c b/src/server.c index af3de8a6..28204656 100644 --- a/src/server.c +++ b/src/server.c @@ -1185,13 +1185,11 @@ static int server_main (server * const srv, int argc, char **argv) { /* mod_indexfile should be listed in server.modules prior to dynamic handlers */ i = 0; - for (buffer *pname = NULL; i < srv->plugins.used; ++i) { + for (const char *pname = NULL; i < srv->plugins.used; ++i) { plugin *p = ((plugin **)srv->plugins.ptr)[i]; - if (buffer_is_equal_string(p->name, CONST_STR_LEN("indexfile"))) { - if (pname) { - log_error_write(srv, __FILE__, __LINE__, "SB", - "Warning: mod_indexfile should be listed in server.modules prior to mod_", pname); - } + if (NULL != pname && 0 == strcmp(p->name, "indexfile")) { + log_error_write(srv, __FILE__, __LINE__, "SS", + "Warning: mod_indexfile should be listed in server.modules prior to mod_", pname); break; } if (p->handle_subrequest_start && p->handle_subrequest) {