]> git.kaiwu.me - nginx.git/commitdiff
satisfy all|any
authorIgor Sysoev <igor@sysoev.ru>
Sat, 29 Dec 2007 16:38:23 +0000 (16:38 +0000)
committerIgor Sysoev <igor@sysoev.ru>
Sat, 29 Dec 2007 16:38:23 +0000 (16:38 +0000)
src/http/modules/ngx_http_access_module.c
src/http/ngx_http_core_module.c
src/http/ngx_http_core_module.h

index 44a2fbd89574775b0d415f6f8d2cf2b52708e3dc..264423beb24afabb2628a013f622e1c0708321e9 100644 (file)
@@ -116,7 +116,7 @@ ngx_http_access_handler(ngx_http_request_t *r)
             if (rule[i].deny) {
                 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-                if (!clcf->satisfy_any) {
+                if (clcf->satisfy == NGX_HTTP_SATISFY_ALL) {
                     ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
                                   "access forbidden by rule");
                 }
index 81d27d8246016dd39bc6827ab151fe64fe730373..4f43ead43699d985900f3ec23554fca9463ce99e 100644 (file)
@@ -93,6 +93,10 @@ static ngx_conf_deprecated_t  ngx_conf_deprecated_open_file_cache_retest = {
     ngx_conf_deprecated, "open_file_cache_retest", "open_file_cache_valid"
 };
 
+static ngx_conf_deprecated_t  ngx_conf_deprecated_satisfy_any = {
+    ngx_conf_deprecated, "satisfy_any", "satisfy"
+};
+
 
 static ngx_conf_enum_t  ngx_http_core_request_body_in_file[] = {
     { ngx_string("off"), NGX_HTTP_REQUEST_BODY_FILE_OFF },
@@ -102,6 +106,13 @@ static ngx_conf_enum_t  ngx_http_core_request_body_in_file[] = {
 };
 
 
+static ngx_conf_enum_t  ngx_http_core_satisfy[] = {
+    { ngx_string("all"), NGX_HTTP_SATISFY_ALL },
+    { ngx_string("any"), NGX_HTTP_SATISFY_ANY },
+    { ngx_null_string, 0 }
+};
+
+
 #if (NGX_HTTP_GZIP)
 
 static ngx_conf_enum_t  ngx_http_gzip_http_version[] = {
@@ -404,12 +415,19 @@ static ngx_command_t  ngx_http_core_commands[] = {
       0,
       NULL },
 
+    { ngx_string("satisfy"),
+      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_enum_slot,
+      NGX_HTTP_LOC_CONF_OFFSET,
+      offsetof(ngx_http_core_loc_conf_t, satisfy),
+      &ngx_http_core_satisfy },
+
     { ngx_string("satisfy_any"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
       ngx_conf_set_flag_slot,
       NGX_HTTP_LOC_CONF_OFFSET,
-      offsetof(ngx_http_core_loc_conf_t, satisfy_any),
-      NULL },
+      offsetof(ngx_http_core_loc_conf_t, satisfy),
+      &ngx_conf_deprecated_satisfy_any },
 
     { ngx_string("internal"),
       NGX_HTTP_LOC_CONF|NGX_CONF_NOARGS,
@@ -918,7 +936,7 @@ ngx_http_core_access_phase(ngx_http_request_t *r, ngx_http_phase_handler_t *ph)
 
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
-    if (clcf->satisfy_any == 0) {
+    if (clcf->satisfy == NGX_HTTP_SATISFY_ALL) {
 
         if (rc == NGX_OK) {
             r->phase_handler++;
@@ -2674,7 +2692,7 @@ ngx_http_core_create_loc_conf(ngx_conf_t *cf)
     lcf->client_max_body_size = NGX_CONF_UNSET;
     lcf->client_body_buffer_size = NGX_CONF_UNSET_SIZE;
     lcf->client_body_timeout = NGX_CONF_UNSET_MSEC;
-    lcf->satisfy_any = NGX_CONF_UNSET;
+    lcf->satisfy = NGX_CONF_UNSET;
     lcf->internal = NGX_CONF_UNSET;
     lcf->client_body_in_file_only = NGX_CONF_UNSET;
     lcf->sendfile = NGX_CONF_UNSET;
@@ -2859,7 +2877,8 @@ ngx_http_core_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
     ngx_conf_merge_msec_value(conf->client_body_timeout,
                               prev->client_body_timeout, 60000);
 
-    ngx_conf_merge_value(conf->satisfy_any, prev->satisfy_any, 0);
+    ngx_conf_merge_uint_value(conf->satisfy, prev->satisfy,
+                              NGX_HTTP_SATISFY_ALL);
     ngx_conf_merge_value(conf->internal, prev->internal, 0);
     ngx_conf_merge_value(conf->client_body_in_file_only,
                               prev->client_body_in_file_only, 0);
index 796ae48e8af0edf785ea06fc5b31b0351f5fd754..e11d829417330c137b6ac8c53ffd6c17940b27ba 100644 (file)
 #define NGX_HTTP_GZIP_PROXIED_ANY       0x0200
 
 
+#define NGX_HTTP_SATISFY_ALL            0
+#define NGX_HTTP_SATISFY_ANY            1
+
+
 typedef struct {
     unsigned                   default_server:1;
     unsigned                   bind:1;
@@ -286,7 +290,8 @@ struct ngx_http_core_loc_conf_s {
 
     time_t        keepalive_header;        /* keepalive_timeout */
 
-    ngx_flag_t    satisfy_any;             /* satisfy_any */
+    ngx_uint_t    satisfy;                 /* satisfy */
+
     ngx_flag_t    internal;                /* internal */
     ngx_flag_t    client_body_in_file_only; /* client_body_in_file_only */
     ngx_flag_t    sendfile;                /* sendfile */