-const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.113 2011/07/08 13:27:31 fabiankeil Exp $";
+const char loadcfg_rcs[] = "$Id: loadcfg.c,v 1.116 2011/07/08 13:29:39 fabiankeil Exp $";
/*********************************************************************
*
* File : $Source: /cvsroot/ijbswa/current/loadcfg.c,v $
#define hash_default_server_timeout 2530089913ul /* "default-server-timeout" */
#define hash_deny_access 1227333715ul /* "deny-access" */
#define hash_enable_edit_actions 2517097536ul /* "enable-edit-actions" */
+#define hash_enable_compression 3943696946ul /* "enable-compression" */
#define hash_enable_remote_toggle 2979744683ul /* "enable-remote-toggle" */
#define hash_enable_remote_http_toggle 110543988ul /* "enable-remote-http-toggle" */
#define hash_enforce_blocks 1862427469ul /* "enforce-blocks" */
{
int toggle_state;
assert(name != NULL);
+ assert(value != NULL);
if ((value == NULL) || (*value == '\0'))
{
toggle_state = atoi(value);
- if ((toggle_state != 0) && (toggle_state != 1))
+ /*
+ * Also check the length as atoi() doesn't mind
+ * garbage after a valid integer, but we do.
+ */
+ if (((toggle_state != 0) && (toggle_state != 1)) || (strlen(value) != 1))
{
log_error(LOG_LEVEL_FATAL,
"Directive %s used with invalid argument '%s'. Use either '0' or '1'.",
config->feature_flags &= ~RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS;
config->feature_flags &= ~RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK;
#ifdef FEATURE_COMPRESSION
+ config->feature_flags &= ~RUNTIME_FEATURE_COMPRESSION;
/*
* XXX: Run some benchmarks to see if there are better default values.
*/
* accept-intercepted-requests
* *************************************************************************/
case hash_accept_intercepted_requests:
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_ACCEPT_INTERCEPTED_REQUESTS;
}
* allow-cgi-request-crunching
* *************************************************************************/
case hash_allow_cgi_request_crunching:
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_CGI_CRUNCHING;
}
* *************************************************************************/
#ifdef FEATURE_CONNECTION_SHARING
case hash_connection_sharing :
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_CONNECTION_SHARING;
}
* *************************************************************************/
#ifdef FEATURE_CGI_EDIT_ACTIONS
case hash_enable_edit_actions:
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_CGI_EDIT_ACTIONS;
}
break;
#endif /* def FEATURE_CGI_EDIT_ACTIONS */
+/* *************************************************************************
+ * enable-compression 0|1
+ * *************************************************************************/
+#ifdef FEATURE_COMPRESSION
+ case hash_enable_compression:
+ if (parse_toggle_state(cmd, arg) == 1)
+ {
+ config->feature_flags |= RUNTIME_FEATURE_COMPRESSION;
+ }
+ else
+ {
+ config->feature_flags &= ~RUNTIME_FEATURE_COMPRESSION;
+ }
+ break;
+#endif /* def FEATURE_COMPRESSION */
+
+
/* *************************************************************************
* enable-remote-toggle 0|1
* *************************************************************************/
#ifdef FEATURE_TOGGLE
case hash_enable_remote_toggle:
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_CGI_TOGGLE;
}
* enable-remote-http-toggle 0|1
* *************************************************************************/
case hash_enable_remote_http_toggle:
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_HTTP_TOGGLE;
}
* *************************************************************************/
case hash_enforce_blocks:
#ifdef FEATURE_FORCE_LOAD
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_ENFORCE_BLOCKS;
}
* to the browser for blocked pages.
***************************************************************************/
case hash_handle_as_empty_returns_ok:
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_EMPTY_DOC_RETURNS_OK;
}
* split-large-cgi-forms
* *************************************************************************/
case hash_split_large_cgi_forms :
- if (0 != parse_toggle_state(cmd, arg))
+ if (parse_toggle_state(cmd, arg) == 1)
{
config->feature_flags |= RUNTIME_FEATURE_SPLIT_LARGE_FORMS;
}