changeset 560:daf4847b43ff NGINX_0_8_32

nginx 0.8.32 *) Bugfix: UTF-8 encoding usage in the ngx_http_autoindex_module. Thanks to Maxim Dounin. *) Bugfix: regular expression named captures worked for two names only. Thanks to Maxim Dounin. *) Bugfix: now the "localhost" name is used in the "Host" request header line, if an unix domain socket is defined in the "auth_http" directive. Thanks to Maxim Dounin. *) Bugfix: nginx did nor support chunked transfer encoding for 201 responses. Thanks to Julian Reich. *) Bugfix: if the "expires modified" set date in the past, the a negative number was set in the "Cache-Control" response header line. Thanks to Alex Kapranoff.
author Igor Sysoev <http://sysoev.ru>
date Mon, 11 Jan 2010 00:00:00 +0300
parents 6026569dbf64
children 1763c9f30920
files CHANGES CHANGES.ru LICENSE src/core/nginx.h src/core/ngx_resolver.c src/core/ngx_resolver.h src/core/ngx_string.c src/http/modules/ngx_http_chunked_filter_module.c src/http/modules/ngx_http_headers_filter_module.c src/http/modules/perl/nginx.pm src/http/ngx_http_variables.c src/mail/ngx_mail_auth_http_module.c
diffstat 12 files changed, 105 insertions(+), 25 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES	Wed Dec 23 00:00:00 2009 +0300
+++ b/CHANGES	Mon Jan 11 00:00:00 2010 +0300
@@ -1,4 +1,27 @@
 
+Changes with nginx 0.8.32                                        11 Jan 2010
+
+    *) Bugfix: UTF-8 encoding usage in the ngx_http_autoindex_module.
+       Thanks to Maxim Dounin.
+
+    *) Bugfix: regular expression named captures worked for two names only. 
+       Thanks to Maxim Dounin.
+
+    *) Bugfix: now the "localhost" name is used in the "Host" request 
+       header line, if an unix domain socket is defined in the "auth_http" 
+       directive.
+       Thanks to Maxim Dounin.
+
+    *) Bugfix: nginx did nor support chunked transfer encoding for 201 
+       responses.
+       Thanks to Julian Reich.
+
+    *) Bugfix: if the "expires modified" set date in the past, the a 
+       negative number was set in the "Cache-Control" response header 
+       line.
+       Thanks to Alex Kapranoff.
+
+
 Changes with nginx 0.8.31                                        23 Dec 2009
 
     *) Feature: now the "error_page" directive may redirect the 301 and 302 
--- a/CHANGES.ru	Wed Dec 23 00:00:00 2009 +0300
+++ b/CHANGES.ru	Mon Jan 11 00:00:00 2010 +0300
@@ -1,4 +1,29 @@
 
+Изменения в nginx 0.8.32                                          11.01.2010
+
+    *) Исправление: ошибки при использовании кодировки UTF-8 в 
+       ngx_http_autoindex_module.
+       Спасибо Максиму Дунину.
+
+    *) Исправление: именованные выделения в регулярных выражениях работали 
+       только для двух переменных.
+       Спасибо Максиму Дунину.
+
+    *) Исправление: теперь в строке заголовка запроса "Host" используется 
+       имя "localhost", если в директиве auth_http указан unix domain 
+       сокет.
+       Спасибо Максиму Дунину.
+
+    *) Исправление: nginx не поддерживал передачу chunk'ами для 201-ых 
+       ответов.
+       Спасибо Julian Reich.
+
+    *) Исправление: если директива "expires modified" выставляла дату в 
+       прошлом, то в строке заголовка ответа "Cache-Control" выдавалось 
+       отрицательное число.
+       Спасибо Алексею Капранову.
+
+
 Изменения в nginx 0.8.31                                          23.12.2009
 
     *) Добавление: теперь директива error_page может перенаправлять ответы 
