Browse Source

[core] const char *name in struct plugin

put void *data (always used) as first member of struct plugin

add int nconfig member to PLUGIN_DATA

calloc() inits p->data to NULL
personal/stbuehler/ci-build
Glenn Strauss 2 years ago
parent
commit
e2de4e581e
  1. 2
      src/base.h
  2. 2
      src/connections.c
  3. 4
      src/mod_access.c
  4. 4
      src/mod_accesslog.c
  5. 4
      src/mod_alias.c
  6. 4
      src/mod_auth.c
  7. 4
      src/mod_authn_file.c
  8. 4
      src/mod_authn_gssapi.c
  9. 4
      src/mod_authn_ldap.c
  10. 4
      src/mod_authn_mysql.c
  11. 3
      src/mod_authn_pam.c
  12. 4
      src/mod_authn_sasl.c
  13. 4
      src/mod_cgi.c
  14. 4
      src/mod_cml.c
  15. 4
      src/mod_compress.c
  16. 4
      src/mod_deflate.c
  17. 4
      src/mod_dirlisting.c
  18. 4
      src/mod_evasive.c
  19. 4
      src/mod_evhost.c
  20. 4
      src/mod_expire.c
  21. 4
      src/mod_extforward.c
  22. 4
      src/mod_fastcgi.c
  23. 4
      src/mod_flv_streaming.c
  24. 4
      src/mod_geoip.c
  25. 4
      src/mod_indexfile.c
  26. 4
      src/mod_magnet.c
  27. 5
      src/mod_maxminddb.c
  28. 2
      src/mod_mysql_vhost.c
  29. 4
      src/mod_openssl.c
  30. 4
      src/mod_proxy.c
  31. 4
      src/mod_redirect.c
  32. 4
      src/mod_rewrite.c
  33. 4
      src/mod_rrdtool.c
  34. 4
      src/mod_scgi.c
  35. 4
      src/mod_secdownload.c
  36. 4
      src/mod_setenv.c
  37. 4
      src/mod_simple_vhost.c
  38. 3
      src/mod_skeleton.c
  39. 4
      src/mod_sockproxy.c
  40. 4
      src/mod_ssi.c
  41. 4
      src/mod_staticfile.c
  42. 16
      src/mod_status.c
  43. 4
      src/mod_trigger_b4_dl.c
  44. 4
      src/mod_uploadprogress.c
  45. 4
      src/mod_userdir.c
  46. 4
      src/mod_usertrack.c
  47. 4
      src/mod_vhostdb.c
  48. 2
      src/mod_vhostdb_dbi.c
  49. 2
      src/mod_vhostdb_ldap.c
  50. 2
      src/mod_vhostdb_mysql.c
  51. 2
      src/mod_vhostdb_pgsql.c
  52. 5
      src/mod_webdav.c
  53. 3
      src/mod_wstunnel.c
  54. 40
      src/plugin.c
  55. 41
      src/plugin.h
  56. 10
      src/server.c

2
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;

2
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

3
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;

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

5
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;

2
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;

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

3
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;

4
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;
}

4
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;
}

4
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;
}

16
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(
"<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\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("<br />"));
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

4
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;
}

2
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;

2
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;

2
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;

2
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;

5
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;

3
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;
}

40
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)) {

41
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__

10
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) {

Loading…
Cancel
Save