# HG changeset patch # User Igor Sysoev # Date 1263157200 -10800 # Node ID daf4847b43ff5f01a6cd52111fc8d747e2db0d72 # Parent 6026569dbf6419fdfef3dd31b76d6898ee3bbb17 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. diff --git a/CHANGES b/CHANGES --- a/CHANGES +++ b/CHANGES @@ -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 diff --git a/CHANGES.ru b/CHANGES.ru --- a/CHANGES.ru +++ b/CHANGES.ru @@ -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 может перенаправлять ответы diff --git a/LICENSE b/LICENSE --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/src/core/nginx.h b/src/core/nginx.h --- a/src/core/nginx.h +++ b/src/core/nginx.h @@ -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" diff --git a/src/core/ngx_resolver.c b/src/core/ngx_resolver.c --- a/src/core/ngx_resolver.c +++ b/src/core/ngx_resolver.c @@ -87,6 +87,7 @@ static void *ngx_resolver_calloc(ngx_res 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 @@ ngx_resolver_create(ngx_conf_t *cf, ngx_ 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 @@ ngx_resolver_send_query(ngx_resolver_t * } 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 @@ ngx_resolver_strerror(ngx_int_t err) } +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 @@ ngx_udp_connect(ngx_udp_connection_t *uc 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 @@ ngx_udp_connect(ngx_udp_connection_t *uc } 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 @@ ngx_udp_connect(ngx_udp_connection_t *uc 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 @@ ngx_udp_connect(ngx_udp_connection_t *uc #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 @@ ngx_udp_connect(ngx_udp_connection_t *uc /* 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; } diff --git a/src/core/ngx_resolver.h b/src/core/ngx_resolver.h --- a/src/core/ngx_resolver.h +++ b/src/core/ngx_resolver.h @@ -37,7 +37,7 @@ typedef struct { struct sockaddr *sockaddr; socklen_t socklen; ngx_str_t server; - ngx_log_t *log; + ngx_log_t log; } ngx_udp_connection_t; diff --git a/src/core/ngx_string.c b/src/core/ngx_string.c --- a/src/core/ngx_string.c +++ b/src/core/ngx_string.c @@ -1239,10 +1239,8 @@ ngx_utf8_cpystrn(u_char *dst, u_char *sr break; } - len--; - while (src < next) { - *++dst = *++src; + *dst++ = *src++; len--; } } diff --git a/src/http/modules/ngx_http_chunked_filter_module.c b/src/http/modules/ngx_http_chunked_filter_module.c --- a/src/http/modules/ngx_http_chunked_filter_module.c +++ b/src/http/modules/ngx_http_chunked_filter_module.c @@ -52,7 +52,6 @@ ngx_http_chunked_header_filter(ngx_http_ { 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)) { diff --git a/src/http/modules/ngx_http_headers_filter_module.c b/src/http/modules/ngx_http_headers_filter_module.c --- a/src/http/modules/ngx_http_headers_filter_module.c +++ b/src/http/modules/ngx_http_headers_filter_module.c @@ -291,7 +291,7 @@ ngx_http_set_expires(ngx_http_request_t 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"; diff --git a/src/http/modules/perl/nginx.pm b/src/http/modules/perl/nginx.pm --- a/src/http/modules/perl/nginx.pm +++ b/src/http/modules/perl/nginx.pm @@ -47,7 +47,7 @@ our @EXPORT = qw( HTTP_INSUFFICIENT_STORAGE ); -our $VERSION = '0.8.31'; +our $VERSION = '0.8.32'; require XSLoader; XSLoader::load('nginx', $VERSION); diff --git a/src/http/ngx_http_variables.c b/src/http/ngx_http_variables.c --- a/src/http/ngx_http_variables.c +++ b/src/http/ngx_http_variables.c @@ -1743,7 +1743,7 @@ ngx_http_regex_compile(ngx_conf_t *cf, n v->get_handler = ngx_http_variable_not_found; - p += i + size; + p += size; } return re; diff --git a/src/mail/ngx_mail_auth_http_module.c b/src/mail/ngx_mail_auth_http_module.c --- a/src/mail/ngx_mail_auth_http_module.c +++ b/src/mail/ngx_mail_auth_http_module.c @@ -1405,7 +1405,14 @@ ngx_mail_auth_http(ngx_conf_t *cf, ngx_c 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) {