nginx-0.1.24-RELEASE import

    *) Feature: the ngx_http_ssi_filter_module supports the QUERY_STRING
       and DOCUMENT_URI variables.

    *) Bugfix: the ngx_http_autoindex_module may some times return the 404
       response for existent directory, if this directory was used in
       "alias" directive.

    *) Bugfix: the ngx_http_ssi_filter_module ran incorrectly for large
       responses.

    *) Bugfix: the lack of the "Referer" header line was always accounted
       as valid referrer.
diff --git a/src/core/nginx.c b/src/core/nginx.c
index 68da2ba..d6ee9f6 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -119,8 +119,8 @@
 ngx_uint_t  ngx_max_module;
 
 
-
-int main(int argc, char *const *argv)
+int
+main(int argc, char *const *argv)
 {
     ngx_int_t         i;
     ngx_log_t        *log;
@@ -252,7 +252,8 @@
 }
 
 
-static ngx_int_t ngx_add_inherited_sockets(ngx_cycle_t *cycle)
+static ngx_int_t
+ngx_add_inherited_sockets(ngx_cycle_t *cycle)
 {
     u_char              *p, *v, *inherited;
     ngx_socket_t         s;
@@ -407,7 +408,8 @@
 }
 
 
-static ngx_int_t ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv)
+static ngx_int_t
+ngx_save_argv(ngx_cycle_t *cycle, int argc, char *const *argv)
 {
     size_t     len;
     ngx_int_t  i;
@@ -444,7 +446,8 @@
 }
 
 
-static void *ngx_core_module_create_conf(ngx_cycle_t *cycle)
+static void *
+ngx_core_module_create_conf(ngx_cycle_t *cycle)
 {
     ngx_core_conf_t  *ccf;
 
@@ -475,7 +478,8 @@
 }
 
 
-static char *ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
+static char *
+ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
 {
     ngx_core_conf_t  *ccf = conf;
 
@@ -543,7 +547,8 @@
 }
 
 
-static char *ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+static char *
+ngx_set_user(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 {
 #if (NGX_WIN32)
 
@@ -603,7 +608,8 @@
 }
 
 
-static char *ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+static char *
+ngx_set_priority(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
 {
     ngx_core_conf_t  *ccf = conf;
 
diff --git a/src/core/nginx.h b/src/core/nginx.h
index 8fbc748..5f76b9b 100644
--- a/src/core/nginx.h
+++ b/src/core/nginx.h
@@ -8,7 +8,7 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define NGINX_VER          "nginx/0.1.23"
+#define NGINX_VER          "nginx/0.1.24"
 
 #define NGINX_VAR          "NGINX"
 #define NGX_NEWPID_EXT     ".newbin"
diff --git a/src/core/ngx_buf.c b/src/core/ngx_buf.c
index dedf444..97c94a3 100644
--- a/src/core/ngx_buf.c
+++ b/src/core/ngx_buf.c
@@ -8,7 +8,8 @@
 #include <ngx_core.h>
 
 
-ngx_buf_t *ngx_create_temp_buf(ngx_pool_t *pool, size_t size)
+ngx_buf_t *
+ngx_create_temp_buf(ngx_pool_t *pool, size_t size)
 {
     ngx_buf_t *b;
 
@@ -20,28 +21,28 @@
         return NULL;
     }
 
+    /*
+     * set by ngx_calloc_buf():
+     *
+     *     b->file_pos = 0;
+     *     b->file_last = 0;
+     *     b->file = NULL;
+     *     b->shadow = NULL;
+     *     b->tag = 0;
+     *
+     */
+
     b->pos = b->start;
     b->last = b->start;
     b->end = b->last + size;
     b->temporary = 1;
 
-    /*
-
-    b->file_pos = 0;
-    b->file_last = 0;
-
-    b->file = NULL;
-    b->shadow = NULL;
-
-    b->tag = 0;
-
-     */
-
     return b;
 }
 
 
-ngx_chain_t *ngx_create_chain_of_bufs(ngx_pool_t *pool, ngx_bufs_t *bufs)
+ngx_chain_t *
+ngx_create_chain_of_bufs(ngx_pool_t *pool, ngx_bufs_t *bufs)
 {
     u_char       *p;
     ngx_int_t     i;
@@ -59,6 +60,17 @@
             return NULL;
         }
 
+        /*
+         * set by ngx_calloc_buf():
+         *
+         *     b->file_pos = 0;
+         *     b->file_last = 0;
+         *     b->file = NULL;
+         *     b->shadow = NULL;
+         *     b->tag = 0;
+         *
+         */
+
         b->pos = p;
         b->last = p;
         b->temporary = 1;
@@ -67,15 +79,6 @@
         p += bufs->size;
         b->end = p;
 
-        /*
-        b->file_pos = 0;
-        b->file_last = 0;
-
-        b->file = NULL;
-        b->shadow = NULL;
-        b->tag = 0;
-        */
-
         if (!(cl = ngx_alloc_chain_link(pool))) {
             return NULL;
         }
@@ -91,8 +94,8 @@
 }
 
 
-ngx_int_t ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
-                             ngx_chain_t *in)
+ngx_int_t
+ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain, ngx_chain_t *in)
 {
     ngx_chain_t  *cl, **ll;
 
@@ -117,20 +120,19 @@
 }
 
 