--- a/LICENSE	Wed Dec 23 00:00:00 2009 +0300
+++ b/LICENSE	Mon Jan 11 00:00:00 2010 +0300
@@ -1,5 +1,5 @@
 /* 
- * Copyright (C) 2002-2009 Igor Sysoev
+ * Copyright (C) 2002-2010 Igor Sysoev
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
--- a/src/core/nginx.h	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/core/nginx.h	Mon Jan 11 00:00:00 2010 +0300
@@ -8,8 +8,8 @@
 #define _NGINX_H_INCLUDED_
 
 
-#define nginx_version         8031
-#define NGINX_VERSION      "0.8.31"
+#define nginx_version         8032
+#define NGINX_VERSION      "0.8.32"
 #define NGINX_VER          "nginx/" NGINX_VERSION
 
 #define NGINX_VAR          "NGINX"
--- a/src/core/ngx_resolver.c	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/core/ngx_resolver.c	Mon Jan 11 00:00:00 2010 +0300
@@ -87,6 +87,7 @@
 static void ngx_resolver_free(ngx_resolver_t *r, void *p);
 static void ngx_resolver_free_locked(ngx_resolver_t *r, void *p);
 static void *ngx_resolver_dup(ngx_resolver_t *r, void *src, size_t size);
+static u_char *ngx_resolver_log_error(ngx_log_t *log, u_char *buf, size_t len);
 
 
 ngx_resolver_t *
@@ -150,7 +151,11 @@
         uc->sockaddr = addr->sockaddr;
         uc->socklen = addr->socklen;
         uc->server = addr->name;
-        uc->log = &cf->cycle->new_log;
+
+        uc->log = cf->cycle->new_log;
+        uc->log.handler = ngx_resolver_log_error;
+        uc->log.data = uc;
+        uc->log.action = "resolving";
     }
 
     return r;
@@ -840,7 +845,7 @@
     }
 
     if ((size_t) n != (size_t) rn->qlen) {
-        ngx_log_error(NGX_LOG_CRIT, uc->log, 0, "send() incomplete");
+        ngx_log_error(NGX_LOG_CRIT, &uc->log, 0, "send() incomplete");
         return NGX_ERROR;
     }
 
@@ -2071,6 +2076,29 @@
 }
 
 
+static u_char *
+ngx_resolver_log_error(ngx_log_t *log, u_char *buf, size_t len)
+{
+    u_char                *p;
+    ngx_udp_connection_t  *uc;
+
+    p = buf;
+
+    if (log->action) {
+        p = ngx_snprintf(buf, len, " while %s", log->action);
+        len -= p - buf;
+    }
+
+    uc = log->data;
+
+    if (uc) {
+        p = ngx_snprintf(p, len, ", resolver: %V", &uc->server);
+    }
+
+    return p;
+}
+
+
 ngx_int_t
 ngx_udp_connect(ngx_udp_connection_t *uc)
 {
@@ -2082,19 +2110,19 @@
 
     s = ngx_socket(AF_INET, SOCK_DGRAM, 0);
 
-    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, uc->log, 0, "UDP socket %d", s);
+    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, &uc->log, 0, "UDP socket %d", s);
 
     if (s == -1) {
-        ngx_log_error(NGX_LOG_ALERT, uc->log, ngx_socket_errno,
+        ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
                       ngx_socket_n " failed");
         return NGX_ERROR;
     }
 
-    c = ngx_get_connection(s, uc->log);
+    c = ngx_get_connection(s, &uc->log);
 
     if (c == NULL) {
         if (ngx_close_socket(s) == -1) {
-            ngx_log_error(NGX_LOG_ALERT, uc->log, ngx_socket_errno,
+            ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
                           ngx_close_socket_n "failed");
         }
 
@@ -2102,13 +2130,13 @@
     }
 
     if (ngx_nonblocking(s) == -1) {
-        ngx_log_error(NGX_LOG_ALERT, uc->log, ngx_socket_errno,
+        ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
                       ngx_nonblocking_n " failed");
 
         ngx_free_connection(c);
 
         if (ngx_close_socket(s) == -1) {
-            ngx_log_error(NGX_LOG_ALERT, uc->log, ngx_socket_errno,
+            ngx_log_error(NGX_LOG_ALERT, &uc->log, ngx_socket_errno,
                           ngx_close_socket_n " failed");
         }
 
@@ -2118,8 +2146,8 @@
     rev = c->read;
     wev = c->write;
 
-    rev->log = uc->log;
-    wev->log = uc->log;
+    rev->log = &uc->log;
+    wev->log = &uc->log;
 
     uc->connection = c;
 
@@ -2136,7 +2164,7 @@
 
 #endif
 
-    ngx_log_debug3(NGX_LOG_DEBUG_EVENT, uc->log, 0,
+    ngx_log_debug3(NGX_LOG_DEBUG_EVENT, &uc->log, 0,
                    "connect to %V, fd:%d #%d", &uc->server, s, c->number);
 
     rc = connect(s, uc->sockaddr, uc->socklen);
@@ -2144,8 +2172,8 @@
     /* TODO: aio, iocp */
 
     if (rc == -1) {
-        ngx_log_error(NGX_LOG_CRIT, uc->log, ngx_socket_errno,
-                      "connect() to %V failed", &uc->server);
+        ngx_log_error(NGX_LOG_CRIT, &uc->log, ngx_socket_errno,
+                      "connect() failed");
 
         return NGX_ERROR;
     }
