~ubuntu-branches/debian/squeeze/nginx/squeeze

« back to all changes in this revision

Viewing changes to src/http/modules/ngx_http_limit_zone_module.c

  • Committer: Bazaar Package Importer
  • Author(s): Fabio Tranchitella
  • Date: 2009-11-08 09:53:46 UTC
  • mfrom: (1.1.13 upstream)
  • Revision ID: james.westby@ubuntu.com-20091108095346-yt4eypw2l176tl53
Tags: 0.7.63-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
typedef struct {
34
34
    ngx_shm_zone_t     *shm_zone;
35
35
    ngx_uint_t          conn;
 
36
    ngx_uint_t          log_level;
36
37
} ngx_http_limit_zone_conf_t;
37
38
 
38
39
 
48
49
static ngx_int_t ngx_http_limit_zone_init(ngx_conf_t *cf);
49
50
 
50
51
 
 
52
static ngx_conf_enum_t  ngx_http_limit_conn_log_levels[] = {
 
53
    { ngx_string("info"), NGX_LOG_INFO },
 
54
    { ngx_string("notice"), NGX_LOG_NOTICE },
 
55
    { ngx_string("warn"), NGX_LOG_WARN },
 
56
    { ngx_string("error"), NGX_LOG_ERR },
 
57
    { ngx_null_string, 0 }
 
58
};
 
59
 
 
60
 
51
61
static ngx_command_t  ngx_http_limit_zone_commands[] = {
52
62
 
53
63
    { ngx_string("limit_zone"),
64
74
      0,
65
75
      NULL },
66
76
 
 
77
    { ngx_string("limit_conn_log_level"),
 
78
      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
 
79
      ngx_conf_set_enum_slot,
 
80
      NGX_HTTP_LOC_CONF_OFFSET,
 
81
      offsetof(ngx_http_limit_zone_conf_t, log_level),
 
82
      &ngx_http_limit_conn_log_levels },
 
83
 
67
84
      ngx_null_command
68
85
};
69
86
 
189
206
 
190
207
                ngx_shmtx_unlock(&shpool->mutex);
191
208
 
192
 
                ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
 
209
                ngx_log_error(lzcf->log_level, r->connection->log, 0,
193
210
                              "limiting connections by zone \"%V\"",
194
211
                              &lzcf->shm_zone->shm.name);
195
212
 
381
398
 
382
399
    conf = ngx_pcalloc(cf->pool, sizeof(ngx_http_limit_zone_conf_t));
383
400
    if (conf == NULL) {
384
 
        return NGX_CONF_ERROR;
 
401
        return NULL;
385
402
    }
386
403
 
387
404
    /*
391
408
     *     conf->conn = 0;
392
409
     */
393
410
 
 
411
    conf->log_level = NGX_CONF_UNSET_UINT;
 
412
 
394
413
    return conf;
395
414
}
396
415
 
405
424
        *conf = *prev;
406
425
    }
407
426
 
 
427
    ngx_conf_merge_uint_value(conf->log_level, prev->log_level, NGX_LOG_ERR);
 
428
 
408
429
    return NGX_CONF_OK;
409
430
}
410
431