-void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
-                             ngx_chain_t **out, ngx_buf_tag_t tag)
+void
+ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
+    ngx_chain_t **out, ngx_buf_tag_t tag)
 {
-    ngx_chain_t  *tl;
+    ngx_chain_t  *cl;
 
     if (*busy == NULL) {
         *busy = *out;
 
     } else {
-        for (tl = *busy; tl->next; tl = tl->next) {
-            /* void */;
-        }
+        for (cl = *busy; cl->next; cl = cl->next) { /* void */ }
 
-        tl->next = *out;
+        cl->next = *out;
     }
 
     *out = NULL;
@@ -154,9 +156,9 @@
         (*busy)->buf->pos = (*busy)->buf->start;
         (*busy)->buf->last = (*busy)->buf->start;
 
-        tl = *busy;
-        *busy = (*busy)->next;
-        tl->next = *free;
-        *free = tl;
+        cl = *busy;
+        *busy = cl->next;
+        cl->next = *free;
+        *free = cl;
     }
 }
diff --git a/src/core/ngx_buf.h b/src/core/ngx_buf.h
index fbfd394..d672cf4 100644
--- a/src/core/ngx_buf.h
+++ b/src/core/ngx_buf.h
@@ -106,11 +106,11 @@
 #define ngx_buf_in_memory(b)        (b->temporary || b->memory || b->mmap)
 #define ngx_buf_in_memory_only(b)   (ngx_buf_in_memory(b) && !b->in_file)
 #define ngx_buf_special(b)                                                   \
-        ((b->flush || b->last_buf) && !ngx_buf_in_memory(b) && !b->in_file)
+    ((b->flush || b->last_buf) && !ngx_buf_in_memory(b) && !b->in_file)
 
 #define ngx_buf_size(b)                                                      \
-        (ngx_buf_in_memory(b) ? (off_t) (b->last - b->pos):                  \
-                                (b->file_last - b->file_pos))
+    (ngx_buf_in_memory(b) ? (off_t) (b->last - b->pos):                      \
+                            (b->file_last - b->file_pos))
 
 ngx_buf_t *ngx_create_temp_buf(ngx_pool_t *pool, size_t size);
 ngx_chain_t *ngx_create_chain_of_bufs(ngx_pool_t *pool, ngx_bufs_t *bufs);
@@ -124,29 +124,29 @@
 
 
 #define ngx_alloc_link_and_set_buf(chain, b, pool, error)                    \
-            do {                                                             \
-                ngx_test_null(chain, ngx_alloc_chain_link(pool), error);     \
-                chain->buf = b;                                              \
-                chain->next = NULL;                                          \
-            } while (0);
+    do {                                                                     \
+        ngx_test_null(chain, ngx_alloc_chain_link(pool), error);             \
+        chain->buf = b;                                                      \
+        chain->next = NULL;                                                  \
+    } while (0);
 
 
 #define ngx_chain_add_link(chain, last, cl)                                  \
-            if (chain) {                                                     \
-                *last = cl;                                                  \
-            } else {                                                         \
-                chain = cl;                                                  \
-            }                                                                \
-            last = &cl->next
+    if (chain) {                                                             \
+        *last = cl;                                                          \
+    } else {                                                                 \
+        chain = cl;                                                          \
+    }                                                                        \
+    last = &cl->next
 
 
 ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in);
 ngx_int_t ngx_chain_writer(void *ctx, ngx_chain_t *in);
 
 ngx_int_t ngx_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
