Skip to content
Browse files

git-svn-id: svn://cherokee-project.com/cherokee/trunk@476 5dc97367-97…

…f1-0310-9951-d761b3857238
  • Loading branch information...
1 parent 3cbd17a commit b69d2e030319ca557665afcc408e475490f942e7 @alobbs alobbs committed Nov 30, 2006
Showing with 1,011 additions and 876 deletions.
  1. +51 −1 ChangeLog
  2. +3 −2 cherokee/Makefile.am
  3. +6 −6 cherokee/balancer.c
  4. +24 −3 cherokee/balancer.h
  5. +9 −13 cherokee/balancer_round_robin.c
  6. +2 −1 cherokee/cherokee.h
  7. +6 −6 cherokee/config_entry.c
  8. +2 −2 cherokee/config_entry.h
  9. +2 −2 cherokee/encoder.c
  10. +23 −1 cherokee/encoder.h
  11. +9 −27 cherokee/encoder_gzip.c
  12. +1 −1 cherokee/encoder_gzip.h
  13. +2 −2 cherokee/encoder_table.c
  14. +6 −6 cherokee/encoder_table.h
  15. +21 −4 cherokee/handler.c
  16. +39 −2 cherokee/handler.h
  17. +9 −20 cherokee/handler_admin.c
  18. +2 −2 cherokee/handler_admin.h
  19. +14 −10 cherokee/handler_cgi.c
  20. +5 −5 cherokee/handler_cgi.h
  21. +22 −14 cherokee/handler_cgi_base.c
  22. +44 −27 cherokee/handler_cgi_base.h
  23. +8 −8 cherokee/handler_common.c
  24. +2 −1 cherokee/handler_common.h
  25. +11 −23 cherokee/handler_dirlist.c
  26. +3 −3 cherokee/handler_dirlist.h
  27. +13 −1 cherokee/handler_error.c
  28. +3 −3 cherokee/handler_error.h
  29. +5 −5 cherokee/handler_error_redir.c
  30. +3 −3 cherokee/handler_error_redir.h
  31. +14 −18 cherokee/handler_fastcgi.c
  32. +22 −15 cherokee/handler_fastcgi.h
  33. +18 −19 cherokee/handler_fcgi.c
  34. +16 −14 cherokee/handler_fcgi.h
  35. +11 −21 cherokee/handler_file.c
  36. +4 −4 cherokee/handler_file.h
  37. +6 −7 cherokee/handler_nn.c
  38. +2 −2 cherokee/handler_nn.h
  39. +10 −7 cherokee/handler_phpcgi.c
  40. +1 −2 cherokee/handler_phpcgi.h
  41. +8 −18 cherokee/handler_proxy.c
  42. +2 −2 cherokee/handler_proxy.h
  43. +9 −12 cherokee/handler_redir.c
  44. +3 −3 cherokee/handler_redir.h
  45. +14 −13 cherokee/handler_scgi.c
  46. +3 −3 cherokee/handler_scgi.h
  47. +11 −16 cherokee/handler_server_info.c
  48. +3 −3 cherokee/handler_server_info.h
  49. +6 −9 cherokee/logger.c
  50. +32 −21 cherokee/logger.h
  51. +10 −20 cherokee/logger_combined.c
  52. +6 −25 cherokee/logger_ncsa.c
  53. +1 −1 cherokee/logger_ncsa.h
  54. +8 −30 cherokee/logger_w3c.c
  55. +22 −16 cherokee/module.c
  56. +19 −98 cherokee/module.h
  57. +139 −0 cherokee/plugin.h
  58. +48 −46 cherokee/{module_loader.c → plugin_loader.c}
  59. +18 −19 cherokee/{module_loader.h → plugin_loader.h}
  60. +2 −2 cherokee/server-protected.h
  61. +5 −5 cherokee/server.c
  62. +5 −5 cherokee/socket.c
  63. +9 −24 cherokee/validator.c
  64. +47 −30 cherokee/validator.h
  65. +11 −16 cherokee/validator_htdigest.c
  66. +7 −7 cherokee/validator_htdigest.h
  67. +11 −17 cherokee/validator_htpasswd.c
  68. +5 −5 cherokee/validator_htpasswd.h
  69. +12 −15 cherokee/validator_ldap.c
  70. +4 −4 cherokee/validator_ldap.h
  71. +11 −12 cherokee/validator_mysql.c
  72. +12 −12 cherokee/validator_mysql.h
  73. +9 −12 cherokee/validator_pam.c
  74. +1 −1 cherokee/validator_pam.h
  75. +14 −17 cherokee/validator_plain.c
  76. +5 −5 cherokee/validator_plain.h
  77. +21 −15 cherokee/virtual_server.c
  78. +4 −4 configure.in
