ngx_http_upstream_conpaas_module.c
/**
 * Sets the module's configuration based on the arguments given to the "conpaas" directive.
 */
Sets the module's configuration based on the arguments given to the "conpaas" directive.
Sets the module ' s configuration based on the arguments given to the " conpaas " directive .
static char *
ngx_http_upstream_conpaas(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
    ngx_http_upstream_srv_conf_t  *uscf;
    ngx_http_script_compile_t      sc;
    ngx_str_t                     *value;
    ngx_array_t                   *vars_lengths, *vars_values;
    char							*p;
    ngx_http_upstream_conpaas_conf_t *conpaas_conf;
    value = cf->args->elts;
    ngx_log_debug(NGX_LOG_NOTICE, cf ->log, 0, "In ngx_http_upstream_conpaas()...");
    ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
    vars_lengths = NULL;
    vars_values = NULL;
    sc.cf = cf;
    sc.source = &value[1];
    sc.lengths = &vars_lengths;
    sc.values = &vars_values;
    sc.complete_lengths = 1;
    sc.complete_values = 1;
    if (ngx_http_script_compile(&sc) != NGX_OK) {
        return NGX_CONF_ERROR;
    }
    p = conf;
    conpaas_conf = (ngx_http_upstream_conpaas_conf_t *) conf;
    conpaas_conf -> profiling_file = ngx_palloc(cf-> pool, sizeof(char) * (value[1].len + 1));
    if (conpaas_conf -> profiling_file == NULL) {
    	return NGX_CONF_ERROR;
    }
    strcpy(conpaas_conf -> profiling_file, (char *)value[1].data);
    ngx_log_debug1(NGX_LOG_NOTICE, cf ->log, 0,
                      "Using profiling config file: %s", conpaas_conf -> profiling_file);
    uscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_module);
    uscf->peer.init_upstream = ngx_http_upstream_init_conpaas;
    uscf->flags = NGX_HTTP_UPSTREAM_CREATE;
    return NGX_CONF_OK;
}
static char * ngx_http_upstream_conpaas ( ngx_conf_t * cf , ngx_command_t * cmd , void * conf ) { ngx_http_upstream_srv_conf_t * uscf ; ngx_http_script_compile_t sc ; ngx_str_t * value ; ngx_array_t * vars_lengths , * vars_values ; char * p ; ngx_http_upstream_conpaas_conf_t * conpaas_conf ; value = cf -> args -> elts ; ngx_log_debug ( NGX_LOG_NOTICE , cf -> log , 0 , " " ) ; ngx_memzero ( & sc , sizeof ( ngx_http_script_compile_t ) ) ; vars_lengths = NULL ; vars_values = NULL ; sc . cf = cf ; sc . source = & value [ 1 ] ; sc . lengths = & vars_lengths ; sc . values = & vars_values ; sc . complete_lengths = 1 ; sc . complete_values = 1 ; if ( ngx_http_script_compile ( & sc ) != NGX_OK ) { return NGX_CONF_ERROR ; } p = conf ; conpaas_conf = ( ngx_http_upstream_conpaas_conf_t * ) conf ; conpaas_conf -> profiling_file = ngx_palloc ( cf -> pool , sizeof ( char ) * ( value [ 1 ] . len + 1 ) ) ; if ( conpaas_conf -> profiling_file == NULL ) { return NGX_CONF_ERROR ; } strcpy ( conpaas_conf -> profiling_file , ( char * ) value [ 1 ] . data ) ; ngx_log_debug1 ( NGX_LOG_NOTICE , cf -> log , 0 , " " , conpaas_conf -> profiling_file ) ; uscf = ngx_http_conf_get_module_srv_conf ( cf , ngx_http_upstream_module ) ; uscf -> peer . init_upstream = ngx_http_upstream_init_conpaas ; uscf -> flags = NGX_HTTP_UPSTREAM_CREATE ; return NGX_CONF_OK ; }
Sets the module's configuration based on the arguments given to the "conpaas" directive.
Sets the module ' s configuration based on the arguments given to the " conpaas " directive .
/* set the values in the configuration structure */ /* interval = ngx_atoi(value[1].data, value[1].len); */ /*
    conpaas_conf -> profile_interval = ngx_atoi(value[1].data, value[1].len);
    conpaas_conf -> profile_duration = ngx_atoi(value[2].data, value[2].len);
    */ /*
    if (value[3].len > 30) {
    	ngx_log_error(NGX_LOG_EMERG, cf->log, 0, "Profiling configuration file name too large");
    	return NGX_CONF_ERROR;
    }
    */ /* strcpy(conpaas_conf -> conf_file, (char *)(value[3].data)); */ /* set the upstream initialization function */ /*
    uscf->values = vars_values->elts;
    uscf->lengths = vars_lengths->elts;

    if (uscf->hash_function == NULL) {
        uscf->hash_function = ngx_hash_key;
    }
     */