nginx-0.3.53-RELEASE import

    *) Change: the "add_header" directive adds the string to 204, 301, and
       302 responses.

    *) Feature: the "server" directive in the "upstream" context supports
       the "weight" parameter.

    *) Feature: the "server_name" directive supports the "*" wildcard.

    *) Feature: nginx supports the request body size more than 2G.

    *) Bugfix: if a client was successfully authorized using "satisfy_any
       on", then anyway the message "access forbidden by rule" was written
       in the log.

    *) Bugfix: the "PUT" method may erroneously not create a file and
       return the 409 code.

    *) Bugfix: if the IMAP/POP3 backend returned an error, then nginx
       continued proxying anyway.
diff --git a/src/core/nginx.h b/src/core/nginx.h
index ad8c768..50746ae 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.3.52"
+#define NGINX_VER          "nginx/0.3.53"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_OLDPID_EXT     ".oldbin"
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 94dfe62..b5d8b16 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -1036,6 +1036,37 @@
 
 
 char *
+ngx_conf_set_off_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+{
+    char  *p = conf;
+
+    off_t            *op;
+    ngx_str_t        *value;
+    ngx_conf_post_t  *post;
+
+
+    op = (off_t *) (p + cmd->offset);
+    if (*op != NGX_CONF_UNSET) {
+        return "is duplicate";
+    }
+
+    value = cf->args->elts;
+
+    *op = ngx_parse_offset(&value[1]);
+    if (*op == (off_t) NGX_ERROR) {
+        return "invalid value";
+    }
+
+    if (cmd->post) {
+        post = cmd->post;
+        return post->post_handler(cf, post, op);
+    }
+
+    return NGX_CONF_OK;
+}
+
+
+char *
 ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 {
     char  *p = conf;
diff --git a/src/core/ngx_conf_file.h b/src/core/ngx_conf_file.h
index 17c24c7..7d51129 100644
--- a/src/core/ngx_conf_file.h
+++ b/src/core/ngx_conf_file.h
@@ -236,8 +236,8 @@
         conf = default;                                                      \
     }
 
-#define ngx_conf_init_unsigned_value(conf, default)                          \
-    if (conf == (unsigned) NGX_CONF_UNSET) {                                 \
+#define ngx_conf_init_uint_value(conf, default)                              \
+    if (conf == NGX_CONF_UNSET_UINT) {                                       \
         conf = default;                                                      \
     }
 
@@ -261,7 +261,7 @@
         conf = (prev == NULL) ? default : prev;                              \
     }
 
-#define ngx_conf_merge_unsigned_value(conf, prev, default)                   \
+#define ngx_conf_merge_uint_value(conf, prev, default)                       \
     if (conf == NGX_CONF_UNSET_UINT) {                                       \
         conf = (prev == NGX_CONF_UNSET_UINT) ? default : prev;               \
     }
@@ -281,6 +281,11 @@
         conf = (prev == NGX_CONF_UNSET_SIZE) ? default : prev;               \
     }
 
+#define ngx_conf_merge_off_value(conf, prev, default)                        \
+    if (conf == NGX_CONF_UNSET) {                                            \
+        conf = (prev == NGX_CONF_UNSET) ? default : prev;                    \
+    }
+
 #define ngx_conf_merge_str_value(conf, prev, default)                        \
     if (conf.data == NULL) {                                                 \
         if (prev.data) {                                                     \
@@ -328,6 +333,7 @@
 char *ngx_conf_set_keyval_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 char *ngx_conf_set_num_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 char *ngx_conf_set_size_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
+char *ngx_conf_set_off_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 char *ngx_conf_set_msec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 char *ngx_conf_set_sec_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
 char *ngx_conf_set_bufs_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
diff --git a/src/core/ngx_inet.c b/src/core/ngx_inet.c
index f2b0cf7..7b3fef3 100644
--- a/src/core/ngx_inet.c
+++ b/src/core/ngx_inet.c
@@ -479,7 +479,6 @@
         }
 
         peers->number = i;
-        peers->weight = 1;
 
         for (i = 0; h->h_addr_list[i] != NULL; i++) {
 
@@ -511,6 +510,10 @@
                                       - peers->peer[i].name.data;
 
             peers->peer[i].uri_separator = "";
+
+            peers->peer[i].weight = NGX_CONF_UNSET_UINT;
+            peers->peer[i].max_fails = NGX_CONF_UNSET_UINT;
+            peers->peer[i].fail_timeout = NGX_CONF_UNSET;
         }
 
     } else {
@@ -643,7 +646,6 @@
         }
 
         peers->number = i;
-        peers->weight = 1;
 
         for (i = 0; h->h_addr_list[i] != NULL; i++) {
 
@@ -677,6 +679,10 @@
             peers->peer[i].name.len = len + u->port_text.len;
 
             peers->peer[i].uri_separator = "";
+
+            peers->peer[i].weight = NGX_CONF_UNSET_UINT;
+            peers->peer[i].max_fails = NGX_CONF_UNSET_UINT;
+            peers->peer[i].fail_timeout = NGX_CONF_UNSET;
         }
 
     } else {
diff --git a/src/core/ngx_inet.h b/src/core/ngx_inet.h
index 7600ed8..3014023 100644
--- a/src/core/ngx_inet.h
+++ b/src/core/ngx_inet.h
@@ -29,6 +29,7 @@
     ngx_str_t           name;
     char               *uri_separator;
 
+    ngx_uint_t          current_weight;
     ngx_uint_t          weight;
 
     ngx_uint_t          fails;
@@ -45,7 +46,6 @@
 
 struct ngx_peers_s {
     ngx_uint_t          current;
-    ngx_uint_t          weight;
 
     ngx_uint_t          number;
     ngx_uint_t          last_cached;
diff --git a/src/core/ngx_parse.c b/src/core/ngx_parse.c
index 28e5d96..7868245 100644
--- a/src/core/ngx_parse.c
+++ b/src/core/ngx_parse.c
@@ -47,6 +47,51 @@
 }
 
 
+off_t
+ngx_parse_offset(ngx_str_t *line)
+{
+    u_char     last;
+    off_t      offset;
+    size_t     len;
+    ngx_int_t  scale;
+
+    len = line->len;
+    last = line->data[len - 1];
+
+    switch (last) {
+    case 'K':
+    case 'k':
+        len--;
+        scale = 1024;
+        break;
+
+    case 'M':
+    case 'm':
+        len--;
+        scale = 1024 * 1024;
+        break;
+
+    case 'G':
+    case 'g':
+        len--;
+        scale = 1024 * 1024 * 1024;
+        break;
+
+    default:
+        scale = 1;
+    }
+
+    offset = ngx_atoof(line->data, len);
+    if (offset == NGX_ERROR) {
+        return NGX_ERROR;
+    }
+
+    offset *= scale;
+
+    return offset;
+}
+
+
 ngx_int_t
 ngx_parse_time(ngx_str_t *line, ngx_int_t sec)
 {
diff --git a/src/core/ngx_parse.h b/src/core/ngx_parse.h
index 464cefc..cf3f0b2 100644
--- a/src/core/ngx_parse.h
+++ b/src/core/ngx_parse.h
@@ -16,6 +16,7 @@
 
 
 ssize_t ngx_parse_size(ngx_str_t *line);
+off_t ngx_parse_offset(ngx_str_t *line);
 ngx_int_t ngx_parse_time(ngx_str_t *line, ngx_int_t sec);