-                             ngx_chain_t *in);
+    ngx_chain_t *in);
 void ngx_chain_update_chains(ngx_chain_t **free, ngx_chain_t **busy,
-                             ngx_chain_t **out, ngx_buf_tag_t tag);
+    ngx_chain_t **out, ngx_buf_tag_t tag);
 
 
 #endif /* _NGX_BUF_H_INCLUDED_ */
diff --git a/src/core/ngx_conf_file.c b/src/core/ngx_conf_file.c
index 436103a..437d7a2 100644
--- a/src/core/ngx_conf_file.c
+++ b/src/core/ngx_conf_file.c
@@ -30,7 +30,7 @@
     ngx_conf_commands,                     /* module directives */
     NGX_CONF_MODULE,                       /* module type */
     NULL,                                  /* init module */
-    NULL                                   /* init child */
+    NULL                                   /* init process */
 };
 
 
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index dc791d4..bc02449 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -92,20 +92,13 @@
 
 
 #if (NGX_SOLARIS)
-
-/* TODO: auto_conf */
-#define NGX_ALIGN       (_MAX_ALIGNMENT - 1)         /* platform word */
-#define NGX_ALIGN_CAST  (unsigned long)              /* size of the pointer */
-
+#define NGX_ALIGN       (_MAX_ALIGNMENT - 1)
 #else
-
 /* TODO: auto_conf */
 #define NGX_ALIGN       (sizeof(unsigned long) - 1)  /* platform word */
-#define NGX_ALIGN_CAST  (unsigned long)              /* size of the pointer */
-
 #endif
 
-#define ngx_align(p)    (u_char *) ((NGX_ALIGN_CAST p + NGX_ALIGN) & ~NGX_ALIGN)
+#define ngx_align(p)    (u_char *) (((uintptr_t) p + NGX_ALIGN) & ~NGX_ALIGN)
 
 
 /* TODO: auto_conf: ngx_inline   inline __inline __inline__ */
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index 514479c..561f080 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -169,7 +169,7 @@
 
 
 void
-ngx_init_temp_number()
+ngx_init_temp_number(void)
 {
     ngx_temp_number = 0;
     ngx_random = 123456;
diff --git a/src/core/ngx_file.h b/src/core/ngx_file.h
index f7832d7..c9063c5 100644
--- a/src/core/ngx_file.h
+++ b/src/core/ngx_file.h
@@ -26,7 +26,7 @@
 
     ngx_log_t          *log;
 
-    ngx_uint_t          valid_info:1;  /* unsigned  valid_info:1; */
+    ngx_uint_t          valid_info;  /* unsigned  valid_info:1; */
 };
 
 #define NGX_MAX_PATH_LEVEL  3
@@ -61,7 +61,7 @@
 ngx_int_t ngx_add_path(ngx_conf_t *cf, ngx_path_t **slot);
 ngx_int_t ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user);
 
-void ngx_init_temp_number();
+void ngx_init_temp_number(void);
 ngx_atomic_uint_t ngx_next_temp_number(ngx_uint_t collision);
 
 char *ngx_conf_set_path_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
diff --git a/src/core/ngx_garbage_collector.c b/src/core/ngx_garbage_collector.c
index fb6ad77..ba7d733 100644
--- a/src/core/ngx_garbage_collector.c
+++ b/src/core/ngx_garbage_collector.c
@@ -10,7 +10,7 @@
 
 
 
