[plugins] Fix some default options (the raw default-value is only used when there is no parser method)
parent
be50c790e1
commit
eb9f6aa368
|
@ -180,12 +180,12 @@ static al_format al_get_format(gchar c) {
|
|||
return NULL; \
|
||||
} while (0)
|
||||
|
||||
static GArray *al_parse_format(liServer *srv, GString *formatstr) {
|
||||
static GArray *al_parse_format(liServer *srv, const gchar *formatstr) {
|
||||
GArray *arr = g_array_new(FALSE, TRUE, sizeof(al_format_entry));
|
||||
al_format_entry e;
|
||||
gchar *c, *k;
|
||||
const gchar *c, *k;
|
||||
|
||||
for (c = formatstr->str; *c != '\0';) {
|
||||
for (c = formatstr; *c != '\0';) {
|
||||
|
||||
if (*c == '%') {
|
||||
c++;
|
||||
|
@ -466,16 +466,14 @@ static gboolean al_option_accesslog_format_parse(liServer *srv, liWorker *wrk, l
|
|||
|
||||
if (!val) {
|
||||
/* default */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (val->type != LI_VALUE_STRING) {
|
||||
arr = al_parse_format(srv, AL_DEFAULT_FORMAT);
|
||||
} else if (val->type != LI_VALUE_STRING) {
|
||||
ERROR(srv, "accesslog.format option expects a string as parameter, %s given", li_value_type_string(val->type));
|
||||
return FALSE;
|
||||
} else {
|
||||
arr = al_parse_format(srv, val->data.string->str);
|
||||
}
|
||||
|
||||
arr = al_parse_format(srv, val->data.string);
|
||||
|
||||
if (!arr) {
|
||||
ERROR(srv, "%s", "failed to parse accesslog format");
|
||||
return FALSE;
|
||||
|
@ -489,7 +487,7 @@ static gboolean al_option_accesslog_format_parse(liServer *srv, liWorker *wrk, l
|
|||
|
||||
static const liPluginOptionPtr optionptrs[] = {
|
||||
{ "accesslog", LI_VALUE_NONE, NULL, al_option_accesslog_parse, al_option_accesslog_free },
|
||||
{ "accesslog.format", LI_VALUE_STRING, AL_DEFAULT_FORMAT, al_option_accesslog_format_parse, al_option_accesslog_format_free },
|
||||
{ "accesslog.format", LI_VALUE_STRING, NULL, al_option_accesslog_format_parse, al_option_accesslog_format_free },
|
||||
|
||||
{ NULL, 0, NULL, NULL, NULL }
|
||||
};
|
||||
|
|
|
@ -445,7 +445,7 @@ static gboolean progress_methods_parse(liServer *srv, liWorker *wrk, liPlugin *p
|
|||
|
||||
/* default value */
|
||||
if (!val) {
|
||||
oval->number = 1 << LI_HTTP_METHOD_GET;
|
||||
oval->number = 1 << LI_HTTP_METHOD_POST;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -511,8 +511,8 @@ static void progress_prepare(liServer *srv, liPlugin *p) {
|
|||
|
||||
|
||||
static const liPluginOption options[] = {
|
||||
{ "progress.debug", LI_VALUE_BOOLEAN, 0, NULL },
|
||||
{ "progress.methods", LI_VALUE_LIST, (1 << LI_HTTP_METHOD_POST), progress_methods_parse },
|
||||
{ "progress.debug", LI_VALUE_BOOLEAN, FALSE, NULL },
|
||||
{ "progress.methods", LI_VALUE_LIST, 0, progress_methods_parse },
|
||||
|
||||
{ NULL, 0, 0, NULL }
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue