static void* apache_http_modsecurity_merge_loc_conf(apr_pool_t* pool, void* parent, void* child) {
    fprintf(stderr,"Merge Request was called\n\n");
    apache_http_modsecurity_loc_conf_t *p = NULL;
    apache_http_modsecurity_loc_conf_t *c = NULL;
    apache_http_modsecurity_loc_conf_t *conf = apr_palloc(pool, sizeof(apache_http_modsecurity_loc_conf_t));
    p = parent;
    c = child;
    conf = p;
    fprintf(stderr,"Rules set: '%p'\n", conf->rules_set);
    if (p->rules_set != NULL)
    {
    	fprintf(stderr,"We have parental data");
        fprintf(stderr,"Parent is not null, so we have to merge this configurations");
        msc_rules_merge(c->rules_set, p->rules_set);
    }
    
    if (c->rules_remote_server != NULL)
    {
        int res;
        const char *error = NULL;
        res = msc_rules_add_remote(c->rules_set, c->rules_remote_key, c->rules_remote_server, &error);
        fprintf(stderr,"Loading rules from: '%s'", c->rules_remote_server);
        if (res < 0) {
            fprintf("Failed to load the rules from: '%s'  - reason: '%s'", c->rules_remote_server, error);

            return strdup(error);
        }
        fprintf(stderr,"Loaded '%d' rules.", res);
    }

    if (c->rules_file != NULL)
    {
        int res;
        const char *error = NULL;
        res = msc_rules_add_file(c->rules_set, c->rules_set, &error);
        fprintf(stderr,"Loading rules from: '%s'", c->rules_set);
        if (res < 0) {
            fprintf(stderr,"Failed to load the rules from: '%s' - reason: '%s'", c->rules_set, error);
            return strdup(error);
        }
        fprintf(stderr,"Loaded '%d' rules.", res);
    }

    if (c->rules != NULL)
    {
        int res;
        const char *error = NULL;
        res = msc_rules_add(c->rules_set, c->rules, &error);
        fprintf(stderr,"Loading rules: '%s'", c->rules);
        if (res < 0) {
            fprintf(stderr,"Failed to load the rules: '%s' - reason: '%s'", c->rules, error);
            return strdup(error);
        }
    }
    msc_rules_dump(c->rules_set);
    return conf;
}
static char *
ngx_http_modsecurity_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_modsecurity_loc_conf_t *p = NULL;
    ngx_http_modsecurity_loc_conf_t *c = NULL;

    p = parent;
    c = child;

    ngx_conf_merge_value(c->enable, p->enable, 0);

    dd("Rules set: '%p'\n", c->rules_set);
    dd("Parent ModSecurityRuleSet is: '%p' current is: '%p'", p->rules_set, c->rules_set);
    if (p->rules_set != NULL)
    {
        dd("Parent is not null, so we have to merge these configurations");
        msc_rules_merge(c->rules_set, p->rules_set);
    }


    /**
     * FIXME: Fix the rules inclusion order.
     *
     * We are not respecting the order of the rules inclusion,
     * we should; It is not hard to do. Maybe for further
     * versions.
     */
    if (c->rules_remote_server.len > 0)
    {
        int res;
        const char *error = NULL;
        const char *rules_remote_server = ngx_str_to_char(c->rules_remote_server, cf->pool);
        if(rules_remote_server==(char *)-1){
            return NGX_CONF_ERROR;
        }
        const char *rules_remote_key = ngx_str_to_char(c->rules_remote_key, cf->pool);
        if(rules_remote_key==(char *)-1){
            return NGX_CONF_ERROR;
        }
        res = msc_rules_add_remote(c->rules_set, rules_remote_key, rules_remote_server, &error);
        dd("Loading rules from: '%s'", rules_remote_server);
        if (res < 0) {
            dd("Failed to load the rules from: '%s'  - reason: '%s'", rules_remote_server, error);
            return strdup(error);
        }
        dd("Loaded '%d' rules.", res);
    }
    if (c->rules_file.len > 0)
    {
        int res;
        const char *error = NULL;
        char *rules_set = ngx_str_to_char(c->rules_file, cf->pool);
        if(rules_set==(char *)-1){
            return NGX_CONF_ERROR;
        }
        res = msc_rules_add_file(c->rules_set, rules_set, &error);
        dd("Loading rules from: '%s'", rules_set);
        if (res < 0) {
            dd("Failed to load the rules from: '%s' - reason: '%s'", rules_set, error);
            return strdup(error);
        }
        dd("Loaded '%d' rules.", res);
    }
    if (c->rules.len > 0)
    {
        int res;
        const char *error = NULL;
        char *rules = ngx_str_to_char(c->rules, cf->pool);
        if(rules==(char *)-1){
            return NGX_CONF_ERROR;
        }
        res = msc_rules_add(c->rules_set, rules, &error);
        dd("Loading rules: '%s'", rules);
        if (res < 0) {
            dd("Failed to load the rules: '%s' - reason: '%s'", rules, error);
            return strdup(error);
        }
    }
    msc_rules_dump(c->rules_set);
    return NGX_CONF_OK;
}