Пример #1
0
static char *
ngx_http_vod_mss_merge_loc_conf(
	ngx_conf_t *cf,
	ngx_http_vod_loc_conf_t *base,
	ngx_http_vod_mss_loc_conf_t *conf,
	ngx_http_vod_mss_loc_conf_t *prev)
{
	ngx_conf_merge_str_value(conf->manifest_file_name_prefix, prev->manifest_file_name_prefix, "manifest");
	ngx_conf_merge_uint_value(conf->manifest_conf.duplicate_bitrate_threshold, prev->manifest_conf.duplicate_bitrate_threshold, 4096);
	return NGX_CONF_OK;
}
static char *
ngx_http_brotli_static_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_brotli_static_conf_t *prev = parent;
    ngx_http_brotli_static_conf_t *conf = child;

    ngx_conf_merge_uint_value(conf->enable, prev->enable,
                              NGX_HTTP_BROTLI_STATIC_OFF);

    return NGX_CONF_OK;
}
static char *
ngx_http_memcached_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_memcached_loc_conf_t *prev = parent;
    ngx_http_memcached_loc_conf_t *conf = child;

    ngx_conf_merge_ptr_value(conf->upstream.local, prev->upstream.local, NULL);

    ngx_conf_merge_uint_value(conf->upstream.next_upstream_tries, prev->upstream.next_upstream_tries, 0);

    ngx_conf_merge_msec_value(conf->upstream.connect_timeout, prev->upstream.connect_timeout, 60000);

    ngx_conf_merge_msec_value(conf->upstream.send_timeout, prev->upstream.send_timeout, 60000);

    ngx_conf_merge_msec_value(conf->upstream.read_timeout, prev->upstream.read_timeout, 60000);

    ngx_conf_merge_msec_value(conf->upstream.next_upstream_timeout, prev->upstream.next_upstream_timeout, 0);

    ngx_conf_merge_size_value(conf->upstream.buffer_size, prev->upstream.buffer_size, (size_t) ngx_pagesize);

    ngx_conf_merge_bitmask_value(conf->upstream.next_upstream, prev->upstream.next_upstream,
                              (NGX_CONF_BITMASK_SET |NGX_HTTP_UPSTREAM_FT_ERROR |NGX_HTTP_UPSTREAM_FT_TIMEOUT));

    if (conf->upstream.next_upstream & NGX_HTTP_UPSTREAM_FT_OFF) 
	{
        conf->upstream.next_upstream = NGX_CONF_BITMASK_SET |NGX_HTTP_UPSTREAM_FT_OFF;
    }

    if (conf->upstream.upstream == NULL) 
	{
        conf->upstream.upstream = prev->upstream.upstream;
    }

    if (conf->index == NGX_CONF_UNSET) {
        conf->index = prev->index;
    }

    ngx_conf_merge_uint_value(conf->gzip_flag, prev->gzip_flag, 0);

    return NGX_CONF_OK;
}
static char *
ngx_http_auth_mysql_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
	ngx_http_auth_mysql_loc_conf_t *prev = parent;
	ngx_http_auth_mysql_loc_conf_t *conf = child;
	ngx_uint_t enctype_index, enctypes_count;
	
	if (conf->realm.data == NULL) {
        conf->realm = prev->realm;
    }

	/* No point of merging the others if realm is missing*/
	if (conf->realm.data == NULL) {
		return NGX_CONF_OK;
	}	

	ngx_conf_merge_str_value( conf->host, prev->host, "127.0.0.1");
	ngx_conf_merge_str_value( conf->database, prev->database, "");
	ngx_conf_merge_str_value( conf->user, prev->user, "root");
	ngx_conf_merge_str_value( conf->password, prev->password, "");
	ngx_conf_merge_uint_value( conf->port, prev->port, 3306);
	ngx_conf_merge_str_value( conf->table, prev->table, "users");
	ngx_conf_merge_str_value( conf->user_column, prev->user_column, "username");
	ngx_conf_merge_str_value( conf->password_column, prev->password_column, "password");
	ngx_conf_merge_str_value( conf->encryption_type_str, prev->encryption_type_str, "md5");
	ngx_conf_merge_str_value( conf->allowed_users, prev->allowed_users, "");
	ngx_conf_merge_str_value( conf->allowed_groups, prev->allowed_groups, "");
	ngx_conf_merge_str_value( conf->group_column, prev->group_column, "name");
	ngx_conf_merge_str_value( conf->group_table, prev->group_table, "");
	ngx_conf_merge_str_value( conf->group_conditions, prev->group_conditions, "");
	ngx_conf_merge_str_value( conf->conditions, prev->conditions, "");
	
	if (ngx_strcmp(conf->database.data, "") == 0) {
		ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 
	            "You have to specify a database to use to in auth_mysql_database.");
	    return NGX_CONF_ERROR;
	}
	
	enctypes_count = sizeof(ngx_http_auth_mysql_enctypes) / sizeof(ngx_http_auth_mysql_enctypes[0]);
	for (enctype_index = 0;  enctype_index < enctypes_count; ++enctype_index) {
		if (ngx_strcmp(conf->encryption_type_str.data, ngx_http_auth_mysql_enctypes[enctype_index].id.data) == 0) {
			conf->encryption_type = enctype_index;
			break;
		}		
	}
	
	if (enctype_index >= enctypes_count) {
		ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 
	            "Unknown encryption type for auth_mysql: %s", conf->encryption_type_str.data);
	    return NGX_CONF_ERROR;							
	}	
    return NGX_CONF_OK;
}
Пример #5
0
static char *
ngx_proc_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_proc_conf_t  *prev = parent;
    ngx_proc_conf_t  *conf = child;

    ngx_conf_merge_msec_value(conf->delay_start, prev->delay_start, 300);
    ngx_conf_merge_uint_value(conf->count, prev->count, 1);
    ngx_conf_merge_value(conf->respawn, prev->respawn, 1);

    return NGX_CONF_OK;
}
static char *
ngx_http_limit_req_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_limit_req_conf_t *prev = parent;
    ngx_http_limit_req_conf_t *conf = child;

    if (conf->limits.elts == NULL) {
        conf->limits = prev->limits;
    }

    ngx_conf_merge_uint_value(conf->limit_log_level, prev->limit_log_level,
                              NGX_LOG_ERR);

    conf->delay_log_level = (conf->limit_log_level == NGX_LOG_INFO) ?
                                NGX_LOG_INFO : conf->limit_log_level + 1;

    ngx_conf_merge_uint_value(conf->status_code, prev->status_code,
                              NGX_HTTP_SERVICE_UNAVAILABLE);

    return NGX_CONF_OK;
}
static char *
ngx_mail_throttle_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_mail_throttle_srv_conf_t *prev = parent;
    ngx_mail_throttle_srv_conf_t *conf = child;

    ngx_conf_merge_uint_value (conf->mail_login_ip_max,
                               prev->mail_login_ip_max, 1000);
    ngx_conf_merge_uint_value (conf->mail_login_user_max,
                               prev->mail_login_user_max, 100);
    ngx_conf_merge_msec_value (conf->mail_login_ip_ttl,
                               prev->mail_login_ip_ttl, 60000);
    ngx_conf_merge_msec_value (conf->mail_login_user_ttl,
                               prev->mail_login_user_ttl, 60000);
    ngx_conf_merge_str_value (conf->mail_login_ip_rejectmsg,
                              prev->mail_login_ip_rejectmsg, "");
    ngx_conf_merge_str_value (conf->mail_login_user_rejectmsg,
                              prev->mail_login_user_rejectmsg, "");

    return NGX_CONF_OK;
}
static char *
ngx_http_parallel_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
	ngx_http_parallel_loc_conf_t *prev = parent;
	ngx_http_parallel_loc_conf_t *conf = child;

	ngx_conf_merge_str_value(conf->uri_prefix, prev->uri_prefix, "");
	ngx_conf_merge_uint_value(conf->fiber_count, prev->fiber_count, 8);
	ngx_conf_merge_size_value(conf->min_chunk_size, prev->min_chunk_size, 128 * 1024);
	ngx_conf_merge_size_value(conf->max_chunk_size, prev->max_chunk_size, 512 * 1024);
	ngx_conf_merge_size_value(conf->max_headers_size, prev->max_headers_size, 4 * 1024);
	ngx_conf_merge_uint_value(conf->max_buffer_count, prev->max_buffer_count, 16);
	ngx_conf_merge_value(conf->consistency_check_etag, prev->consistency_check_etag, 1);
	ngx_conf_merge_value(conf->consistency_check_last_modified, prev->consistency_check_last_modified, 1);

	if (conf->content_length_cache_zone == NULL)
	{
		conf->content_length_cache_zone = prev->content_length_cache_zone;
	}

	if (conf->min_chunk_size > conf->max_chunk_size)
	{
		ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
			"\"parallel_min_chunk_size\" %uz cannot be greater than "
			"\"parallel_max_chunk_size\" %uz",
			conf->min_chunk_size, conf->max_chunk_size);
		return NGX_CONF_ERROR;
	}

	if (conf->max_buffer_count < conf->fiber_count)
	{
		ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
			"\"parallel_max_buffer_count\" %ui cannot be less than "
			"\"parallel_fiber_count\" %ui",
			conf->max_buffer_count, conf->fiber_count);
		return NGX_CONF_ERROR;
	}

	return NGX_CONF_OK;
}
Пример #9
0
static char *
ngx_stream_limit_conn_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_stream_limit_conn_conf_t *prev = parent;
    ngx_stream_limit_conn_conf_t *conf = child;

    if (conf->limits.elts == NULL) {
        conf->limits = prev->limits;
    }

    ngx_conf_merge_uint_value(conf->log_level, prev->log_level, NGX_LOG_ERR);

    return NGX_CONF_OK;
}
static char *
ngx_http_limit_zone_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_limit_zone_conf_t *prev = parent;
    ngx_http_limit_zone_conf_t *conf = child;

    if (conf->shm_zone == NULL) {
        *conf = *prev;
    }

    ngx_conf_merge_uint_value(conf->log_level, prev->log_level, NGX_LOG_ERR);

    return NGX_CONF_OK;
}
Пример #11
0
static char *
ngx_http_spdy_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_spdy_srv_conf_t *prev = parent;
    ngx_http_spdy_srv_conf_t *conf = child;

    ngx_conf_merge_size_value(conf->pool_size, prev->pool_size, 4096);

    ngx_conf_merge_uint_value(conf->concurrent_streams,
                              prev->concurrent_streams, 100);

    ngx_conf_merge_uint_value(conf->streams_index_mask,
                              prev->streams_index_mask, 32 - 1);

    ngx_conf_merge_msec_value(conf->recv_timeout,
                              prev->recv_timeout, 30000);
    ngx_conf_merge_msec_value(conf->keepalive_timeout,
                              prev->keepalive_timeout, 180000);

    ngx_conf_merge_value(conf->headers_comp, prev->headers_comp, 0);

    return NGX_CONF_OK;
}
static char *
ngx_http_autoindex_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_autoindex_loc_conf_t *prev = parent;
    ngx_http_autoindex_loc_conf_t *conf = child;

    ngx_conf_merge_value(conf->enable, prev->enable, 0);
    ngx_conf_merge_uint_value(conf->format, prev->format,
                              NGX_HTTP_AUTOINDEX_HTML);
    ngx_conf_merge_value(conf->localtime, prev->localtime, 0);
    ngx_conf_merge_value(conf->exact_size, prev->exact_size, 1);

    return NGX_CONF_OK;
}
static char *ngx_http_small_light_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_small_light_conf_t *prev = parent;
    ngx_http_small_light_conf_t *conf = child;

    ngx_conf_merge_value(conf->enable,               prev->enable,               0);
    ngx_conf_merge_value(conf->enable_getparam_mode, prev->enable_getparam_mode, 0);

    if (ngx_conf_merge_path_value(cf, &conf->imlib2_temp_dir,
                                  prev->imlib2_temp_dir,
                                  &ngx_http_small_light_imlib2_temp_dir)
        != NGX_OK)
    {
        return NGX_CONF_ERROR;
    }

    ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size, 1 * 1024 * 1024);

    ngx_conf_merge_uint_value(conf->radius_max, prev->radius_max, 10);
    ngx_conf_merge_uint_value(conf->sigma_max, prev->sigma_max, 10);

    return NGX_CONF_OK;
}
static char *
ngx_http_chunkin_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_chunkin_conf_t *prev = parent;
    ngx_http_chunkin_conf_t *conf = child;

    ngx_conf_merge_value(conf->enabled, prev->enabled, 0);
    ngx_conf_merge_value(conf->keepalive, prev->keepalive, 0);
    ngx_conf_merge_uint_value(conf->max_chunks_per_buf,
            prev->max_chunks_per_buf,
            DEFAULT_MAX_CHUNKS_PER_BUF);

    return NGX_CONF_OK;
}
static char * ngx_http_static_etags_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) {
    ngx_http_static_etags_loc_conf_t *prev = parent;
    ngx_http_static_etags_loc_conf_t *conf = child;

    ngx_conf_merge_uint_value( conf->FileETag, prev->FileETag, 0 );

    if ( conf->FileETag != 0 && conf->FileETag != 1 ) {
        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, 
            "FileETag must be 'on' or 'off'");
        return NGX_CONF_ERROR;
    }

    return NGX_CONF_OK;
}
static char *
ngx_http_limit_speed_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_limit_speed_conf_t *prev = parent;
    ngx_http_limit_speed_conf_t *conf = child;

    if (conf->shm_zone == NULL) {
        *conf = *prev;
    }

    ngx_conf_merge_uint_value(conf->var_max_len, prev->var_max_len, 0);

    return NGX_CONF_OK;
}
static char *
ngx_http_auth_radius_merge_loc_conf( ngx_conf_t *cf, void *parent, void *child ) {

    ngx_http_auth_radius_main_conf_t *prev = parent;
    ngx_http_auth_radius_main_conf_t *conf = child;

    ngx_conf_merge_str_value( conf->realm, prev->realm, "" );
    ngx_conf_merge_str_value( conf->radius_cache, prev->radius_cache, "" );

    ngx_conf_merge_msec_value( conf->radius_timeout, prev->radius_timeout, 60000 );
    ngx_conf_merge_uint_value( conf->radius_attempts, prev->radius_attempts, 3 );

    return NGX_CONF_OK;

}
Пример #18
0
static char *
ngx_http_limit_conn_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    syslog(LOG_INFO, "[%s:%s:%d]", __FILE__, __func__, __LINE__);
    ngx_http_limit_conn_conf_t *prev = parent;
    ngx_http_limit_conn_conf_t *conf = child;

    if (conf->limits.elts == NULL) {
        conf->limits = prev->limits;
    }

    ngx_conf_merge_uint_value(conf->log_level, prev->log_level, NGX_LOG_ERR);

    return NGX_CONF_OK;
}
static char *
ngx_http_prelog_merge_loc_conf(ngx_conf_t* cf, void* parent, void* child){
    ngx_http_prelog_loc_conf_t* prev = parent;
    ngx_http_prelog_loc_conf_t* conf = child;

    ngx_conf_merge_uint_value(conf->enable, prev->enable, 0);

    if (conf->file == NGX_CONF_UNSET_PTR){
        conf->file = prev->file;
        conf->format = prev->format;
    }
    conf->error_log_time = 0;

    return NGX_CONF_OK;
}
static char *
ngx_http_video_thumbextractor_init_main_conf(ngx_conf_t *cf, void *parent)
{

    ngx_http_video_thumbextractor_main_conf_t     *conf = parent;

    ngx_conf_merge_uint_value(conf->processes_per_worker, NGX_CONF_UNSET_UINT, 1);

    if (conf->processes_per_worker > NGX_MAX_PROCESSES) {
        ngx_conf_log_error(NGX_LOG_ERR, cf, 0, "video thumbextractor module: video_thumbextractor_processes_per_worker must be less than %d", NGX_MAX_PROCESSES);
        return NGX_CONF_ERROR;
    }

    return NGX_CONF_OK;
}
static char *
ngx_rtmp_notify_merge_srv_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_rtmp_notify_srv_conf_t *prev = parent;
    ngx_rtmp_notify_srv_conf_t *conf = child;
    ngx_uint_t                  n;

    for (n = 0; n < NGX_RTMP_NOTIFY_SRV_MAX; ++n) {
        ngx_conf_merge_ptr_value(conf->url[n], prev->url[n], NULL);
    }

    ngx_conf_merge_uint_value(conf->method, prev->method,
                              NGX_RTMP_NETCALL_HTTP_POST);

    return NGX_CONF_OK;
}
static char *
ngx_http_sysguard_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_sysguard_conf_t  *prev = parent;
    ngx_http_sysguard_conf_t  *conf = child;

    ngx_conf_merge_value(conf->enable, prev->enable, 0);
    ngx_conf_merge_str_value(conf->load_action, prev->load_action, "");
    ngx_conf_merge_str_value(conf->swap_action, prev->swap_action, "");
    ngx_conf_merge_value(conf->load, prev->load, -1);
    ngx_conf_merge_value(conf->swap, prev->swap, -1);
    ngx_conf_merge_value(conf->interval, prev->interval, 1);
    ngx_conf_merge_uint_value(conf->log_level, prev->log_level, NGX_LOG_ERR);

    return NGX_CONF_OK;
}
static char *
ngx_http_video_thumbextractor_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_video_thumbextractor_loc_conf_t *prev = parent;
    ngx_http_video_thumbextractor_loc_conf_t *conf = child;

    ngx_conf_merge_value(conf->enabled, prev->enabled, 0);

    ngx_conf_merge_null_value(conf->video_filename, prev->video_filename, NULL);
    ngx_conf_merge_null_value(conf->video_second, prev->video_second, NULL);
    ngx_conf_merge_null_value(conf->image_width, prev->image_width, NULL);
    ngx_conf_merge_null_value(conf->image_height, prev->image_height, NULL);
    ngx_conf_merge_null_value(conf->tile_sample_interval, prev->tile_sample_interval, NULL);
    ngx_conf_merge_null_value(conf->tile_cols, prev->tile_cols, NULL);
    ngx_conf_merge_null_value(conf->tile_max_cols, prev->tile_max_cols, NULL);
    ngx_conf_merge_null_value(conf->tile_rows, prev->tile_rows, NULL);
    ngx_conf_merge_null_value(conf->tile_max_rows, prev->tile_max_rows, NULL);
    ngx_conf_merge_null_value(conf->tile_margin, prev->tile_margin, NULL);
    ngx_conf_merge_null_value(conf->tile_padding, prev->tile_padding, NULL);
    ngx_conf_merge_str_value(conf->tile_color, prev->tile_color, "black");

    ngx_conf_merge_uint_value(conf->jpeg_baseline, prev->jpeg_baseline, 1);
    ngx_conf_merge_uint_value(conf->jpeg_progressive_mode, prev->jpeg_progressive_mode, 0);
    ngx_conf_merge_uint_value(conf->jpeg_optimize, prev->jpeg_optimize, 100);
    ngx_conf_merge_uint_value(conf->jpeg_smooth, prev->jpeg_smooth, 0);
    ngx_conf_merge_uint_value(conf->jpeg_quality, prev->jpeg_quality, 75);
    ngx_conf_merge_uint_value(conf->jpeg_dpi, prev->jpeg_dpi, 72); /** Screen resolution = 72 dpi */

    ngx_conf_merge_value(conf->only_keyframe, prev->only_keyframe, 1);
    ngx_conf_merge_value(conf->next_time, prev->next_time, 1);

    ngx_conf_merge_str_value(conf->threads, prev->threads, "auto");

    // if video thumb extractor is disable the other configurations don't have to be checked
    if (!conf->enabled) {
        return NGX_CONF_OK;
    }

    conf->next_time = conf->only_keyframe ? conf->next_time : 0;

    // sanity checks

    if (conf->video_filename == NULL) {
        ngx_conf_log_error(NGX_LOG_ERR, cf, 0, "video thumbextractor module: video_thumbextractor_video_filename must be defined");
        return NGX_CONF_ERROR;
    }

    if (conf->video_second == NULL) {
        ngx_conf_log_error(NGX_LOG_ERR, cf, 0, "video thumbextractor module: video_thumbextractor_video_second must be defined");
        return NGX_CONF_ERROR;
    }

    return NGX_CONF_OK;
}
static char *
ngx_http_rds_json_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_rds_json_conf_t *prev = parent;
    ngx_http_rds_json_conf_t *conf = child;

    ngx_conf_merge_value(conf->enabled, prev->enabled, 0);

    ngx_conf_merge_uint_value(conf->format, prev->format, json_format_compact);

    ngx_conf_merge_str_value(conf->content_type, prev->content_type,
            ngx_http_rds_json_content_type);

    ngx_conf_merge_size_value(conf->buf_size, prev->buf_size, (size_t) ngx_pagesize);

    return NGX_CONF_OK;
}
Пример #25
0
static char *
ngx_http_vod_hls_merge_loc_conf(
	ngx_conf_t *cf,
	ngx_http_vod_loc_conf_t *base,
	ngx_http_vod_hls_loc_conf_t *conf,
	ngx_http_vod_hls_loc_conf_t *prev)
{
	ngx_conf_merge_value(conf->absolute_master_urls, prev->absolute_master_urls, 1);
	ngx_conf_merge_value(conf->absolute_index_urls, prev->absolute_index_urls, 1);
	ngx_conf_merge_value(conf->absolute_iframe_urls, prev->absolute_iframe_urls, 0);

	ngx_conf_merge_str_value(conf->master_file_name_prefix, prev->master_file_name_prefix, "master");
	ngx_conf_merge_str_value(conf->m3u8_config.index_file_name_prefix, prev->m3u8_config.index_file_name_prefix, "index");	
	ngx_conf_merge_str_value(conf->iframes_file_name_prefix, prev->iframes_file_name_prefix, "iframes");
	ngx_conf_merge_str_value(conf->m3u8_config.segment_file_name_prefix, prev->m3u8_config.segment_file_name_prefix, "seg");

	ngx_conf_merge_str_value(conf->m3u8_config.encryption_key_file_name, prev->m3u8_config.encryption_key_file_name, "encryption");
	ngx_conf_merge_str_value(conf->m3u8_config.encryption_key_format, prev->m3u8_config.encryption_key_format, "");
	ngx_conf_merge_str_value(conf->m3u8_config.encryption_key_format_versions, prev->m3u8_config.encryption_key_format_versions, "");
	if (conf->encryption_key_uri == NULL)
	{
		conf->encryption_key_uri = prev->encryption_key_uri;
	}

	ngx_conf_merge_value(conf->muxer_config.interleave_frames, prev->muxer_config.interleave_frames, 0);
	ngx_conf_merge_value(conf->muxer_config.align_frames, prev->muxer_config.align_frames, 1);
	ngx_conf_merge_value(conf->muxer_config.output_id3_timestamps, prev->muxer_config.output_id3_timestamps, 0);
	
	ngx_conf_merge_uint_value(conf->encryption_method, prev->encryption_method, HLS_ENC_NONE);

	m3u8_builder_init_config(
		&conf->m3u8_config,
		base->segmenter.max_segment_duration, 
		conf->encryption_method);

	if (conf->encryption_method != HLS_ENC_NONE &&
		base->secret_key == NULL &&
		!base->drm_enabled)
	{
		ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
			"\"vod_secret_key\" must be set when \"vod_hls_encryption_method\" is not none");
		return NGX_CONF_ERROR;
	}

	return NGX_CONF_OK;
}
static char *
ngx_http_url_encoding_convert_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{   
    ngx_http_url_encoding_convert_loc_conf_t *prev = parent;
    ngx_http_url_encoding_convert_loc_conf_t *conf = child;

    ngx_conf_merge_size_value(conf->alloc_size_x, prev->alloc_size_x, 4);
    ngx_conf_merge_size_value(conf->alloc_size, prev->alloc_size, 0);
    ngx_conf_merge_uint_value(conf->phase, prev->phase, NGX_HTTP_PREACCESS_PHASE);
    ngx_conf_merge_value(conf->enable, prev->enable, 0);
    ngx_conf_merge_str_value(conf->from_encode, prev->from_encode,
        NGX_URL_ENCODING_CONVERT_DEFAULT_FROM_ENCODE);
    ngx_conf_merge_str_value(conf->to_encode, prev->to_encode,
        NGX_URL_ENCODING_CONVERT_DEFAULT_TO_ENCODE);

    return NGX_CONF_OK;
}
Пример #27
0
static char *
ngx_http_limit_req_merge_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_limit_req_conf_t *prev = parent;
    ngx_http_limit_req_conf_t *conf = child;

    if (conf->shm_zone == NULL) {
        *conf = *prev;
    }

    ngx_conf_merge_uint_value(conf->limit_log_level, prev->limit_log_level,
                              NGX_LOG_ERR);

    conf->delay_log_level = (conf->limit_log_level == NGX_LOG_INFO) ?
                                NGX_LOG_INFO : conf->limit_log_level + 1;

    return NGX_CONF_OK;
}
static char *ngx_http_hls_merge_conf(ngx_conf_t *cf, void *parent, void *child) {
    hls_conf_t *prev = parent;
    hls_conf_t *conf = child;

    ngx_conf_merge_uint_value(conf->length, prev->length, 8);
    ngx_conf_merge_value(conf->relative, prev->relative, 1);
    ngx_conf_merge_size_value(conf->buffer_size, prev->buffer_size, 512 * 1024);
    ngx_conf_merge_size_value(conf->max_buffer_size, prev->max_buffer_size,
                              10 * 1024 * 1024);

    if(conf->length < 1) {
        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
            "ngx_length must be equal or more than 1");
        return NGX_CONF_ERROR;
    }

    return NGX_CONF_OK;
}
static char *
ngx_http_realip_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_realip_loc_conf_t  *prev = parent;
    ngx_http_realip_loc_conf_t  *conf = child;
    if (conf->from == NULL)
    {
        conf->from = prev->from;
    }
    ngx_conf_merge_uint_value(conf->type, prev->type, NGX_HTTP_REALIP_XREALIP);
    ngx_conf_merge_value(conf->recursive, prev->recursive, 0);
    if (conf->header.len == 0)
    {
        conf->hash = prev->hash;
        conf->header = prev->header;
    }
    return NGX_CONF_OK;
}
static char *
ngx_http_zm_sso_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_zm_sso_loc_conf_t *prev = parent;
    ngx_http_zm_sso_loc_conf_t *conf = child;
    ngx_str_t         host_key;
    ngx_str_t         ssl_client_verify_key;
    ngx_str_t         ssl_client_s_dn_key;

    ngx_conf_merge_uint_value(conf->type, prev->type, NGX_ZM_SSO_CERTAUTH);

    ngx_conf_merge_str_value(conf->redirect_url->url,
                              prev->redirect_url->url, "443");

    ngx_conf_merge_str_value(conf->redirect_schema,
                              prev->redirect_schema, "https");

    conf->redirect_url->no_resolve = 1;
    conf->redirect_url->one_addr = 1;
    conf->redirect_url->listen = 1; /* with this option, the ngx_parse_url accepts
                                       only port case */
    if (ngx_parse_url(cf->pool, conf->redirect_url) != NGX_OK) {
        return NGX_CONF_ERROR;
    }

    if (conf->host_index == NGX_CONF_UNSET) {
        ngx_str_set(&host_key, "host");
        conf->host_index = ngx_http_get_variable_index(cf, &host_key);
    }

    if (conf->ssl_client_verify_index == NGX_CONF_UNSET) {
        ngx_str_set(&ssl_client_verify_key, "ssl_client_verify");
        conf->ssl_client_verify_index = ngx_http_get_variable_index(cf,
                &ssl_client_verify_key);
    }

    if (conf->ssl_client_s_dn_index == NGX_CONF_UNSET) {
        ngx_str_set(&ssl_client_s_dn_key, "ssl_client_s_dn");
        conf->ssl_client_s_dn_index = ngx_http_get_variable_index(cf,
                &ssl_client_s_dn_key);
    }

    return NGX_CONF_OK;
}