-ngx_int_t ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level)
+ngx_int_t ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, ngx_int_t level)
 {
     int         rc;
     u_char     *last;
diff --git a/src/core/ngx_garbage_collector.h b/src/core/ngx_garbage_collector.h
index cec3a87..4b0a734 100644
--- a/src/core/ngx_garbage_collector.h
+++ b/src/core/ngx_garbage_collector.h
@@ -10,8 +10,8 @@
 
 typedef struct ngx_gc_s  ngx_gc_t;
 
-typedef int (*ngx_gc_handler_pt) (ngx_gc_t *ctx, ngx_str_t *name,
-                                  ngx_dir_t *dir);
+typedef ngx_int_t (*ngx_gc_handler_pt) (ngx_gc_t *ctx, ngx_str_t *name,
+    ngx_dir_t *dir);
 
 
 struct ngx_gc_s {
@@ -23,9 +23,9 @@
 };
 
 
-ngx_int_t ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, int level);
+ngx_int_t ngx_collect_garbage(ngx_gc_t *ctx, ngx_str_t *dname, ngx_int_t level);
 ngx_int_t ngx_garbage_collector_temp_handler(ngx_gc_t *ctx, ngx_str_t *name,
-                                             ngx_dir_t *dir);
+    ngx_dir_t *dir);
 
 
 #endif /* _NGX_GARBAGE_COLLECTOR_H_INCLUDED_ */
diff --git a/src/core/ngx_log.c b/src/core/ngx_log.c
index 58894e9..5d937f2 100644
--- a/src/core/ngx_log.c
+++ b/src/core/ngx_log.c
@@ -205,7 +205,7 @@
 #endif
 
 
-ngx_log_t *ngx_log_init()
+ngx_log_t *ngx_log_init(void)
 {
     ngx_log.file = &ngx_stderr;
     ngx_log.log_level = NGX_LOG_NOTICE;
diff --git a/src/core/ngx_log.h b/src/core/ngx_log.h
index 48449a7..aae92e7 100644
--- a/src/core/ngx_log.h
+++ b/src/core/ngx_log.h
@@ -72,10 +72,10 @@
 #define NGX_HAVE_VARIADIC_MACROS  1
 
 #define ngx_log_error(level, log, args...)                                    \
-        if (log->log_level >= level) ngx_log_error_core(level, log, args)
+    if (log->log_level >= level) ngx_log_error_core(level, log, args)
 
 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
-                        const char *fmt, ...);
+    const char *fmt, ...);
 
 #define ngx_log_debug(level, log, args...)                                    \
     if (log->log_level & level)                                               \
@@ -88,10 +88,10 @@
 #define NGX_HAVE_VARIADIC_MACROS  1
 
 #define ngx_log_error(level, log, ...)                                        \
-        if (log->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
+    if (log->log_level >= level) ngx_log_error_core(level, log, __VA_ARGS__)
 
 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
-                        const char *fmt, ...);
+    const char *fmt, ...);
 
 #define ngx_log_debug(level, log, ...)                                        \
     if (log->log_level & level)                                               \
@@ -104,9 +104,9 @@
 #define NGX_HAVE_VARIADIC_MACROS  0
 
 void ngx_log_error(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
-                   const char *fmt, ...);
+    const char *fmt, ...);
 void ngx_log_error_core(ngx_uint_t level, ngx_log_t *log, ngx_err_t err,
-                        const char *fmt, va_list args);
+    const char *fmt, va_list args);
 void ngx_log_debug_core(ngx_log_t *log, ngx_err_t err, const char *fmt, ...);
 
 
@@ -195,12 +195,11 @@
 #define ngx_log_alloc_log(pool, log)  ngx_palloc(pool, log, sizeof(ngx_log_t))
 #define ngx_log_copy_log(new, old)    ngx_memcpy(new, old, sizeof(ngx_log_t))
 
-ngx_log_t *ngx_log_init();
+ngx_log_t *ngx_log_init(void);
 ngx_log_t *ngx_log_create_errlog(ngx_cycle_t *cycle, ngx_array_t *args);
 char *ngx_set_error_log_levels(ngx_conf_t *cf, ngx_log_t *log);
 
 
-
 extern ngx_module_t  ngx_errlog_module;
 
 
diff --git a/src/core/ngx_output_chain.c b/src/core/ngx_output_chain.c
index 557dd22..5f6970f 100644
--- a/src/core/ngx_output_chain.c
+++ b/src/core/ngx_output_chain.c
@@ -20,12 +20,13 @@
 static ngx_inline ngx_int_t
     ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf);
 static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool,
-                                          ngx_chain_t **chain, ngx_chain_t *in);
+    ngx_chain_t **chain, ngx_chain_t *in);
 static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src,
-                                           ngx_uint_t sendfile);
+    ngx_uint_t sendfile);
 
 
-ngx_int_t ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
+ngx_int_t
+ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
 {
     int           rc, last;
     off_t         bsize;
@@ -62,9 +63,9 @@
         }
     }
 