View
52 ChangeLog
@@ -1,8 +1,58 @@
+2006-11-30 Alvaro Lopez Ortega <alvaro@alobbs.com>
+
+ * cherokee/handler_redir.c, cherokee/handler_redir.h,
+ cherokee/handler_error_redir.c, cherokee/module_loader.c,
+ cherokee/handler_server_info.c, cherokee/module_loader.h,
+ cherokee/handler_error_redir.h, cherokee/handler_server_info.h,
+ cherokee/plugin_loader.c, cherokee/handler_admin.c,
+ cherokee/handler_cgi_base.c, cherokee/plugin_loader.h,
+ cherokee/handler_admin.h, cherokee/handler_cgi_base.h,
+ cherokee/handler_dirlist.c, cherokee/handler_nn.c,
+ cherokee/handler_dirlist.h, cherokee/virtual_server.c,
+ cherokee/handler_nn.h, cherokee/handler_common.c,
+ cherokee/module.c, cherokee/validator_ldap.c,
+ cherokee/config_entry.c, cherokee/handler_common.h,
+ cherokee/module.h, cherokee/validator_ldap.h,
+ cherokee/config_entry.h, cherokee/validator_plain.c,
+ cherokee/validator_plain.h, cherokee/validator.c,
+ cherokee/encoder_table.c, cherokee/validator.h,
+ cherokee/encoder_table.h, cherokee/validator_htpasswd.c,
+ cherokee/plugin.h, cherokee/validator_htpasswd.h,
+ cherokee/handler_file., cherokee/handler., cherokee/encoder.c,
+ cherokee/handler_file.h, cherokee/handler.h, cherokee/encoder.h,
+ cherokee/Makefile.am, cherokee/handler_fcgi.c,
+ cherokee/balancer_round_robin.c, cherokee/encoder_gzip.c,
+ cherokee/handler_fcgi.h, cherokee/handler_fastcgi.c,
+ cherokee/encoder_gzip.h, cherokee/handler_fastcgi.h,
+ cherokee/balancer.c, cherokee/balancer.h,
+ cherokee/handler_proxy.c, cherokee/handler_scgi.c,
+ cherokee/logger_ncsa.c, cherokee/handler_proxy.h,
+ cherokee/handler_error.c, cherokee/handler_scgi.h,
+ cherokee/logger_ncsa.h, cherokee/handler_error.h,
+ cherokee/handler_cgi.c, cherokee/server-protected.h,
+ cherokee/handler_cgi.h, cherokee/validator_mysql.c,
+ cherokee/logger.c, cherokee/validator_mysql.h,
+ cherokee/validator_htdigest.c, cherokee/logger.h,
+ cherokee/validator_htdigest.h, cherokee/cherokee.h,
+ cherokee/server.c, cherokee/handler_phpcgi.c,
+ cherokee/handler_phpcgi.h, cherokee/logger_combined.c,
+ cherokee/validator_pam.c, cherokee/validator_pam.h,
+ cherokee/socket.c, cherokee/logger_w3c.c: "module" has been
+ splitted into module and plug-in.
+
+ * cherokee/handler_fcgi.c (do_send): Do not move the connection to
+ polling if it receives a ret_eagain when it tries to write the
+ post content.
+
+ * cherokee/socket.c (cherokee_socket_write): Better
+ initialization. Fixes a potential memory corruption problem.
+
2006-11-22 Alvaro Lopez Ortega <alvaro@alobbs.com>
* cherokee/handler_fcgi.c (do_send): Post handling was
broken. Actually, I broke it with another commit a couple of days
- ago. It's working again.
+ ago. It's working again. This problem showed up using Gallery 2,
+ there were people who couldn't upload pictures.
* cherokee/config_node.c (cherokee_config_node_add): Fixes bug
#104. It was messing up the configuration tree if the entries were
View
5 cherokee/Makefile.am
@@ -837,12 +837,13 @@ logger.h \
logger.c \
thread.h \
thread.c \
+plugin.h \
module.h \
module.c \
validator.h \
validator.c \
-module_loader.h \
-module_loader.c \
+plugin_loader.h \
+plugin_loader.c \
icons.h \
icons.c \
handler_error.c \
View
12 cherokee/balancer.c
@@ -24,19 +24,19 @@
#include "common-internal.h"
#include "balancer.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#include "server-protected.h"
#include "source_interpreter.h"
#define DEFAULT_SOURCES_ALLOCATION 5
ret_t
-cherokee_balancer_init_base (cherokee_balancer_t *balancer)
+cherokee_balancer_init_base (cherokee_balancer_t *balancer, cherokee_plugin_info_t *info)
{
/* Init the base class
*/
- cherokee_module_init_base (MODULE(balancer));
+ cherokee_module_init_base (MODULE(balancer), NULL, info);
/* Virtual methods
*/
@@ -198,12 +198,12 @@ cherokee_balancer_instance (cherokee_buffer_t *name,
{
ret_t ret;
balancer_new_func_t new_func;
- cherokee_module_info_t *info = NULL;
+ cherokee_plugin_info_t *info = NULL;
- ret = cherokee_module_loader_get (&srv->loader, name->buf, &info);
+ ret = cherokee_plugin_loader_get (&srv->loader, name->buf, &info);
if (ret != ret_ok) return ret;
- new_func = (balancer_new_func_t) info->new_func;
+ new_func = (balancer_new_func_t) info->instance;
ret = new_func (balancer);
if (ret != ret_ok) return ret;
View
27 cherokee/balancer.h
@@ -54,11 +54,32 @@ typedef struct {
#define BAL(b) ((cherokee_balancer_t *)(b))
-typedef ret_t (* balancer_new_func_t) (cherokee_balancer_t **balancer);
-typedef ret_t (* balancer_free_func_t) (cherokee_balancer_t *balancer);
+typedef ret_t (* balancer_new_func_t) (cherokee_balancer_t **balancer);
+typedef ret_t (* balancer_free_func_t) (cherokee_balancer_t *balancer);
-ret_t cherokee_balancer_init_base (cherokee_balancer_t *balancer);
+/* Easy initialization
+ */
+#define BALANCER_CONF_PROTOTYPE(name) \
+ ret_t cherokee_balancer_ ## name ## _configure ( \
+ cherokee_balancer_t *, \
+ cherokee_config_node_t *)
+
+#define PLUGIN_INFO_BALANCER_EASY_INIT(name) \
+ BALANCER_CONF_PROTOTYPE(name); \
+ \
+ PLUGIN_INFO_INIT(name, cherokee_balancer, \
+ (void *)cherokee_balancer_ ## name ## _new, \
+ (void *)cherokee_balancer_ ## name ## _configure)
+
+#define PLUGIN_INFO_BALANCER_EASIEST_INIT(name) \
+ PLUGIN_EMPTY_INIT_FUNCTION(name) \
+ PLUGIN_INFO_BALANCER_EASY_INIT(name)
+
+
+/* Balancer methods
+ */
+ret_t cherokee_balancer_init_base (cherokee_balancer_t *balancer, cherokee_plugin_info_t *info);
ret_t cherokee_balancer_mrproper (cherokee_balancer_t *balancer);
ret_t cherokee_balancer_configure (cherokee_balancer_t *balancer, cherokee_config_node_t *conf);
View
22 cherokee/balancer_round_robin.c
@@ -25,7 +25,13 @@
#include "common-internal.h"
#include "balancer_round_robin.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
+
+
+/* Plug-in initialization
+ */
+PLUGIN_INFO_BALANCER_EASIEST_INIT (round_robin);
+
static ret_t
dispatch (cherokee_balancer_round_robin_t *balancer,
@@ -34,7 +40,7 @@ dispatch (cherokee_balancer_round_robin_t *balancer,
ret_t
-cherokee_balancer_round_robin_configure (cherokee_balancer_t *balancer, cherokee_config_node_t *conf)
+cherokee_balancer_round_robin_configure (cherokee_balancer_t *balancer, cherokee_config_node_t *conf)
{
ret_t ret;
@@ -52,7 +58,7 @@ cherokee_balancer_round_robin_new (cherokee_balancer_t **bal)
/* Init
*/
- cherokee_balancer_init_base (BAL(n));
+ cherokee_balancer_init_base (BAL(n), PLUGIN_INFO_PTR(round_robin));
MODULE(n)->free = (module_func_free_t) cherokee_balancer_round_robin_free;
BAL(n)->dispatch = (balancer_dispatch_func_t) dispatch;
@@ -101,13 +107,3 @@ dispatch (cherokee_balancer_round_robin_t *balancer,
}
-
-/* Module stuff
- */
-
-MODULE_INFO_INIT_EASY (balancer, round_robin);
-
-void
-MODULE_INIT(round_robin) (cherokee_module_loader_t *loader)
-{
-}
View
3 cherokee/cherokee.h
@@ -52,7 +52,8 @@
#include <cherokee/handler.h>
#include <cherokee/encoder.h>
#include <cherokee/connection.h>
-#include <cherokee/module_loader.h>
+#include <cherokee/plugin.h>
+#include <cherokee/plugin_loader.h>
#include <cherokee/nonce.h>
/* Client library
View
12 cherokee/config_entry.c
@@ -80,7 +80,7 @@ cherokee_config_entry_mrproper (cherokee_config_entry_t *entry)
}
if (entry->validator_properties != NULL) {
- cherokee_validator_props_free (entry->validator_properties);
+ cherokee_module_props_free (entry->validator_properties);
entry->validator_properties = NULL;
}
@@ -119,17 +119,17 @@ cherokee_config_entry_free (cherokee_config_entry_t *entry)
ret_t
-cherokee_config_entry_set_handler (cherokee_config_entry_t *entry, cherokee_module_info_t *modinfo)
+cherokee_config_entry_set_handler (cherokee_config_entry_t *entry, cherokee_plugin_info_handler_t *plugin_info)
{
- return_if_fail (modinfo != NULL, ret_error);
+ return_if_fail (plugin_info != NULL, ret_error);
- if (modinfo->type != cherokee_handler) {
+ if (PLUGIN_INFO(plugin_info)->type != cherokee_handler) {
PRINT_ERROR ("Directory '%s' has not a handler module!\n", entry->document_root->buf);
return ret_error;
}
- entry->handler_new_func = (handler_func_new_t) modinfo->new_func;
- entry->handler_methods = MODULE_INFO_HANDLER(modinfo)->valid_methods;
+ entry->handler_new_func = PLUGIN_INFO(plugin_info)->instance;
+ entry->handler_methods = plugin_info->valid_methods;
return ret_ok;
}
View
4 cherokee/config_entry.h
@@ -57,7 +57,7 @@ typedef struct {
/* Validator
*/
validator_func_new_t validator_new_func;
- cherokee_validator_props_t *validator_properties;
+ cherokee_module_props_t *validator_properties;
cherokee_buffer_t *auth_realm;
cherokee_http_auth_t authentication;
@@ -72,7 +72,7 @@ ret_t cherokee_config_entry_free (cherokee_config_entry_t *entry);
ret_t cherokee_config_entry_init (cherokee_config_entry_t *entry);
ret_t cherokee_config_entry_mrproper (cherokee_config_entry_t *entry);
-ret_t cherokee_config_entry_set_handler (cherokee_config_entry_t *entry, cherokee_module_info_t *modinfo);
+ret_t cherokee_config_entry_set_handler (cherokee_config_entry_t *entry, cherokee_plugin_info_handler_t *modinfo);
ret_t cherokee_config_entry_complete (cherokee_config_entry_t *entry, cherokee_config_entry_t *parent, cherokee_boolean_t same_type);
ret_t cherokee_config_entry_inherit (cherokee_config_entry_t *entry);
View
4 cherokee/encoder.c
@@ -27,9 +27,9 @@
ret_t
-cherokee_encoder_init_base (cherokee_encoder_t *enc)
+cherokee_encoder_init_base (cherokee_encoder_t *enc, cherokee_plugin_info_t *info)
{
- cherokee_module_init_base (MODULE(enc));
+ cherokee_module_init_base (MODULE(enc), NULL, info);
enc->encode = NULL;
enc->add_headers = NULL;
View
24 cherokee/encoder.h
@@ -65,10 +65,32 @@ typedef struct {
#define ENCODER_CONN(x) (CONN(ENCODER(x)->conn))
+/* Easy initialization
+ */
+#define ENCODER_CONF_PROTOTYPE(name) \
+ ret_t cherokee_encoder_ ## name ## _configure ( \
+ cherokee_config_node_t *, \
+ cherokee_server_t *, \
+ cherokee_module_props_t **)
+
+#define PLUGIN_INFO_ENCODER_EASY_INIT(name) \
+ ENCODER_CONF_PROTOTYPE(name); \
+ \
+ PLUGIN_INFO_INIT(name, cherokee_encoder, \
+ (void *)cherokee_encoder_ ## name ## _new, \
+ (void *)NULL)
+
+#define PLUGIN_INFO_ENCODER_EASIEST_INIT(name) \
+ PLUGIN_EMPTY_INIT_FUNCTION(name) \
+ PLUGIN_INFO_ENCODER_EASY_INIT(name)
+
+
/* Methods
*/
-ret_t cherokee_encoder_init_base (cherokee_encoder_t *enc);
+ret_t cherokee_encoder_init_base (cherokee_encoder_t *enc, cherokee_plugin_info_t *info);
+/* Encoder virtual methods
+ */
ret_t cherokee_encoder_free (cherokee_encoder_t *enc);
ret_t cherokee_encoder_add_headers (cherokee_encoder_t *enc, cherokee_buffer_t *buf);
ret_t cherokee_encoder_init (cherokee_encoder_t *enc, void *conn);
View
36 cherokee/encoder_gzip.c
@@ -26,7 +26,11 @@
#include "crc32.h"
#include "encoder_gzip.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
+
+/* Plug-in initialization
+ */
+PLUGIN_INFO_ENCODER_EASIEST_INIT (gzip);
/* Specs:
* GZIP file format specification version 4.3:
@@ -63,20 +67,14 @@ static unsigned char gzip_header[gzip_header_len] = {0x1F, 0x8B, /* 16 bits: I
*/
ret_t
-cherokee_encoder_gzip_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, void **props)
-{
- return ret_ok;
-}
-
-ret_t
cherokee_encoder_gzip_new (cherokee_encoder_gzip_t **encoder)
{
cuint_t workspacesize;
CHEROKEE_NEW_STRUCT (n, encoder_gzip);
/* Init
*/
- cherokee_encoder_init_base (ENCODER(n));
+ cherokee_encoder_init_base (ENCODER(n), PLUGIN_INFO_PTR(gzip));
MODULE(n)->init = (encoder_func_init_t) cherokee_encoder_gzip_init;
MODULE(n)->free = (module_func_free_t) cherokee_encoder_gzip_free;
@@ -91,8 +89,10 @@ cherokee_encoder_gzip_new (cherokee_encoder_gzip_t **encoder)
n->add_header = true;
workspacesize = zlib_deflate_workspacesize();
+
n->workspace = malloc (workspacesize);
- if (unlikely (n->workspace == NULL)) return ret_nomem;
+ if (unlikely (n->workspace == NULL))
+ return ret_nomem;
memset (n->workspace, 0, workspacesize);
memset (&n->stream, 0, sizeof(z_stream));
@@ -311,21 +311,3 @@ cherokee_encoder_gzip_flush (cherokee_encoder_gzip_t *encoder, cherokee_buffer_t
return ret_ok;
}
-
-
-/* Library init function
- */
-
-MODULE_INFO_INIT_EASY (encoder, gzip);
-
-
-static cherokee_boolean_t _gzip_is_init = false;
-
-void
-MODULE_INIT(gzip) (cherokee_module_loader_t *loader)
-{
- /* Init flag
- */
- if (_gzip_is_init) return;
- _gzip_is_init = true;
-}
View
2 cherokee/encoder_gzip.h
@@ -48,7 +48,7 @@ typedef struct {
/* Methods
*/
-ret_t cherokee_encoder_gzip_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, void **props);
+ret_t cherokee_encoder_gzip_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **props);
ret_t cherokee_encoder_gzip_new (cherokee_encoder_gzip_t **encoder);
ret_t cherokee_encoder_gzip_free (cherokee_encoder_gzip_t *encoder);
View
4 cherokee/encoder_table.c
@@ -117,14 +117,14 @@ cherokee_encoder_table_entry_free (cherokee_encoder_table_entry_t *eentry)
ret_t
-cherokee_encoder_table_entry_get_info (cherokee_encoder_table_entry_t *eentry, cherokee_module_info_t *info)
+cherokee_encoder_table_entry_get_info (cherokee_encoder_table_entry_t *eentry, cherokee_plugin_info_t *info)
{
if (info->type != cherokee_encoder) {
PRINT_ERROR ("ERROR: Wrong module type(%d): not a encoder\n", info->type);
return ret_error;
}
- eentry->func_new = info->new_func;
+ eentry->func_new = info->instance;
return ret_ok;
}
View
12 cherokee/encoder_table.h
@@ -44,18 +44,18 @@ typedef cherokee_table_t cherokee_encoder_table_t;
/* Encoder table methods
*/
-ret_t cherokee_encoder_table_init (cherokee_encoder_table_t *et);
-ret_t cherokee_encoder_table_mrproper (cherokee_encoder_table_t *et);
+ret_t cherokee_encoder_table_init (cherokee_encoder_table_t *et);
+ret_t cherokee_encoder_table_mrproper (cherokee_encoder_table_t *et);
-ret_t cherokee_encoder_table_get (cherokee_encoder_table_t *et, char *encoder, cherokee_encoder_table_entry_t **entry);
-ret_t cherokee_encoder_table_set (cherokee_encoder_table_t *et, char *encoder, cherokee_encoder_table_entry_t *entry);
-ret_t cherokee_encoder_table_new_encoder (cherokee_encoder_table_t *et, char *encoder, char *ext, cherokee_encoder_t **new_encoder);
+ret_t cherokee_encoder_table_get (cherokee_encoder_table_t *et, char *encoder, cherokee_encoder_table_entry_t **entry);
+ret_t cherokee_encoder_table_set (cherokee_encoder_table_t *et, char *encoder, cherokee_encoder_table_entry_t *entry);
+ret_t cherokee_encoder_table_new_encoder (cherokee_encoder_table_t *et, char *encoder, char *ext, cherokee_encoder_t **new_encoder);
/* Encoder entry methods
*/
ret_t cherokee_encoder_table_entry_new (cherokee_encoder_table_entry_t **eentry);
ret_t cherokee_encoder_table_entry_free (cherokee_encoder_table_entry_t *eentry);
-ret_t cherokee_encoder_table_entry_get_info (cherokee_encoder_table_entry_t *eentry, cherokee_module_info_t *info);
+ret_t cherokee_encoder_table_entry_get_info (cherokee_encoder_table_entry_t *eentry, cherokee_plugin_info_t *info);
int cherokee_encoder_entry_has_matching_list (cherokee_encoder_table_entry_t *eentry);
ret_t cherokee_encoder_entry_set_matching_list (cherokee_encoder_table_entry_t *eentry, cherokee_matching_list_t *matching);
View
25 cherokee/handler.c
@@ -32,11 +32,11 @@
ret_t
-cherokee_handler_init_base (cherokee_handler_t *hdl, void *conn, cherokee_module_props_t *props)
+cherokee_handler_init_base (cherokee_handler_t *hdl, void *conn, cherokee_handler_props_t *props, cherokee_plugin_info_handler_t *info)
{
/* Init the base class
*/
- cherokee_module_init_base (MODULE(hdl));
+ cherokee_module_init_base (MODULE(hdl), MODULE_PROPS(props), PLUGIN_INFO(info));
/* Pure virtual methods
*/
@@ -45,8 +45,7 @@ cherokee_handler_init_base (cherokee_handler_t *hdl, void *conn, cherokee_module
/* Parent reference
*/
- hdl->connection = conn;
- hdl->props = props;
+ hdl->connection = conn;
return ret_ok;
}
@@ -129,3 +128,21 @@ cherokee_handler_step (cherokee_handler_t *hdl, cherokee_buffer_t *buffer)
}
+
+/* Handler properties methods
+ */
+
+ret_t
+cherokee_handler_props_init_base (cherokee_handler_props_t *props, module_func_props_free_t free_func)
+{
+ props->valid_methods = http_unknown;
+
+ return cherokee_module_props_init_base (MODULE_PROPS(props), free_func);
+}
+
+
+ret_t
+cherokee_handler_props_free_base (cherokee_handler_props_t *props)
+{
+ return cherokee_module_props_free_base (MODULE_PROPS(props));
+}
View
41 cherokee/handler.h
@@ -61,12 +61,13 @@ typedef ret_t (* handler_func_new_t) (void **handler, void *cnt, cheroke
typedef ret_t (* handler_func_init_t) (void *handler);
typedef ret_t (* handler_func_step_t) (void *handler, cherokee_buffer_t *buffer);
typedef ret_t (* handler_func_add_headers_t) (void *handler, cherokee_buffer_t *buffer);
+typedef ret_t (* handler_func_configure_t) (cherokee_config_node_t *, cherokee_server_t *, cherokee_module_props_t **);
+
/* Data types
*/
typedef struct {
cherokee_module_t module;
- cherokee_module_props_t *props;
/* Pure virtual methods
*/
@@ -90,9 +91,41 @@ typedef struct {
#define HANDLER_SUPPORT_COMPLEX_HEADERS(h) (HANDLER(h)->support & hsupport_complex_headers)
#define HANDLER_SUPPORT_ERROR(h) (HANDLER(h)->support & hsupport_error)
+
+/* Module information
+ */
+typedef struct {
+ cherokee_module_props_t base;
+ cherokee_http_method_t valid_methods;
+} cherokee_handler_props_t;
+
+#define HANDLER_PROPS(x) ((cherokee_handler_props_t *)(x))
+
+
+/* Easy initialization
+ */
+#define HANDLER_CONF_PROTOTYPE(name) \
+ ret_t cherokee_handler_ ## name ## _configure ( \
+ cherokee_config_node_t *, \
+ cherokee_server_t *, \
+ cherokee_module_props_t **)
+
+#define PLUGIN_INFO_HANDLER_EASY_INIT(name, methods) \
+ HANDLER_CONF_PROTOTYPE(name); \
+ \
+ PLUGIN_INFO_HANDLER_INIT(name, cherokee_handler, \
+ (void *)cherokee_handler_ ## name ## _new, \
+ (void *)cherokee_handler_ ## name ## _configure, \
+ methods)
+
+#define PLUGIN_INFO_HANDLER_EASIEST_INIT(name, methods) \
+ PLUGIN_EMPTY_INIT_FUNCTION(name) \
+ PLUGIN_INFO_HANDLER_EASY_INIT(name, methods)
+
+
/* Handler methods
*/
-ret_t cherokee_handler_init_base (cherokee_handler_t *hdl, void *conn, cherokee_module_props_t *props);
+ret_t cherokee_handler_init_base (cherokee_handler_t *hdl, void *conn, cherokee_handler_props_t *props, cherokee_plugin_info_handler_t *info);
ret_t cherokee_handler_free_base (cherokee_handler_t *hdl);
/* Handler virtual methods
@@ -102,6 +135,10 @@ ret_t cherokee_handler_free (cherokee_handler_t *hdl);
ret_t cherokee_handler_step (cherokee_handler_t *hdl, cherokee_buffer_t *buffer);
ret_t cherokee_handler_add_headers (cherokee_handler_t *hdl, cherokee_buffer_t *buffer);
+/* Handler properties methods
+ */
+ret_t cherokee_handler_props_init_base (cherokee_handler_props_t *props, module_func_props_free_t free_func);
+ret_t cherokee_handler_props_free_base (cherokee_handler_props_t *props);
CHEROKEE_END_DECLS
View
29 cherokee/handler_admin.c
@@ -33,9 +33,15 @@
#define ERR_STR(x)
+/* Plug-in initialization
+ */
+PLUGIN_INFO_HANDLER_EASIEST_INIT (admin, http_get | http_post);
-static ret_t
-cherokee_handler_admin_configure ()
+
+/* Methods implementation
+ */
+ret_t
+cherokee_handler_admin_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props)
{
return ret_ok;
}
@@ -48,11 +54,10 @@ cherokee_handler_admin_new (cherokee_handler_t **hdl, void *cnt, cherokee_module
/* Init the base class object
*/
- cherokee_handler_init_base (HANDLER(n), cnt, props);
+ cherokee_handler_init_base (HANDLER(n), cnt, HANDLER_PROPS(props), PLUGIN_INFO_HANDLER_PTR(admin));
MODULE(n)->init = (handler_func_init_t) cherokee_handler_admin_init;
MODULE(n)->free = (module_func_free_t) cherokee_handler_admin_free;
- MODULE(n)->get_name = (module_func_get_name_t) cherokee_handler_admin_get_name;
HANDLER(n)->step = (handler_func_step_t) cherokee_handler_admin_step;
HANDLER(n)->add_headers = (handler_func_add_headers_t) cherokee_handler_admin_add_headers;
@@ -185,19 +190,3 @@ cherokee_handler_admin_add_headers (cherokee_handler_admin_t *ahdl, cherokee_buf
cherokee_buffer_add_va (buffer, "Content-length: %lu" CRLF, ahdl->reply.len);
return ret_ok;
}
-
-void
-cherokee_handler_admin_get_name (cherokee_handler_admin_t *ahdl, const char **name)
-{
- *name = "admin";
-}
-
-
-/* Library init function
- */
-void
-MODULE_INIT(admin) (cherokee_module_loader_t *loader)
-{
-}
-
-HANDLER_MODULE_INFO_INIT_EASY (admin, http_get | http_post);
View
4 cherokee/handler_admin.h
@@ -26,7 +26,7 @@
#define CHEROKEE_ADMIN_HANDLER_H
#include "handler.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
typedef enum {
@@ -46,7 +46,7 @@ typedef struct {
/* Library init function
*/
-void MODULE_INIT(admi) (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(admi) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_admin_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *props);
/* virtual methods implementation
View
24 cherokee/handler_cgi.c
@@ -70,6 +70,12 @@ static ret_t fork_and_execute_cgi_unix (cherokee_handler_cgi_t *cgi);
#define set_env(cgi,k,v,vl) cherokee_handler_cgi_add_env_pair(cgi, k, sizeof(k)-1, v, vl)
+/* Plugin initialization
+ */
+PLUGIN_INFO_HANDLER_EASY_INIT (cgi, http_get | http_post | http_head);
+
+
+
static ret_t
read_from_cgi (cherokee_handler_cgi_base_t *cgi_base, cherokee_buffer_t *buffer)
{
@@ -107,14 +113,15 @@ read_from_cgi (cherokee_handler_cgi_base_t *cgi_base, cherokee_buffer_t *buffer)
ret_t
-cherokee_handler_cgi_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *props)
+cherokee_handler_cgi_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *props)
{
int i;
CHEROKEE_NEW_STRUCT (n, handler_cgi);
/* Init the base class
*/
- cherokee_handler_cgi_base_init (HDL_CGI_BASE(n), cnt, props, cherokee_handler_cgi_add_env_pair, read_from_cgi);
+ cherokee_handler_cgi_base_init (HDL_CGI_BASE(n), cnt, PLUGIN_INFO_HANDLER_PTR(cgi),
+ HANDLER_PROPS(props), cherokee_handler_cgi_add_env_pair, read_from_cgi);
/* Virtual methods
*/
@@ -267,8 +274,8 @@ cherokee_handler_cgi_configure (cherokee_config_node_t *conf, cherokee_server_t
if (*_props == NULL) {
CHEROKEE_NEW_STRUCT (n, handler_cgi_props);
- cherokee_module_props_init_base (MODULE_PROPS(n),
- MODULE_PROPS_FREE(cherokee_handler_cgi_props_free));
+ cherokee_handler_cgi_base_props_init_base (PROP_CGI_BASE(n),
+ MODULE_PROPS_FREE(cherokee_handler_cgi_props_free));
*_props = MODULE_PROPS(n);
}
@@ -524,7 +531,7 @@ manage_child_cgi_process (cherokee_handler_cgi_t *cgi, int pipe_cgi[2], int pipe
/* Change the execution user?
*/
- if (HDL_CGI_BASE_PROPS(cgi_base)->change_user) {
+ if (HANDLER_CGI_PROPS(cgi_base)->change_user) {
struct stat info;
re = stat (argv[1], &info);
@@ -763,7 +770,6 @@ fork_and_execute_cgi_win32 (cherokee_handler_cgi_t *cgi)
/* Library init function
*/
-
static cherokee_boolean_t _cgi_is_init = false;
#if 0
@@ -777,8 +783,8 @@ child_finished(int sng)
}
#endif
-void
-MODULE_INIT(cgi) (cherokee_module_loader_t *loader)
+void
+PLUGIN_INIT_NAME(cgi) (cherokee_plugin_loader_t *loader)
{
if (_cgi_is_init) return;
_cgi_is_init = true;
@@ -788,5 +794,3 @@ MODULE_INIT(cgi) (cherokee_module_loader_t *loader)
#endif
}
-
-HANDLER_MODULE_INFO_INIT_EASY (cgi, http_get | http_post | http_head);
View
10 cherokee/handler_cgi.h
@@ -36,7 +36,7 @@
#include "handler.h"
#include "list.h"
#include "handler_cgi_base.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#define ENV_VAR_NUM 80
@@ -62,14 +62,14 @@ typedef struct {
#endif
} cherokee_handler_cgi_t;
-#define HDL_CGI(x) ((cherokee_handler_cgi_t *)(x))
-#define PROP_CGI(x) ((cherokee_handler_cgi_props_t *)(x))
-#define HDL_CGI_PROPS(x) (PROP_CGI(HANDLER(x)->props))
+#define HDL_CGI(x) ((cherokee_handler_cgi_t *)(x))
+#define PROP_CGI(x) ((cherokee_handler_cgi_props_t *)(x))
+#define HANDLER_CGI_PROPS(x) (PROP_CGI (MODULE(x)->props))
/* Library init function
*/
-void MODULE_INIT(cgi) (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(cgi) (cherokee_plugin_loader_t *loader);
/* Methods
*/
View
36 cherokee/handler_cgi_base.c
@@ -42,15 +42,16 @@
ret_t
cherokee_handler_cgi_base_init (cherokee_handler_cgi_base_t *cgi,
cherokee_connection_t *conn,
- cherokee_module_props_t *props,
+ cherokee_plugin_info_handler_t *info,
+ cherokee_handler_props_t *props,
cherokee_handler_cgi_base_add_env_pair_t add_env_pair,
cherokee_handler_cgi_base_read_from_cgi_t read_from_cgi)
{
ret_t ret;
/* Init the base class object
*/
- cherokee_handler_init_base (HANDLER(cgi), conn, props);
+ cherokee_handler_init_base (HANDLER(cgi), conn, props, info);
/* Supported features
*/
@@ -82,7 +83,7 @@ cherokee_handler_cgi_base_init (cherokee_handler_cgi_base_t *cgi,
/* Read the properties
*/
- if (HDL_CGI_BASE_PROPS(cgi)->is_error_handler) {
+ if (HANDLER_CGI_BASE_PROPS(cgi)->is_error_handler) {
HANDLER(cgi)->support |= hsupport_error;
}
@@ -123,6 +124,12 @@ env_item_free (void *p)
}
ret_t
+cherokee_handler_cgi_base_props_init_base (cherokee_handler_cgi_base_props_t *props, module_func_props_free_t free_func)
+{
+ return cherokee_handler_props_init_base (HANDLER_PROPS(props), free_func);
+}
+
+ret_t
cherokee_handler_cgi_base_props_free (cherokee_handler_cgi_base_props_t *props)
{
cherokee_list_t *i, *tmp;
@@ -133,7 +140,7 @@ cherokee_handler_cgi_base_props_free (cherokee_handler_cgi_base_props_t *props)
env_item_free (i);
}
- return cherokee_module_props_free_base (MODULE_PROPS(props));
+ return cherokee_handler_props_free_base (HANDLER_PROPS(props));
}
ret_t
@@ -413,17 +420,18 @@ cherokee_handler_cgi_base_build_basic_env (cherokee_handler_cgi_base_t
ret_t
cherokee_handler_cgi_base_build_envp (cherokee_handler_cgi_base_t *cgi, cherokee_connection_t *conn)
{
- ret_t ret;
- cherokee_list_t *i;
- cherokee_buffer_t *name;
- cuint_t len = 0;
- char *p = "";
- cherokee_buffer_t tmp = CHEROKEE_BUF_INIT;
+ ret_t ret;
+ cherokee_list_t *i;
+ cherokee_buffer_t *name;
+ cuint_t len = 0;
+ char *p = "";
+ cherokee_buffer_t tmp = CHEROKEE_BUF_INIT;
+ cherokee_handler_cgi_base_props_t *cgi_props = HANDLER_CGI_BASE_PROPS(cgi);
/* Add user defined variables at the beginning,
* these have precedence..
*/
- list_for_each (i, &HDL_CGI_BASE_PROPS(cgi)->system_env) {
+ list_for_each (i, &cgi_props->system_env) {
env_item_t *env = (env_item_t *)i;
cgi->add_env_pair (cgi,
env->env.buf, env->env.len,
@@ -438,7 +446,7 @@ cherokee_handler_cgi_base_build_envp (cherokee_handler_cgi_base_t *cgi, cherokee
/* SCRIPT_NAME:
* It is the request without the pathinfo if it exists
*/
- if (cherokee_buffer_is_empty (&HDL_CGI_BASE_PROPS(cgi)->script_alias)) {
+ if (cherokee_buffer_is_empty (&cgi_props->script_alias)) {
if (cgi->param.len > 0) {
/* phpcgi request
*/
@@ -460,7 +468,7 @@ cherokee_handler_cgi_base_build_envp (cherokee_handler_cgi_base_t *cgi, cherokee
cherokee_buffer_clean (&tmp);
- if (HDL_CGI_BASE_PROPS(cgi)->check_file &&
+ if (cgi_props->check_file &&
(conn->web_directory.len > 1))
{
cherokee_buffer_add_buffer (&tmp, &conn->web_directory);
@@ -490,7 +498,7 @@ cherokee_handler_cgi_base_extract_path (cherokee_handler_cgi_base_t *cgi, cherok
struct stat st;
cint_t pathinfo_len = 0;
cherokee_connection_t *conn = HANDLER_CONN(cgi);
- cherokee_handler_cgi_base_props_t *props = HDL_CGI_BASE_PROPS(cgi);
+ cherokee_handler_cgi_base_props_t *props = HANDLER_CGI_BASE_PROPS(cgi);
/* ScriptAlias: If there is a ScriptAlias directive, it
* doesn't need to find the executable file..
View
71 cherokee/handler_cgi_base.h
@@ -48,19 +48,15 @@ typedef enum {
hcgi_phase_send_post
} cherokee_handler_cgi_base_phase_t;
-typedef struct {
- cherokee_module_props_t base;
- cherokee_list_t system_env;
- cuint_t change_user;
- cherokee_buffer_t script_alias;
- cherokee_boolean_t check_file;
- cherokee_boolean_t is_error_handler;
-} cherokee_handler_cgi_base_props_t;
+/* Data structure
+ */
struct cherokee_handler_cgi_base {
cherokee_handler_t handler;
- cherokee_handler_cgi_base_phase_t init_phase;
-
+
+ /* Properties
+ */
+ cherokee_handler_cgi_base_phase_t init_phase;
cuint_t got_eof;
char *extra_param;
size_t content_length;
@@ -76,29 +72,44 @@ struct cherokee_handler_cgi_base {
cherokee_handler_cgi_base_read_from_cgi_t read_from_cgi;
} ;
-#define HDL_CGI_BASE(x) ((cherokee_handler_cgi_base_t *)(x))
-#define PROP_CGI_BASE(x) ((cherokee_handler_cgi_base_props_t *)(x))
-#define HDL_CGI_BASE_PROPS(x) (PROP_CGI_BASE(HANDLER(x)->props))
+#define HDL_CGI_BASE(x) ((cherokee_handler_cgi_base_t *)(x))
+
+
+/* Properties data structure
+ */
+typedef struct {
+ cherokee_module_props_t base;
+ cherokee_list_t system_env;
+ cuint_t change_user;
+ cherokee_buffer_t script_alias;
+ cherokee_boolean_t check_file;
+ cherokee_boolean_t is_error_handler;
+} cherokee_handler_cgi_base_props_t;
+#define PROP_CGI_BASE(x) ((cherokee_handler_cgi_base_props_t *)(x))
+#define HANDLER_CGI_BASE_PROPS(x) (PROP_CGI_BASE (MODULE(x)->props))
-ret_t cherokee_handler_cgi_base_init (cherokee_handler_cgi_base_t *hdl,
- cherokee_connection_t *conn,
- cherokee_module_props_t *props,
- cherokee_handler_cgi_base_add_env_pair_t add_env_pair,
- cherokee_handler_cgi_base_read_from_cgi_t read_from_cgi);
-ret_t cherokee_handler_cgi_base_free (cherokee_handler_cgi_base_t *hdl);
+/* Base handler methods
+ */
+ret_t cherokee_handler_cgi_base_init (cherokee_handler_cgi_base_t *hdl,
+ cherokee_connection_t *conn,
+ cherokee_plugin_info_handler_t *info,
+ cherokee_handler_props_t *props,
+ cherokee_handler_cgi_base_add_env_pair_t add_env_pair,
+ cherokee_handler_cgi_base_read_from_cgi_t read_from_cgi);
-void cherokee_handler_cgi_base_add_parameter (cherokee_handler_cgi_base_t *cgi, char *name, cuint_t len);
-ret_t cherokee_handler_cgi_base_extract_path (cherokee_handler_cgi_base_t *cgi, cherokee_boolean_t check_filename);
+ret_t cherokee_handler_cgi_base_free (cherokee_handler_cgi_base_t *hdl);
-ret_t cherokee_handler_cgi_base_add_headers (cherokee_handler_cgi_base_t *cgi, cherokee_buffer_t *buffer);
-ret_t cherokee_handler_cgi_base_step (cherokee_handler_cgi_base_t *cgi, cherokee_buffer_t *buffer);
+ret_t cherokee_handler_cgi_base_add_headers (cherokee_handler_cgi_base_t *cgi, cherokee_buffer_t *buffer);
+ret_t cherokee_handler_cgi_base_step (cherokee_handler_cgi_base_t *cgi, cherokee_buffer_t *buffer);
-ret_t cherokee_handler_cgi_base_split_pathinfo (cherokee_handler_cgi_base_t *cgi,
- cherokee_buffer_t *buf,
- int pos,
- int allow_dirs);
+void cherokee_handler_cgi_base_add_parameter (cherokee_handler_cgi_base_t *cgi, char *name, cuint_t len);
+ret_t cherokee_handler_cgi_base_extract_path (cherokee_handler_cgi_base_t *cgi, cherokee_boolean_t check_filename);
+ret_t cherokee_handler_cgi_base_split_pathinfo (cherokee_handler_cgi_base_t *cgi,
+ cherokee_buffer_t *buf,
+ int pos,
+ int allow_dirs);
ret_t cherokee_handler_cgi_base_build_envp (cherokee_handler_cgi_base_t *cgi, cherokee_connection_t *conn);
ret_t cherokee_handler_cgi_base_build_basic_env (cherokee_handler_cgi_base_t *cgi,
@@ -107,7 +118,13 @@ ret_t cherokee_handler_cgi_base_build_basic_env (cherokee_handler_cgi_base_t
cherokee_buffer_t *tmp);
ret_t cherokee_handler_cgi_base_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **props);
+
+
+/* Handler properties
+ */
+ret_t cherokee_handler_cgi_base_props_init_base (cherokee_handler_cgi_base_props_t *props, module_func_props_free_t free_func);
ret_t cherokee_handler_cgi_base_props_free (cherokee_handler_cgi_base_props_t *props);
+
#endif /* CHEROKEE_HANDLER_CGI_BASE_H */
View
16 cherokee/handler_common.c
@@ -65,7 +65,7 @@ cherokee_handler_common_props_free (cherokee_handler_common_props_t *props)
props->props_dirlist = NULL;
}
- return cherokee_module_props_free_base (MODULE_PROPS(props));
+ return cherokee_handler_props_free_base (HANDLER_PROPS(props));
}
@@ -78,8 +78,8 @@ cherokee_handler_common_configure (cherokee_config_node_t *conf, cherokee_server
if (*_props == NULL) {
CHEROKEE_NEW_STRUCT (n, handler_common_props);
- cherokee_module_props_init_base (MODULE_PROPS(n),
- MODULE_PROPS_FREE(cherokee_handler_common_props_free));
+ cherokee_handler_props_init_base (HANDLER_PROPS(n),
+ MODULE_PROPS_FREE(cherokee_handler_common_props_free));
n->props_file = NULL;
n->props_dirlist = NULL;
@@ -333,16 +333,16 @@ cherokee_handler_common_new (cherokee_handler_t **hdl, void *cnt, cherokee_modul
*/
static cherokee_boolean_t _common_is_init = false;
-void
-MODULE_INIT(common) (cherokee_module_loader_t *loader)
+void
+PLUGIN_INIT_NAME(common) (cherokee_plugin_loader_t *loader)
{
if (_common_is_init) return;
_common_is_init = true;
/* Load the dependences
*/
- cherokee_module_loader_load (loader, "file");
- cherokee_module_loader_load (loader, "dirlist");
+ cherokee_plugin_loader_load (loader, "file");
+ cherokee_plugin_loader_load (loader, "dirlist");
}
-HANDLER_MODULE_INFO_INIT_EASY (common, http_all_methods);
+PLUGIN_INFO_HANDLER_EASY_INIT (common, http_all_methods);
View
3 cherokee/handler_common.h
@@ -30,6 +30,7 @@
#include "handler_file.h"
#include "handler_dirlist.h"
+
typedef struct {
cherokee_module_props_t base;
cherokee_handler_file_props_t *props_file;
@@ -41,7 +42,7 @@ typedef struct {
/* Library init function
*/
-void common_init (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(common) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_common_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **props);
ret_t cherokee_handler_common_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *props);
View
34 cherokee/handler_dirlist.c
@@ -45,7 +45,7 @@
#include "connection-protected.h"
#include "server.h"
#include "server-protected.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#include "icons.h"
#include "common.h"
@@ -61,7 +61,13 @@ struct file_entry {
typedef struct file_entry file_entry_t;
+/* Plug-in initialization
+ */
+PLUGIN_INFO_HANDLER_EASIEST_INIT (dirlist, http_get);
+
+/* Methods implementation
+ */
static ret_t
load_theme_load_file (cherokee_buffer_t *theme_path, char *file, cherokee_buffer_t *output)
{
@@ -154,7 +160,7 @@ cherokee_handler_dirlist_props_free (cherokee_handler_dirlist_props_t *props)
cherokee_buffer_mrproper (&props->entry);
cherokee_buffer_mrproper (&props->css);
- return cherokee_module_props_free_base (MODULE_PROPS(props));
+ return cherokee_handler_props_free_base (HANDLER_PROPS(props));
}
@@ -170,8 +176,8 @@ cherokee_handler_dirlist_configure (cherokee_config_node_t *conf, cherokee_serve
if (*_props == NULL) {
CHEROKEE_NEW_STRUCT (n, handler_dirlist_props);
- cherokee_module_props_init_base (MODULE_PROPS(n),
- MODULE_PROPS_FREE(cherokee_handler_dirlist_props_free));
+ cherokee_handler_props_init_base (HANDLER_PROPS(n),
+ MODULE_PROPS_FREE(cherokee_handler_dirlist_props_free));
n->show_size = true;
n->show_date = true;
@@ -331,11 +337,10 @@ cherokee_handler_dirlist_new (cherokee_handler_t **hdl, void *cnt, cherokee_mod
/* Init the base class object
*/
- cherokee_handler_init_base (HANDLER(n), cnt, props);
+ cherokee_handler_init_base (HANDLER(n), cnt, HANDLER_PROPS(props), PLUGIN_INFO_HANDLER_PTR(dirlist));
MODULE(n)->init = (handler_func_init_t) cherokee_handler_dirlist_init;
MODULE(n)->free = (module_func_free_t) cherokee_handler_dirlist_free;
- MODULE(n)->get_name = (module_func_get_name_t) cherokee_handler_dirlist_get_name;
HANDLER(n)->step = (handler_func_step_t) cherokee_handler_dirlist_step;
HANDLER(n)->add_headers = (handler_func_add_headers_t) cherokee_handler_dirlist_add_headers;
@@ -907,20 +912,3 @@ cherokee_handler_dirlist_add_headers (cherokee_handler_dirlist_t *dhdl, cherokee
cherokee_buffer_add_str (buffer, "Content-Type: text/html; charset=iso-8859-1"CRLF);
return ret_ok;
}
-
-
-void
-cherokee_handler_dirlist_get_name (cherokee_handler_dirlist_t *dhdl, char **name)
-{
- *name = "dirlist";
-}
-
-
-/* Library init function
- */
-void
-MODULE_INIT(dirlist) (cherokee_module_loader_t *loader)
-{
-}
-
-HANDLER_MODULE_INFO_INIT_EASY (dirlist, http_get);
View
6 cherokee/handler_dirlist.h
@@ -33,7 +33,7 @@
#include "list.h"
#include "buffer.h"
#include "handler.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
typedef enum {
@@ -99,12 +99,12 @@ typedef struct {
#define PROP_DIRLIST(x) ((cherokee_handler_dirlist_props_t *)(x))
#define HDL_DIRLIST(x) ((cherokee_handler_dirlist_t *)(x))
-#define HDL_DIRLIST_PROP(x) (PROP_DIRLIST(HANDLER(x)->props))
+#define HDL_DIRLIST_PROP(x) (PROP_DIRLIST(MODULE(x)->props))
/* Library init function
*/
-void MODULE_INIT(dirlist) (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(dirlist) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_dirlist_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *properties);
ret_t cherokee_handler_dirlist_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props);
View
14 cherokee/handler_error.c
@@ -31,6 +31,18 @@
#include "header-protected.h"
+/* Plug-in initialization
+ */
+PLUGIN_INFO_HANDLER_EASIEST_INIT (error, http_all_methods);
+
+
+ret_t
+cherokee_handler_error_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props)
+{
+ return ret_ok;
+}
+
+
ret_t
cherokee_handler_error_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props)
{
@@ -39,7 +51,7 @@ cherokee_handler_error_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt
/* Init the base class object
*/
- cherokee_handler_init_base(HANDLER(n), cnt, props);
+ cherokee_handler_init_base (HANDLER(n), cnt, HANDLER_PROPS(props), PLUGIN_INFO_HANDLER_PTR(error));
HANDLER(n)->support = hsupport_error | hsupport_length;
MODULE(n)->init = (handler_func_init_t) cherokee_handler_error_init;
View
6 cherokee/handler_error.h
@@ -28,7 +28,7 @@
#include "common-internal.h"
#include "handler.h"
#include "connection.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
typedef struct {
cherokee_handler_t handler;
@@ -40,8 +40,8 @@ typedef struct {
/* Library init function
*/
-void MODULE_INIT(error) (cherokee_module_loader_t *loader);
-ret_t cherokee_handler_error_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
+void PLUGIN_INIT_NAME(error) (cherokee_plugin_loader_t *loader);
+ret_t cherokee_handler_error_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
/* virtual methods implementation
*/
View
10 cherokee/handler_error_redir.c
@@ -28,7 +28,7 @@
#include "handler_error_redir.h"
#include "connection.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#include "connection-protected.h"
@@ -126,8 +126,8 @@ cherokee_handler_error_redir_new (cherokee_handler_t **hdl, cherokee_connection_
*/
static cherokee_boolean_t _error_redir_is_init = false;
-void
-MODULE_INIT(error_redir) (cherokee_module_loader_t *loader)
+void
+PLUGIN_INIT_NAME(error_redir) (cherokee_plugin_loader_t *loader)
{
/* Is init?
*/
@@ -136,7 +136,7 @@ MODULE_INIT(error_redir) (cherokee_module_loader_t *loader)
/* Load the dependences
*/
- cherokee_module_loader_load (loader, "redir");
+ cherokee_plugin_loader_load (loader, "redir");
}
-HANDLER_MODULE_INFO_INIT_EASY (error_redir, http_all_methods);
+PLUGIN_INFO_HANDLER_EASY_INIT (error_redir, http_all_methods);
View
6 cherokee/handler_error_redir.h
@@ -29,7 +29,7 @@
#include "handler.h"
#include "connection.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
typedef struct {
cherokee_handler_t handler;
@@ -47,9 +47,9 @@ typedef struct {
/* Library init function
*/
-void MODULE_INIT(error_redir) (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(error_redir) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_error_redir_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props);
-ret_t cherokee_handler_error_redir_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
+ret_t cherokee_handler_error_redir_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
#endif /* CHEROKEE_HANDLER_ERROR_REDIR_H */
View
32 cherokee/handler_fastcgi.c
@@ -39,6 +39,13 @@
set_env_pair (cgi, key, sizeof(key)-1, val, len)
+/* Plug-in initialization
+ */
+PLUGIN_INFO_HANDLER_EASIEST_INIT (fastcgi, http_get | http_post | http_head);
+
+
+/* Methods implementation
+ */
static ret_t
props_free (cherokee_handler_fastcgi_props_t *props)
{
@@ -50,7 +57,7 @@ props_free (cherokee_handler_fastcgi_props_t *props)
return cherokee_handler_cgi_base_props_free (PROP_CGI_BASE(props));
}
-static ret_t
+ret_t
cherokee_handler_fastcgi_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props)
{
ret_t ret;
@@ -62,10 +69,10 @@ cherokee_handler_fastcgi_configure (cherokee_config_node_t *conf, cherokee_serve
if (*_props == NULL) {
CHEROKEE_NEW_STRUCT (n, handler_fastcgi_props);
- cherokee_module_props_init_base (MODULE_PROPS(n),
- MODULE_PROPS_FREE(props_free));
+ cherokee_handler_cgi_base_props_init_base (PROP_CGI_BASE(n),
+ MODULE_PROPS_FREE(props_free));
- INIT_LIST_HEAD(&n->fastcgi_env_ref);
+ INIT_LIST_HEAD (&n->fastcgi_env_ref);
n->balancer = NULL;
n->nsockets = NSOCKS_DEFAULT;
@@ -241,7 +248,8 @@ cherokee_handler_fastcgi_new (cherokee_handler_t **hdl, void *cnt, cherokee_modu
/* Init the base class
*/
- cherokee_handler_cgi_base_init (HDL_CGI_BASE(n), cnt, props, set_env_pair, read_from_fastcgi);
+ cherokee_handler_cgi_base_init (HDL_CGI_BASE(n), cnt, PLUGIN_INFO_HANDLER_PTR(fastcgi),
+ HANDLER_PROPS(props), set_env_pair, read_from_fastcgi);
/* Virtual methods
*/
@@ -300,7 +308,7 @@ get_dispatcher (cherokee_handler_fastcgi_t *hdl, cherokee_fcgi_dispatcher_t **di
cherokee_source_t *src = NULL;
cherokee_thread_t *thread = HANDLER_THREAD(hdl);
cherokee_table_t *dispatchers = thread->fastcgi_servers;
- cherokee_handler_fastcgi_props_t *props = HDL_FASTCGI_PROPS(hdl);
+ cherokee_handler_fastcgi_props_t *props = HANDLER_FASTCGI_PROPS(hdl);
/* Choose the server
*/
@@ -706,15 +714,3 @@ cherokee_handler_fastcgi_init (cherokee_handler_fastcgi_t *hdl)
return ret_error;
}
-
-/* Module init
- */
-void
-MODULE_INIT(fastcgi) (cherokee_module_loader_t *loader)
-{
- printf ("IMPORTANT: This \"fastcgi\" module is NOT ready to be used. Please,\n");
- printf ("modify your configuration in order to use the \"fcgi\" module instead.\n\n");
-}
-
-HANDLER_MODULE_INFO_INIT_EASY (fastcgi, http_get | http_post | http_head);
-
View
37 cherokee/handler_fastcgi.h
@@ -29,7 +29,7 @@
#include "handler.h"
#include "buffer.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#include "socket.h"
#include "balancer.h"
#include "handler_cgi_base.h"
@@ -55,17 +55,8 @@ typedef enum {
} cherokee_handler_fastcgi_post_t;
-typedef struct {
- cherokee_handler_cgi_base_t base;
-
- cherokee_balancer_t *balancer;
- cherokee_list_t fastcgi_env_ref;
-
- cuint_t nsockets;
- cuint_t nkeepalive;
- cuint_t npipeline;
-} cherokee_handler_fastcgi_props_t;
-
+/* Data structure
+ */
typedef struct {
cherokee_handler_cgi_base_t base;
@@ -82,12 +73,28 @@ typedef struct {
} cherokee_handler_fastcgi_t;
#define HDL_FASTCGI(x) ((cherokee_handler_fastcgi_t *)(x))
-#define PROP_FASTCGI(x) ((cherokee_handler_fastcgi_props_t *)(x))
-#define HDL_FASTCGI_PROPS(x) (PROP_FASTCGI(HANDLER(x)->props))
+
+
+/* Properties data structure
+ */
+typedef struct {
+ cherokee_handler_cgi_base_t base;
+
+ cherokee_balancer_t *balancer;
+ cherokee_list_t fastcgi_env_ref;
+
+ cuint_t nsockets;
+ cuint_t nkeepalive;
+ cuint_t npipeline;
+} cherokee_handler_fastcgi_props_t;
+
+#define PROP_FASTCGI(x) ((cherokee_handler_fastcgi_props_t *)(x))
+#define HANDLER_FASTCGI_PROPS(x) (PROP_FASTCGI(MODULE(x)->props))
+
/* Library init function
*/
-void MODULE_INIT(fastcgi) (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(fastcgi) (cherokee_plugin_loader_t *loader);
/* Methods
*/
View
37 cherokee/handler_fcgi.c
@@ -44,6 +44,13 @@ static void set_env_pair (cherokee_handler_cgi_base_t *cgi_base,
char *key, int key_len,
char *val, int val_len);
+/* Plug-in initialization
+ */
+PLUGIN_INFO_HANDLER_EASIEST_INIT (fcgi, http_get | http_post | http_head);
+
+
+/* Methods implementation
+ */
static ret_t
process_package (cherokee_handler_fcgi_t *hdl, cherokee_buffer_t *inbuf, cherokee_buffer_t *outbuf)
{
@@ -205,7 +212,7 @@ props_free (cherokee_handler_fcgi_props_t *props)
}
-static ret_t
+ret_t
cherokee_handler_fcgi_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props)
{
ret_t ret;
@@ -217,9 +224,10 @@ cherokee_handler_fcgi_configure (cherokee_config_node_t *conf, cherokee_server_t
if (*_props == NULL) {
CHEROKEE_NEW_STRUCT (n, handler_fcgi_props);
- cherokee_module_props_init_base (MODULE_PROPS(n),
- MODULE_PROPS_FREE(props_free));
- INIT_LIST_HEAD(&n->server_list);
+ cherokee_handler_cgi_base_props_init_base (PROP_CGI_BASE(n),
+ MODULE_PROPS_FREE(props_free));
+
+ INIT_LIST_HEAD (&n->server_list);
n->balancer = NULL;
*_props = MODULE_PROPS(n);
@@ -261,7 +269,8 @@ cherokee_handler_fcgi_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_
/* Init the base class
*/
- cherokee_handler_cgi_base_init (HDL_CGI_BASE(n), cnt, props, set_env_pair, read_from_fcgi);
+ cherokee_handler_cgi_base_init (HDL_CGI_BASE(n), cnt, PLUGIN_INFO_HANDLER_PTR(fcgi),
+ HANDLER_PROPS(props), set_env_pair, read_from_fcgi);
/* Virtual methods
*/
@@ -492,7 +501,7 @@ connect_to_server (cherokee_handler_fcgi_t *hdl)
int try = 0;
cherokee_source_t *src = NULL;
cherokee_connection_t *conn = HANDLER_CONN(hdl);
- cherokee_handler_fcgi_props_t *props = HDL_FCGI_PROPS(hdl);
+ cherokee_handler_fcgi_props_t *props = HANDLER_FCGI_PROPS(hdl);
ret = cherokee_balancer_dispatch (props->balancer, conn, &src);
if (ret != ret_ok) return ret;
@@ -532,16 +541,16 @@ static ret_t
do_send (cherokee_handler_fcgi_t *hdl, cherokee_buffer_t *buffer)
{
ret_t ret;
- size_t written = 0;
+ size_t written;
cherokee_connection_t *conn = HANDLER_CONN(hdl);
ret = cherokee_socket_write (&hdl->socket, buffer, &written);
switch (ret) {
case ret_ok:
break;
case ret_eagain:
- cherokee_thread_deactive_to_polling (HANDLER_THREAD(hdl), HANDLER_CONN(hdl),
- hdl->socket.socket, 1, false);
+ if (written > 0)
+ break;
return ret_eagain;
default:
conn->error_code = http_bad_gateway;
@@ -730,13 +739,3 @@ cherokee_handler_fcgi_init (cherokee_handler_fcgi_t *hdl)
return ret_ok;
}
-
-/* Module init
- */
-void
-MODULE_INIT(fcgi) (cherokee_module_loader_t *loader)
-{
-}
-
-HANDLER_MODULE_INFO_INIT_EASY (fcgi, http_get | http_post | http_head);
-
View
30 cherokee/handler_fcgi.h
@@ -29,7 +29,7 @@
#include "handler.h"
#include "buffer.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#include "socket.h"
#include "handler_cgi_base.h"
#include "balancer.h"
@@ -41,12 +41,8 @@ typedef enum {
fcgi_post_write
} cherokee_handler_fcgi_post_t;
-typedef struct {
- cherokee_handler_cgi_base_t base;
- cherokee_list_t server_list;
- cherokee_balancer_t *balancer;
-} cherokee_handler_fcgi_props_t;
-
+/* Data structure
+ */
typedef struct {
cherokee_handler_cgi_base_t base;
cherokee_socket_t socket;
@@ -55,16 +51,22 @@ typedef struct {
cherokee_buffer_t write_buffer;
} cherokee_handler_fcgi_t;
-#define HDL_FCGI(x) ((cherokee_handler_fcgi_t *)(x))
-#define PROP_FCGI(x) ((cherokee_handler_fcgi_props_t *)(x))
-#define HDL_FCGI_PROPS(x) (PROP_FCGI(HANDLER(x)->props))
+#define HDL_FCGI(x) ((cherokee_handler_fcgi_t *)(x))
+
-
-/* Library init function
+/* Properties
*/
-void MODULE_INIT(fcgi) (cherokee_module_loader_t *loader);
+typedef struct {
+ cherokee_handler_cgi_base_t base;
+ cherokee_list_t server_list;
+ cherokee_balancer_t *balancer;
+} cherokee_handler_fcgi_props_t;
+
+#define PROP_FCGI(x) ((cherokee_handler_fcgi_props_t *)(x))
+#define HANDLER_FCGI_PROPS(x) (PROP_FCGI (MODULE(x)->props))
+
-/* Methods
+ /* Methods
*/
ret_t cherokee_handler_fcgi_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *props);
ret_t cherokee_handler_fcgi_free (cherokee_handler_fcgi_t *hdl);
View
32 cherokee/handler_file.c
@@ -46,10 +46,17 @@
#define ENTRIES "handler,file"
+/* Plug-in initialization
+ */
+PLUGIN_INFO_HANDLER_EASIEST_INIT (file, http_get | http_head);
+
+
+/* Methods implementation
+ */
ret_t
cherokee_handler_file_props_free (cherokee_handler_file_props_t *props)
{
- return cherokee_module_props_free_base (MODULE_PROPS(props));
+ return cherokee_handler_props_free_base (HANDLER_PROPS(props));
}
@@ -62,8 +69,8 @@ cherokee_handler_file_configure (cherokee_config_node_t *conf, cherokee_server_t
if (*_props == NULL) {
CHEROKEE_NEW_STRUCT (n, handler_file_props);
- cherokee_module_props_init_base (MODULE_PROPS(n),
- MODULE_PROPS_FREE(cherokee_handler_file_props_free));
+ cherokee_handler_props_init_base (HANDLER_PROPS(n),
+ MODULE_PROPS_FREE(cherokee_handler_file_props_free));
n->use_cache = true;
*_props = MODULE_PROPS(n);
@@ -93,10 +100,9 @@ cherokee_handler_file_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt
/* Init the base class object
*/
- cherokee_handler_init_base (HANDLER(n), cnt, props);
+ cherokee_handler_init_base (HANDLER(n), cnt, HANDLER_PROPS(props), PLUGIN_INFO_HANDLER_PTR(file));
MODULE(n)->free = (module_func_free_t) cherokee_handler_file_free;
- MODULE(n)->get_name = (module_func_get_name_t) cherokee_handler_file_get_name;
MODULE(n)->init = (handler_func_init_t) cherokee_handler_file_init;
HANDLER(n)->step = (handler_func_step_t) cherokee_handler_file_step;
HANDLER(n)->add_headers = (handler_func_add_headers_t) cherokee_handler_file_add_headers;
@@ -133,13 +139,6 @@ cherokee_handler_file_free (cherokee_handler_file_t *fhdl)
}
-void
-cherokee_handler_file_get_name (cherokee_handler_file_t *module, const char **name)
-{
- *name = "file";
-}
-
-
static ret_t
check_cached (cherokee_handler_file_t *fhdl)
{
@@ -707,12 +706,3 @@ cherokee_handler_file_step (cherokee_handler_file_t *fhdl,
return ret_ok;
}
-
-/* Library init function
- */
-void
-MODULE_INIT(file) (cherokee_module_loader_t *loader)
-{
-}
-
-HANDLER_MODULE_INFO_INIT_EASY (file, http_get | http_head);
View
8 cherokee/handler_file.h
@@ -36,7 +36,7 @@
#include "handler.h"
#include "connection.h"
#include "mime.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
/* Data types
*/
@@ -47,7 +47,7 @@ typedef struct {
typedef struct {
- cherokee_handler_t handler;
+ cherokee_handler_t handler;
int fd;
off_t offset;
@@ -62,12 +62,12 @@ typedef struct {
#define PROP_FILE(x) ((cherokee_handler_file_props_t *)(x))
#define HDL_FILE(x) ((cherokee_handler_file_t *)(x))
-#define HDL_FILE_PROP(x) (PROP_FILE(HANDLER(x)->props))
+#define HDL_FILE_PROP(x) (PROP_FILE(MODULE(x)->props))
/* Library init function
*/
-void MODULE_INIT(file) (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(file) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_file_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
ret_t cherokee_handler_file_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props);
View
13 cherokee/handler_nn.c
@@ -33,7 +33,7 @@
#include "connection.h"
#include "connection-protected.h"
#include "module.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#include "connection.h"
#include "handler_common.h"
#include "handler_redir.h"
@@ -160,17 +160,16 @@ cherokee_handler_nn_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_pr
static cherokee_boolean_t _nn_is_init = false;
void
-MODULE_INIT(nn) (cherokee_module_loader_t *loader)
+PLUGIN_INIT_NAME(nn) (cherokee_plugin_loader_t *loader)
{
/* Is init?
*/
- if (_nn_is_init)
- return;
+ if (_nn_is_init) return;
+ _nn_is_init = true;
/* Load the dependences
*/
- _nn_is_init = true;
- cherokee_module_loader_load (loader, "common");
+ cherokee_plugin_loader_load (loader, "common");
}
-HANDLER_MODULE_INFO_INIT_EASY (nn, http_all_methods);
+PLUGIN_INFO_HANDLER_EASY_INIT (nn, http_all_methods);
View
4 cherokee/handler_nn.h
@@ -27,12 +27,12 @@
#include "common-internal.h"
#include "handler.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
/* Library init function
*/
-void MODULE_INIT(nn) (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(nn) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_nn_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *props);
ret_t cherokee_handler_nn_init (cherokee_handler_t *hdl);
View
17 cherokee/handler_phpcgi.c
@@ -48,7 +48,7 @@
#endif
#include "module.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#include "handler_cgi.h"
#include "connection.h"
#include "connection-protected.h"
@@ -71,6 +71,11 @@ static char *php_names[] = {
};
+/* Plugin initialization
+ */
+PLUGIN_INFO_HANDLER_EASY_INIT (phpcgi, http_get | http_post | http_head);
+
+
static ret_t
check_interpreter (char *path)
{
@@ -212,7 +217,7 @@ props_free (cherokee_handler_phpcgi_props_t *props)
}
-static ret_t
+ret_t
cherokee_handler_phpcgi_configure (cherokee_config_node_t *conf, cherokee_server_t *srv, cherokee_module_props_t **_props)
{
cherokee_list_t *i;
@@ -246,8 +251,8 @@ cherokee_handler_phpcgi_configure (cherokee_config_node_t *conf, cherokee_server
*/
static cherokee_boolean_t _phpcgi_is_init = false;
-void
-MODULE_INIT(phpcgi) (cherokee_module_loader_t *loader)
+void
+PLUGIN_INIT_NAME(phpcgi) (cherokee_plugin_loader_t *loader)
{
/* Is init?
*/
@@ -256,8 +261,6 @@ MODULE_INIT(phpcgi) (cherokee_module_loader_t *loader)
/* Load the dependences
*/
- cherokee_module_loader_load (loader, "cgi");
+ cherokee_plugin_loader_load (loader, "cgi");
}
-HANDLER_MODULE_INFO_INIT_EASY (phpcgi, http_get | http_post | http_head);
-
View
3 cherokee/handler_phpcgi.h
@@ -38,8 +38,7 @@ typedef struct {
/* Library init function
*/
-void MODULE_INIT(phpcgi) (cherokee_module_loader_t *loader);
-
+void PLUGIN_INIT_NAME(phpcgi) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_phpcgi_new (cherokee_handler_t **hdl, void *cnt, cherokee_module_props_t *props);
ret_t cherokee_handler_phpcgi_init (cherokee_handler_t *hdl);
View
26 cherokee/handler_proxy.c
@@ -46,6 +46,13 @@
#define ENTRIES "proxy,handler"
+/* Plug-in initialization
+ */
+PLUGIN_INFO_HANDLER_EASIEST_INIT (proxy, http_get | http_post | http_head);
+
+
+/* Methods implementation
+ */
static ret_t
props_free (cherokee_handler_proxy_props_t *props)
{
@@ -102,10 +109,9 @@ cherokee_handler_proxy_new (cherokee_handler_t **hdl, cherokee_connection_t *cn
/* Init the base class object
*/
- cherokee_handler_init_base (HANDLER(n), cnt, props);
+ cherokee_handler_init_base (HANDLER(n), cnt, HANDLER_PROPS(props), PLUGIN_INFO_HANDLER_PTR(proxy));
MODULE(n)->free = (module_func_free_t) cherokee_handler_proxy_free;
- MODULE(n)->get_name = (module_func_get_name_t) cherokee_handler_proxy_get_name;
MODULE(n)->init = (handler_func_init_t) cherokee_handler_proxy_init;
HANDLER(n)->step = (handler_func_step_t) cherokee_handler_proxy_step;
HANDLER(n)->add_headers = (handler_func_add_headers_t) cherokee_handler_proxy_add_headers;
@@ -139,13 +145,6 @@ cherokee_handler_proxy_free (cherokee_handler_proxy_t *hdl)
}
-void
-cherokee_handler_proxy_get_name (cherokee_handler_proxy_t *hdl, const char **name)
-{
- *name = "proxy";
-}
-
-
static ret_t
add_extra_headers (cherokee_handler_proxy_t *hdl)
{
@@ -326,12 +325,3 @@ cherokee_handler_proxy_step (cherokee_handler_proxy_t *phdl,
}
-/* Library init function
- */
-void
-MODULE_INIT(proxy) (cherokee_module_loader_t *loader)
-{
-}
-
-HANDLER_MODULE_INFO_INIT_EASY (proxy, http_get | http_post | http_head);
-
View
4 cherokee/handler_proxy.h
@@ -33,7 +33,7 @@
#include "handler.h"
#include "downloader.h"
#include "downloader-protected.h"
-#include "module_loader.h"
+#include "plugin_loader.h"
#include "buffer.h"
#include "table.h"
#include "connection.h"
@@ -59,7 +59,7 @@ typedef struct {
/* Library init function
*/
-void MODULE_INIT(proxy) (cherokee_module_loader_t *loader);
+void PLUGIN_INIT_NAME(proxy) (cherokee_plugin_loader_t *loader);
ret_t cherokee_handler_proxy_new (cherokee_handler_t **hdl, cherokee_connection_t *cnt, cherokee_module_props_t *props);
View
21 cherokee/handler_redir.c
@@ -36,6 +36,13 @@
#define ENTRIES "handler,redir"
+/* Plug-in initialization
+ */
+PLUGIN_INFO_HANDLER_EASIEST_INIT (redir, http_all_methods);
+
+
+/* Methods implementation
+ */
#ifndef CHEROKEE_EMBEDDED
struct cre_list {
@@ -261,7 +268,7 @@ cherokee_handler_redir_new (cherokee_handler_t **hdl, void *cnt, cherokee_module
/* Init the base class object
*/
- cherokee_handler_init_base(HANDLER(n), cnt, props);