示例#1
0
static char *
ngx_http_echo(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
	DEBUG_LOG("haoning --ngx_http_echo->>>>> init");
    ngx_http_core_loc_conf_t  *clcf;
    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
    clcf->handler = ngx_http_echo_handler;
    ngx_conf_set_str_slot(cf,cmd,conf);
    return NGX_CONF_OK;
}
static char *
ngx_http_hello_nginx(ngx_conf_t *cf, ngx_command_t *cmd, void *conf){
  ngx_http_core_loc_conf_t *clcf;

  clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
  clcf->handler = ngx_http_hello_nginx_handler;

  ngx_conf_set_str_slot(cf, cmd, conf);

  return NGX_CONF_OK;
}
示例#3
0
static char *
ngx_http_hello_string(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) {

	ngx_http_hello_loc_conf_t* local_conf;

	local_conf = conf;
	char* rv = ngx_conf_set_str_slot(cf, cmd, conf);

	ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "hello_string:%s",
			local_conf->hello_string.data);

	return rv;
}
// 这里加载词库数据
static char* ngx_http_mmseg_set_conf(ngx_conf_t* cf, ngx_command_t* cmd, void* conf) {
    ngx_http_core_loc_conf_t* clcf;
    clcf = (ngx_http_core_loc_conf_t*)ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
    clcf->handler = ngx_http_mmseg_handler;
    ngx_conf_set_str_slot(cf, cmd, conf);
    if (cf->args->nelts != 3) {
        ngx_log_error(NGX_LOG_ERR, cf->log, 0, " [the number of conf'a args is not 3] ");
        return (char*)NGX_CONF_ERROR;
    }
    ngx_str_t * value = (ngx_str_t *)cf->args->elts;
    //static mmsegSpace::MMSeg interface = mmsegSpace::MMSeg::Instance("/search/odin/wangdan/nginx_mmseg/mmseg/data/words.dic", "/search/odin/wangdan/nginx_mmseg/mmseg/data/word.dic");
    static mmsegSpace::MMSeg* Pinterface = mmsegSpace::MMSeg::get_instance(std::string((const char *)value[1].data, value[1].len),
                                           string((const char *)value[2].data, value[2].len));
    g_interface = Pinterface;
    return NGX_CONF_OK;
}
示例#5
0
/*参数处理方案*/
static char *
ngx_http_mytest(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
	ngx_http_core_loc_conf_t *clcf;
	
	/*获取模块参数并预处理*/
	clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
	
	/*设置在模块处理函数*/
	clcf->handler = ngx_http_mytest_handler;
	
	/******缺失********/
	ngx_conf_set_str_slot(cf, cmd, conf);					  // 以ngx_str_t类型来保存参数

	
	return 	NGX_CONF_OK;
}
static char* ngx_http_yar_conf_yar_method_path(ngx_conf_t *cf, ngx_command_t *cmd,void *conf){

    ngx_http_yar_loc_conf_t *local_conf = conf;

    char* rv = ngx_conf_set_str_slot(cf, cmd, local_conf);

    if(local_conf->yar_method_path.len > 0 && local_conf->yar_method_handler == NULL){

        local_conf->yar_method_handler = (void *) dlopen ((const char *) local_conf->yar_method_path.data,
                                                   RTLD_NOW | RTLD_LOCAL);

        local_conf->dlerror = dlerror();

    }

    return rv;

}
static char *ngx_http_hello_string(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{

	ngx_http_core_loc_conf_t *clcf;
    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "hello_world: handler hooked\n");
    clcf->handler = ngx_http_hello_handler;
    /* ngx_conf_set_str_slot从配置中获取指令参数,并将参数存储到配置文件结构体中 */
	ngx_conf_set_str_slot(cf, cmd, conf);

    // 打印参数结果
    ngx_http_hello_loc_conf_t* local_conf;
	local_conf = conf;
    ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, "hello_string:%s", local_conf->hello_string.data);


	return NGX_CONF_OK;
}
static char *
ngx_http_set_misc_base32_alphabet(ngx_conf_t *cf, ngx_command_t *cmd,
    void *conf)
{
    ngx_str_t       *value;

    value = cf->args->elts;

    if (value[1].len != BASE32_ALPHABET_LEN) {
        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
                           "\"set_base32_alphabet\" directive takes an "
                           "alphabet of %uz bytes but %d expected",
                           value[1].len, BASE32_ALPHABET_LEN);
        return NGX_CONF_ERROR;
    }

    return ngx_conf_set_str_slot(cf, cmd, conf);
}
char *ngx_http_set_kafka_broker(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
    ngx_http_kafka_loc_conf_t  *local_conf;
    ngx_http_kafka_main_conf_t *main_conf;

    /* ngx_http_kafka_loc_conf_t::broker assignment */
    if (ngx_conf_set_str_slot(cf, cmd, conf) != NGX_CONF_OK) {
        return NGX_CONF_ERROR;
    }

    local_conf = conf;

    main_conf = ngx_http_conf_get_module_main_conf(cf, ngx_http_kafka_module);
    if (main_conf == NULL) {
        return NGX_CONF_ERROR;
    }
    ngx_http_kafka_main_conf_broker_add(main_conf, &local_conf->broker, cf->pool);

    return NGX_CONF_OK;
}
char *ngx_http_set_kafka_topic(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
    ngx_http_core_loc_conf_t   *clcf;
    ngx_http_kafka_loc_conf_t  *local_conf;

    /* install ngx_http_kafka_handler */
    clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
    if (clcf == NULL) {
        return NGX_CONF_ERROR;
    }
    clcf->handler = ngx_http_kafka_handler;

    /* ngx_http_kafka_loc_conf_t::topic assignment */
    if (ngx_conf_set_str_slot(cf, cmd, conf) != NGX_CONF_OK) {
        return NGX_CONF_ERROR;
    }

    local_conf = conf;

    local_conf->rktc = rd_kafka_topic_conf_new();

    return NGX_CONF_OK;
}
static char* ngx_http_hls_conf(ngx_conf_t *cf,ngx_command_t *cmd, void *conf){
	ngx_http_core_loc_conf_t *clcf;
	clcf= ngx_http_conf_get_module_loc_conf(cf,ngx_http_core_module);
	ngx_conf_set_str_slot(cf,cmd,conf);
	return NGX_CONF_OK;
}