-    last = NGX_NONE;
     out = NULL;
     last_out = &out;
+    last = NGX_NONE;
 
     for ( ;; ) {
 
@@ -212,7 +213,7 @@
 
 
 static ngx_inline ngx_int_t
-    ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
+ngx_output_chain_need_to_copy(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
 {
     ngx_uint_t  sendfile;
 
@@ -251,8 +252,9 @@
 }
 
 
-static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool,
-                                           ngx_chain_t **chain, ngx_chain_t *in)
+static ngx_int_t
+ngx_output_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
+    ngx_chain_t *in)
 {
     ngx_chain_t  *cl, **ll;
 #if (NGX_SENDFILE_LIMIT)
@@ -316,8 +318,8 @@
 }
 
 
-static ngx_int_t ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src,
-                                           ngx_uint_t sendfile)
+static ngx_int_t
+ngx_output_chain_copy_buf(ngx_buf_t *dst, ngx_buf_t *src, ngx_uint_t sendfile)
 {
     off_t    size;
     ssize_t  n;
@@ -408,14 +410,14 @@
 }
 
 
-ngx_int_t ngx_chain_writer(void *data, ngx_chain_t *in)
+ngx_int_t
+ngx_chain_writer(void *data, ngx_chain_t *in)
 {
     ngx_chain_writer_ctx_t *ctx = data;
 
     off_t         size;
     ngx_chain_t  *cl;
 
-
     for (size = 0; in; in = in->next) {
 
 #if 1
@@ -444,7 +446,6 @@
     for (cl = ctx->out; cl; cl = cl->next) {
 
 #if 1
-
         if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
             ngx_debug_point();
         }
diff --git a/src/core/ngx_radix_tree.c b/src/core/ngx_radix_tree.c
index 2024219..f8deb21 100644
--- a/src/core/ngx_radix_tree.c
+++ b/src/core/ngx_radix_tree.c
@@ -46,7 +46,7 @@
      * 8 - 8K, 9 - 16K, etc.  On the 64-bit platforms the 6 preallocated bits
      * takes continuous 4K, 7 - 8K, 8 - 16K, etc.  There is no sense to
      * to preallocate more than one page, because further preallocation
-     * distribute the only bit per page.  Instead, the random insertion
+     * distributes the only bit per page.  Instead, the random insertion
      * may distribute several bits per page.
      *
      * Thus, by default we preallocate maximum
diff --git a/src/core/ngx_regex.c b/src/core/ngx_regex.c
index 5a0f793..bb719a5 100644
--- a/src/core/ngx_regex.c
+++ b/src/core/ngx_regex.c
@@ -15,7 +15,7 @@
 static ngx_pool_t  *ngx_pcre_pool;
 
 
-void ngx_regex_init()
+void ngx_regex_init(void)
 {
     pcre_malloc = ngx_regex_malloc;
     pcre_free = ngx_regex_free;
diff --git a/src/core/ngx_regex.h b/src/core/ngx_regex.h
index fb98567..ff07fc7 100644
--- a/src/core/ngx_regex.h
+++ b/src/core/ngx_regex.h
@@ -20,7 +20,7 @@
 
 typedef pcre  ngx_regex_t;
 
-void ngx_regex_init();
+void ngx_regex_init(void);
 ngx_regex_t *ngx_regex_compile(ngx_str_t *pattern, ngx_int_t options,
                                ngx_pool_t *pool, ngx_str_t *err);
 ngx_uint_t ngx_regex_capture_count(ngx_regex_t *re);
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index 9354232..4293289 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -71,7 +71,7 @@
                            "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
 
 
-void ngx_time_init()
+void ngx_time_init(void)
 {
     struct timeval  tv;
 
diff --git a/src/core/ngx_times.h b/src/core/ngx_times.h
index 17ffc43..f9c4d3e 100644
--- a/src/core/ngx_times.h
+++ b/src/core/ngx_times.h
@@ -12,7 +12,7 @@
 #include <ngx_core.h>
 
 
-void ngx_time_init();
+void ngx_time_init(void);
 void ngx_time_update(time_t s);
 u_char *ngx_http_time(u_char *buf, time_t t);
 u_char *ngx_http_cookie_time(u_char *buf, time_t t);