static char *  ngx_http_push_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) {
  ngx_http_push_loc_conf_t       *prev = parent, *conf = child;
  ngx_conf_merge_sec_value(conf->buffer_timeout, prev->buffer_timeout, NGX_HTTP_PUSH_DEFAULT_BUFFER_TIMEOUT);
  ngx_conf_merge_value(conf->max_messages, prev->max_messages, NGX_HTTP_PUSH_DEFAULT_MAX_MESSAGES);
  ngx_conf_merge_value(conf->min_messages, prev->min_messages, NGX_HTTP_PUSH_DEFAULT_MIN_MESSAGES);
  ngx_conf_merge_value(conf->subscriber_concurrency, prev->subscriber_concurrency, NGX_HTTP_PUSH_SUBSCRIBER_CONCURRENCY_BROADCAST);
  ngx_conf_merge_value(conf->subscriber_poll_mechanism, prev->subscriber_poll_mechanism, NGX_HTTP_PUSH_MECHANISM_LONGPOLL);
  ngx_conf_merge_sec_value(conf->subscriber_timeout, prev->subscriber_timeout, NGX_HTTP_PUSH_DEFAULT_SUBSCRIBER_TIMEOUT);
  ngx_conf_merge_value(conf->authorize_channel, prev->authorize_channel, 0);
  ngx_conf_merge_value(conf->store_messages, prev->store_messages, 1);
  ngx_conf_merge_value(conf->delete_oldest_received_message, prev->delete_oldest_received_message, 0);
  ngx_conf_merge_value(conf->max_channel_id_length, prev->max_channel_id_length, NGX_HTTP_PUSH_MAX_CHANNEL_ID_LENGTH);
  ngx_conf_merge_value(conf->max_channel_subscribers, prev->max_channel_subscribers, 0);
  ngx_conf_merge_value(conf->ignore_queue_on_no_cache, prev->ignore_queue_on_no_cache, 0);
  ngx_conf_merge_value(conf->channel_timeout, prev->channel_timeout, NGX_HTTP_PUSH_DEFAULT_CHANNEL_TIMEOUT);
  ngx_conf_merge_str_value(conf->channel_group, prev->channel_group, "");
  
  //sanity checks
  if(conf->max_messages < conf->min_messages) {
    //min/max buffer size makes sense?
    ngx_conf_log_error(NGX_LOG_ERR, cf, 0, "push_max_message_buffer_length cannot be smaller than push_min_message_buffer_length.");
    return NGX_CONF_ERROR;
  }
  
  return NGX_CONF_OK;
}
示例#2
0
static char *  nchan_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child) {
  nchan_loc_conf_t       *prev = parent, *conf = child;
  
  //publisher types
  ngx_conf_merge_bitmask_value(conf->pub.http, prev->pub.http, 0);
  ngx_conf_merge_bitmask_value(conf->pub.websocket, prev->pub.websocket, 0);
  
  //subscriber types
  ngx_conf_merge_bitmask_value(conf->sub.poll, prev->sub.poll, 0);
  ngx_conf_merge_bitmask_value(conf->sub.longpoll, prev->sub.longpoll, 0);
  ngx_conf_merge_bitmask_value(conf->sub.eventsource, prev->sub.eventsource, 0);
  ngx_conf_merge_bitmask_value(conf->sub.websocket, prev->sub.websocket, 0);
  
  ngx_conf_merge_sec_value(conf->buffer_timeout, prev->buffer_timeout, NCHAN_DEFAULT_BUFFER_TIMEOUT);
  ngx_conf_merge_value(conf->max_messages, prev->max_messages, NCHAN_DEFAULT_MAX_MESSAGES);
  ngx_conf_merge_value(conf->min_messages, prev->min_messages, NCHAN_DEFAULT_MIN_MESSAGES);
  ngx_conf_merge_value(conf->subscriber_concurrency, prev->subscriber_concurrency, NCHAN_SUBSCRIBER_CONCURRENCY_BROADCAST);
  
  ngx_conf_merge_sec_value(conf->subscriber_timeout, prev->subscriber_timeout, NCHAN_DEFAULT_SUBSCRIBER_TIMEOUT);
  ngx_conf_merge_value(conf->authorize_channel, prev->authorize_channel, 0);
  ngx_conf_merge_value(conf->use_redis, prev->use_redis, 0);
  ngx_conf_merge_value(conf->delete_oldest_received_message, prev->delete_oldest_received_message, 0);
  ngx_conf_merge_value(conf->max_channel_id_length, prev->max_channel_id_length, NCHAN_MAX_CHANNEL_ID_LENGTH);
  ngx_conf_merge_value(conf->max_channel_subscribers, prev->max_channel_subscribers, 0);
  ngx_conf_merge_value(conf->ignore_queue_on_no_cache, prev->ignore_queue_on_no_cache, 0);
  ngx_conf_merge_value(conf->channel_timeout, prev->channel_timeout, NCHAN_DEFAULT_CHANNEL_TIMEOUT);
  ngx_conf_merge_str_value(conf->channel_group, prev->channel_group, "");
  
  if(conf->storage_engine == NULL) {
    conf->storage_engine = prev->storage_engine ? prev->storage_engine : default_storage_engine;
  }
  
  //sanity checks
  if(conf->max_messages < conf->min_messages) {
    //min/max buffer size makes sense?
    ngx_conf_log_error(NGX_LOG_ERR, cf, 0, "push_max_message_buffer_length cannot be smaller than push_min_message_buffer_length.");
    return NGX_CONF_ERROR;
  }
  
  if(conf->pub_chid.n == 0) {
    ngx_memcpy(&conf->pub_chid, &prev->pub_chid, sizeof(prev->pub_chid));
  }
  if(conf->sub_chid.n == 0) {
    ngx_memcpy(&conf->sub_chid, &prev->sub_chid, sizeof(prev->sub_chid));
  }
  if(conf->pubsub_chid.n == 0) {
    ngx_memcpy(&conf->pubsub_chid, &prev->pubsub_chid, sizeof(prev->pubsub_chid));
  }
  
  
  return NGX_CONF_OK;
}
static char *
ngx_http_session_store_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_http_session_store_loc_conf_t *prev = parent;
    ngx_http_session_store_loc_conf_t *conf = child;

    ngx_conf_merge_sec_value(conf->expire, prev->expire, 60);

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

    ngx_conf_merge_sec_value(conf->timeout, prev->timeout, 60);
    ngx_conf_merge_sec_value(conf->expires, prev->expires, 10);
    ngx_conf_merge_value(conf->replays, prev->replays, 20);
    ngx_conf_merge_str_value(conf->realm, prev->realm, "")
    if (conf->user_file.value.len == 0) {
      conf->user_file = prev->user_file;
    }
  
    if (conf->realm.len>0 && conf->user_file.value.len == 0){
      ngx_log_error(NGX_LOG_ERR, cf->log, 0,"auth_digest enabled but auth_digest_user_file not specified");
      return NGX_CONF_ERROR;
    }

    return NGX_CONF_OK;
}
static char *
ngx_rtmp_log_merge_app_conf(ngx_conf_t *cf, void *parent, void *child)
{
    ngx_rtmp_log_app_conf_t    *prev = parent;
    ngx_rtmp_log_app_conf_t    *conf = child;
    ngx_rtmp_log_main_conf_t   *lmcf;
    ngx_rtmp_log_fmt_t         *fmt;
    ngx_rtmp_log_t             *log;

    ngx_conf_merge_sec_value(conf->interval, prev->interval, 0);

    if (conf->logs || conf->off) {
        return NGX_OK;
    }

    conf->logs = prev->logs;
    conf->off = prev->off;

    if (conf->logs || conf->off) {
        return NGX_OK;
    }

    conf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_rtmp_log_t));
    if (conf->logs == NULL) {
        return NGX_CONF_ERROR;
    }

    log = ngx_array_push(conf->logs);
    if (log == NULL) {
        return NGX_CONF_ERROR;
    }

    log->file = ngx_conf_open_file(cf->cycle, &ngx_rtmp_access_log);
    if (log->file == NULL) {
        return NGX_CONF_ERROR;
    }

    log->disk_full_time = 0;
    log->error_log_time = 0;

    lmcf = ngx_rtmp_conf_get_module_main_conf(cf, ngx_rtmp_log_module);
    fmt = lmcf->formats.elts;

    log->format = &fmt[0];
    lmcf->combined_used = 1;

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

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

    if (prev->limit_check) {
        conf->limit_check = 1;
    }

    ngx_conf_merge_uint_value(conf->limit_log_level, prev->limit_log_level,
                              NGX_LOG_ERR);
    ngx_conf_merge_sec_value(conf->default_expire, prev->default_expire, 
            60 * 60 * 24);

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

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

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

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

    ngx_conf_merge_sec_value(conf->expires, prev->expires, 24 * 60 * 60);

    return NGX_CONF_OK;
}