示例#1
0
ret_t
cherokee_x_real_ip_configure (cherokee_x_real_ip_t   *real_ip,
			      cherokee_config_node_t *config)
{
	ret_t                   ret;
	cherokee_config_node_t *subconf;

	cherokee_config_node_read_bool (config, "x_real_ip_enabled",    &real_ip->enabled);
	cherokee_config_node_read_bool (config, "x_real_ip_access_all", &real_ip->access_all);

	ret = cherokee_config_node_get (config, "x_real_ip_access", &subconf);
	if (ret == ret_ok) {
		ret = cherokee_config_node_read_list (subconf, NULL, add_access, real_ip);
		if (ret != ret_ok) {
			LOG_ERROR_S (CHEROKEE_ERROR_LOGGER_X_REAL_IP_PARSE);
			return ret_error;
		}
	}

	return ret_ok;
}
示例#2
0
static ret_t
configure (cherokee_rule_extensions_t *rule,
	   cherokee_config_node_t     *conf,
	   cherokee_virtual_server_t  *vsrv)
{
	ret_t              ret;
	cherokee_buffer_t *tmp = NULL;

	UNUSED(vsrv);

	ret = cherokee_config_node_read (conf, "extensions", &tmp);
	if (ret != ret_ok) {
		LOG_CRITICAL (CHEROKEE_ERROR_RULE_NO_PROPERTY,
			      RULE(rule)->priority, "extensions");
		return ret_error;
	}

	cherokee_config_node_read_bool (conf, "check_local_file", &rule->check_local_file);
	cherokee_config_node_read_bool (conf, "iocache",          &rule->use_iocache);

	return parse_value (tmp, &rule->extensions);
}
示例#3
0
static ret_t
configure_rewrite_entry (cherokee_list_t        *list,
			 cherokee_config_node_t *conf,
			 cherokee_regex_table_t *regexs)
{
	ret_t                   ret;
	cherokee_regex_entry_t *n;
	cherokee_buffer_t      *substring;
	cherokee_boolean_t      hidden     = true;
	pcre                   *re         = NULL;
	cherokee_buffer_t      *regex      = NULL;

	TRACE(ENTRIES, "Converting rewrite rule '%s'\n", conf->key.buf);

	/* Query conf
	 */
	cherokee_config_node_read_bool (conf, "show", &hidden);
	hidden = !hidden;

	ret = cherokee_config_node_read (conf, "regex", &regex);
	if (ret == ret_ok) {
		ret = cherokee_regex_table_get (regexs, regex->buf, (void **)&re);
		if (ret != ret_ok)
			return ret;
	}

	ret = cherokee_config_node_read (conf, "substring", &substring);
	if (ret != ret_ok)
		return ret;

	/* New RegEx
	 */
	n = (cherokee_regex_entry_t *) malloc(sizeof(cherokee_regex_entry_t));
	if (unlikely (n == NULL))
		return ret_nomem;

	INIT_LIST_HEAD (&n->listed);
	n->re         = re;
	n->hidden     = hidden;

	cherokee_buffer_init (&n->subs);
	cherokee_buffer_add_buffer (&n->subs, substring);

	/* Add the list
	 */
	cherokee_list_add_tail (&n->listed, list);
	return ret_ok;
}
示例#4
0
文件: logger.c 项目: BeQ/webserver
ret_t
cherokee_logger_init_base (cherokee_logger_t      *logger,
			   cherokee_plugin_info_t *info,
			   cherokee_config_node_t *config)
{
	ret_t ret;
	CHEROKEE_NEW_TYPE(priv, struct cherokee_logger_private);

	/* Init the base class
	 */
	cherokee_module_init_base (MODULE(logger), NULL, info);

	/* Pure virtual methods
	 */
	logger->priv         = priv;
	logger->write_access = NULL;
	logger->utc_time     = false;

	/* Private
	 */
	logger->priv->backup_mode = false;

       	CHEROKEE_MUTEX_INIT (&PRIV(logger)->mutex, NULL);
	cherokee_x_real_ip_init (&logger->priv->x_real_ip);

	/* Read the configuration
	 */
	ret = cherokee_x_real_ip_configure (&logger->priv->x_real_ip, config);
	if (ret != ret_ok) {
		return ret_error;
	}

	cherokee_config_node_read_bool (config, "utc_time", &logger->utc_time);

	return ret_ok;
}