nginx-0.3.24-RELEASE import

    *) Workaround: for bug in FreeBSD kqueue.

    *) Bugfix: now a response generated by the "post_action" directive is
       not transferred to a client.

    *) Bugfix: the memory leaks were occurring if many log files were used.

    *) Bugfix: the first "proxy_redirect" directive was working inside one
       location.

    *) Bugfix: on 64-bit platforms segmentation fault may occurred on start
       if the many names were used in the "server_name" directives; the bug
       had appeared in 0.3.18.
diff --git a/src/http/modules/ngx_http_proxy_module.c b/src/http/modules/ngx_http_proxy_module.c
index f63e288..c85f587 100644
--- a/src/http/modules/ngx_http_proxy_module.c
+++ b/src/http/modules/ngx_http_proxy_module.c
@@ -1255,7 +1255,7 @@
     }
 
     for (i = 0; i < plcf->redirects->nelts; i++) {
-        rc = pr->handler(r, h, prefix, pr);
+        rc = pr[i].handler(r, h, prefix, &pr[i]);
 
         if (rc != NGX_DECLINED) {
             return rc;
diff --git a/src/http/ngx_http_core_module.c b/src/http/ngx_http_core_module.c
index a73448b..2784921 100644
--- a/src/http/ngx_http_core_module.c
+++ b/src/http/ngx_http_core_module.c
@@ -1880,24 +1880,29 @@
         ls->conf.sndbuf = -1;
     }
 
-    if (conf->server_names.nelts == 0) {
-        sn = ngx_array_push(&conf->server_names);
-        if (sn == NULL) {
+    if (conf->server_name.data == NULL) {
+        conf->server_name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN);
+        if (conf->server_name.data == NULL) {
             return NGX_CONF_ERROR;
         }
 
-        sn->name.data = ngx_palloc(cf->pool, NGX_MAXHOSTNAMELEN);
-        if (sn->name.data == NULL) {
-            return NGX_CONF_ERROR;
-        }
-
-        if (gethostname((char *) sn->name.data, NGX_MAXHOSTNAMELEN) == -1) {
+        if (gethostname((char *) conf->server_name.data, NGX_MAXHOSTNAMELEN)
+            == -1)
+        {
             ngx_conf_log_error(NGX_LOG_EMERG, cf, ngx_errno,
                                "gethostname() failed");
             return NGX_CONF_ERROR;
         }
 
-        sn->name.len = ngx_strlen(sn->name.data);
+        conf->server_name.len = ngx_strlen(conf->server_name.data);
+
+        sn = ngx_array_push(&conf->server_names);
+        if (sn == NULL) {
+            return NGX_CONF_ERROR;
+        }
+
+        sn->name.len = conf->server_name.len;
+        sn->name.data = conf->server_name.data;
         sn->core_srv_conf = conf;
     }
 
diff --git a/src/http/ngx_http_request.c b/src/http/ngx_http_request.c
index 7fddde0..9ef5a80 100644
--- a/src/http/ngx_http_request.c
+++ b/src/http/ngx_http_request.c
@@ -1518,6 +1518,8 @@
     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
 
     if (clcf->post_action.data) {
+        r->http_version = NGX_HTTP_VERSION_9;
+        r->header_only = 1;
         ngx_http_internal_redirect(r, &clcf->post_action, NULL);
         return;
     }