Fix option handling: need another opt_base_index for pointer options

personal/stbuehler/wip
Stefan Bühler 13 years ago
parent 2e4aba7e39
commit 5284ce9cb4
  1. 4
      include/lighttpd/plugin.h
  2. 1
      src/main/plugin.c
  3. 6
      src/modules/mod_fastcgi.c

@ -28,7 +28,7 @@ struct liPlugin {
gpointer data; /**< private plugin data */
size_t opt_base_index;
size_t opt_base_index, optptr_base_index;
gboolean ready_for_next_state; /**< don't modify this; use li_plugin_ready_for_state() instead */
@ -190,7 +190,7 @@ extern liOptionPtrValue li_option_ptr_zero;
#define _OPTION(vr, p, idx) (vr->options[p->opt_base_index + idx])
#define _OPTION_ABS(vr, idx) (vr->options[idx])
#define OPTIONPTR(idx) _OPTIONPTR(vr, p, idx)
#define _OPTIONPTR(vr, p, idx) (vr->optionptrs[p->opt_base_index + idx] ? vr->optionptrs[p->opt_base_index + idx]->data : li_option_ptr_zero.data)
#define _OPTIONPTR(vr, p, idx) (vr->optionptrs[p->optptr_base_index + idx] ? vr->optionptrs[p->optptr_base_index + idx]->data : li_option_ptr_zero.data)
#define _OPTIONPTR_ABS(vr, idx) (vr->optionptrs[idx] ? vr->optionptrs[idx]->data : li_option_ptr_zero.data)
#endif

@ -136,6 +136,7 @@ liPlugin *li_plugin_register(liServer *srv, const gchar *name, liPluginInitCB in
init(srv, p, userdata);
p->opt_base_index = g_hash_table_size(srv->options);
p->optptr_base_index = g_hash_table_size(srv->optionptrs);
if (p->options) {
size_t i;

@ -32,10 +32,6 @@ enum fastcgi_options_t {
FASTCGI_OPTION_LOG_PLAIN_ERRORS = 0,
};
#define FASTCGI_OPTION(idx) _FASTCGI_OPTION(vr, idx)
#define _FASTCGI_OPTION(vr, idx) _OPTION_ABS(vr, p->opt_base_index + idx)
LI_API gboolean mod_fastcgi_init(liModules *mods, liModule *mod);
LI_API gboolean mod_fastcgi_free(liModules *mods, liModule *mod);
@ -531,7 +527,7 @@ static gboolean fastcgi_parse_response(fastcgi_connection *fcon) {
case FCGI_STDERR:
len = fastcgi_available(fcon);
li_chunkqueue_extract_to(vr, fcon->fcgi_in, len, vr->wrk->tmp_str);
if (FASTCGI_OPTION(FASTCGI_OPTION_LOG_PLAIN_ERRORS).boolean) {
if (OPTION(FASTCGI_OPTION_LOG_PLAIN_ERRORS).boolean) {
li_log_split_lines(vr->wrk->srv, vr, LI_LOG_LEVEL_BACKEND, 0, vr->wrk->tmp_str->str, "");
} else {
VR_BACKEND_LINES(vr, vr->wrk->tmp_str->str, "(fcgi-stderr %s) ", fcon->ctx->socket_str->str);

Loading…
Cancel
Save