--- a/src/core/ngx_resolver.h	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/core/ngx_resolver.h	Mon Jan 11 00:00:00 2010 +0300
@@ -37,7 +37,7 @@
     struct sockaddr          *sockaddr;
     socklen_t                 socklen;
     ngx_str_t                 server;
-    ngx_log_t                *log;
+    ngx_log_t                 log;
 } ngx_udp_connection_t;
 
 
--- a/src/core/ngx_string.c	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/core/ngx_string.c	Mon Jan 11 00:00:00 2010 +0300
@@ -1239,10 +1239,8 @@
             break;
         }
 
-        len--;
-
         while (src < next) {
-            *++dst = *++src;
+            *dst++ = *src++;
             len--;
         }
     }
--- a/src/http/modules/ngx_http_chunked_filter_module.c	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/http/modules/ngx_http_chunked_filter_module.c	Mon Jan 11 00:00:00 2010 +0300
@@ -52,7 +52,6 @@
 {
     if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED
         || r->headers_out.status == NGX_HTTP_NO_CONTENT
-        || r->headers_out.status == NGX_HTTP_CREATED
         || r != r->main
         || (r->method & NGX_HTTP_HEAD))
     {
--- a/src/http/modules/ngx_http_headers_filter_module.c	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/http/modules/ngx_http_headers_filter_module.c	Mon Jan 11 00:00:00 2010 +0300
@@ -291,7 +291,7 @@
 
     ngx_http_time(expires->value.data, expires_time);
 
-    if (conf->expires_time < 0) {
+    if (conf->expires_time < 0 || max_age < 0) {
         cc->value.len = sizeof("no-cache") - 1;
         cc->value.data = (u_char *) "no-cache";
 
--- a/src/http/modules/perl/nginx.pm	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/http/modules/perl/nginx.pm	Mon Jan 11 00:00:00 2010 +0300
@@ -47,7 +47,7 @@
     HTTP_INSUFFICIENT_STORAGE
 );
 
-our $VERSION = '0.8.31';
+our $VERSION = '0.8.32';
 
 require XSLoader;
 XSLoader::load('nginx', $VERSION);
--- a/src/http/ngx_http_variables.c	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/http/ngx_http_variables.c	Mon Jan 11 00:00:00 2010 +0300
@@ -1743,7 +1743,7 @@
 
         v->get_handler = ngx_http_variable_not_found;
 
-        p += i + size;
+        p += size;
     }
 
     return re;
--- a/src/mail/ngx_mail_auth_http_module.c	Wed Dec 23 00:00:00 2009 +0300
+++ b/src/mail/ngx_mail_auth_http_module.c	Mon Jan 11 00:00:00 2010 +0300
@@ -1405,7 +1405,14 @@
 
     ahcf->peer = u.addrs;
 
-    ahcf->host_header = u.host;
+    if (u.family != AF_UNIX) {
+        ahcf->host_header = u.host;
+
+    } else {
+        ahcf->host_header.len = sizeof("localhost") - 1;
+        ahcf->host_header.data = (u_char *) "localhost";
+    }
+
     ahcf->uri = u.uri;
 
     if (ahcf->uri.len == 0) {