[-]
[+]
|
Changed |
nginx-1.2.changes
|
|
[-]
[+]
|
Changed |
nginx-1.2.spec
^
|
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/CHANGES
^
|
@@ -1,4 +1,15 @@
+Changes with nginx 1.2.6 11 Dec 2012
+
+ *) Feature: the $request_time and $msec variables can now be used not
+ only in the "log_format" directive.
+
+ *) Bugfix: cache manager and cache loader processes might not be able to
+ start if more than 512 listen sockets were used.
+
+ *) Bugfix: in the ngx_http_dav_module.
+
+
Changes with nginx 1.2.5 13 Nov 2012
*) Feature: the "optional_no_ca" parameter of the "ssl_verify_client"
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/CHANGES.ru
^
|
@@ -1,4 +1,15 @@
+Изменения в nginx 1.2.6 11.12.2012
+
+ *) Добавление: переменные $request_time и $msec теперь можно
+ использовать не только в директиве log_format.
+
+ *) Исправление: cache manager и cache loader могли не запускаться, если
+ использовалось более 512 listen-сокетов.
+
+ *) Исправление: в модуле ngx_http_dav_module.
+
+
Изменения в nginx 1.2.5 13.11.2012
*) Добавление: параметр optional_no_ca директивы ssl_verify_client.
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/core/nginx.h
^
|
@@ -9,8 +9,8 @@
#define _NGINX_H_INCLUDED_
-#define nginx_version 1002005
-#define NGINX_VERSION "1.2.5"
+#define nginx_version 1002006
+#define NGINX_VERSION "1.2.6"
#define NGINX_VER "nginx/" NGINX_VERSION
#define NGINX_VAR "NGINX"
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/core/ngx_connection.c
^
|
@@ -749,6 +749,8 @@
ls[i].fd = (ngx_socket_t) -1;
}
+
+ cycle->listening.nelts = 0;
}
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/core/ngx_cycle.c
^
|
@@ -447,7 +447,9 @@
continue;
}
- if (shm_zone[i].shm.size == oshm_zone[n].shm.size) {
+ if (shm_zone[i].tag == oshm_zone[n].tag
+ && shm_zone[i].shm.size == oshm_zone[n].shm.size)
+ {
shm_zone[i].shm.addr = oshm_zone[n].shm.addr;
if (shm_zone[i].init(&shm_zone[i], oshm_zone[n].data)
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/core/ngx_shmtx.c
^
|
@@ -117,11 +117,11 @@
"sem_wait() failed while waiting on shmtx");
break;
}
-
- ngx_log_debug0(NGX_LOG_DEBUG_CORE, ngx_cycle->log, 0,
- "shmtx awoke");
}
+ ngx_log_debug0(NGX_LOG_DEBUG_CORE, ngx_cycle->log, 0,
+ "shmtx awoke");
+
continue;
}
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/http/modules/ngx_http_dav_module.c
^
|
@@ -209,6 +209,11 @@
ngx_ext_rename_file_t ext;
ngx_http_dav_loc_conf_t *dlcf;
+ if (r->request_body == NULL || r->request_body->temp_file == NULL) {
+ ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+ return;
+ }
+
ngx_http_map_uri_to_path(r, &path, &root, 0);
path.len--;
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/http/modules/perl/nginx.pm
^
|
@@ -50,7 +50,7 @@
HTTP_INSUFFICIENT_STORAGE
);
-our $VERSION = '1.2.5';
+our $VERSION = '1.2.6';
require XSLoader;
XSLoader::load('nginx', $VERSION);
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/http/ngx_http_request_body.c
^
|
@@ -31,9 +31,9 @@
{
size_t preread;
ssize_t size;
+ ngx_int_t rc;
ngx_buf_t *b;
ngx_chain_t *cl, **next;
- ngx_temp_file_t *tf;
ngx_http_request_body_t *rb;
ngx_http_core_loc_conf_t *clcf;
@@ -45,12 +45,14 @@
}
if (ngx_http_test_expect(r) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
}
rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t));
if (rb == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
}
r->request_body = rb;
@@ -65,31 +67,9 @@
if (r->headers_in.content_length_n == 0) {
if (r->request_body_in_file_only) {
- tf = ngx_pcalloc(r->pool, sizeof(ngx_temp_file_t));
- if (tf == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
-
- tf->file.fd = NGX_INVALID_FILE;
- tf->file.log = r->connection->log;
- tf->path = clcf->client_body_temp_path;
- tf->pool = r->pool;
- tf->warn = "a client request body is buffered to a temporary file";
- tf->log_level = r->request_body_file_log_level;
- tf->persistent = r->request_body_in_persistent_file;
- tf->clean = r->request_body_in_clean_file;
-
- if (r->request_body_file_group_access) {
- tf->access = 0660;
- }
-
- rb->temp_file = tf;
-
- if (ngx_create_temp_file(&tf->file, tf->path, tf->pool,
- tf->persistent, tf->clean, tf->access)
- != NGX_OK)
- {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ if (ngx_http_write_request_body(r, NULL) != NGX_OK) {
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
}
}
@@ -119,7 +99,8 @@
b = ngx_calloc_buf(r->pool);
if (b == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
}
b->temporary = 1;
@@ -130,7 +111,8 @@
rb->bufs = ngx_alloc_chain_link(r->pool);
if (rb->bufs == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
}
rb->bufs->buf = b;
@@ -148,7 +130,8 @@
if (r->request_body_in_file_only) {
if (ngx_http_write_request_body(r, rb->bufs) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
}
}
@@ -175,7 +158,8 @@
r->read_event_handler = ngx_http_read_client_request_body_handler;
- return ngx_http_do_read_client_request_body(r);
+ rc = ngx_http_do_read_client_request_body(r);
+ goto done;
}
next = &rb->bufs->next;
@@ -205,12 +189,14 @@
rb->buf = ngx_create_temp_buf(r->pool, size);
if (rb->buf == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
}
cl = ngx_alloc_chain_link(r->pool);
if (cl == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ goto done;
}
cl->buf = rb->buf;
@@ -235,7 +221,15 @@
r->read_event_handler = ngx_http_read_client_request_body_handler;
- return ngx_http_do_read_client_request_body(r);
+ rc = ngx_http_do_read_client_request_body(r);
+
+done:
+
+ if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
+ r->main->count--;
+ }
+
+ return rc;
}
@@ -419,6 +413,19 @@
}
rb->temp_file = tf;
+
+ if (body == NULL) {
+ /* empty body with r->request_body_in_file_only */
+
+ if (ngx_create_temp_file(&tf->file, tf->path, tf->pool,
+ tf->persistent, tf->clean, tf->access)
+ != NGX_OK)
+ {
+ return NGX_ERROR;
+ }
+
+ return NGX_OK;
+ }
}
n = ngx_write_chain_to_temp_file(rb->temp_file, body);
@@ -475,19 +482,21 @@
}
}
+ if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
+ r->lingering_close = 0;
+ return NGX_OK;
+ }
+
+ /* == NGX_AGAIN */
+
r->read_event_handler = ngx_http_discarded_request_body_handler;
if (ngx_handle_read_event(rev, 0) != NGX_OK) {
return NGX_HTTP_INTERNAL_SERVER_ERROR;
}
- if (ngx_http_read_discarded_request_body(r) == NGX_OK) {
- r->lingering_close = 0;
-
- } else {
- r->count++;
- r->discard_body = 1;
- }
+ r->count++;
+ r->discard_body = 1;
return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/http/ngx_http_special_response.c
^
|
@@ -260,9 +260,9 @@
static char ngx_http_error_501_page[] =
"<html>" CRLF
-"<head><title>501 Method Not Implemented</title></head>" CRLF
+"<head><title>501 Not Implemented</title></head>" CRLF
"<body bgcolor=\"white\">" CRLF
-"<center><h1>501 Method Not Implemented</h1></center>" CRLF
+"<center><h1>501 Not Implemented</h1></center>" CRLF
;
@@ -384,6 +384,7 @@
case NGX_HTTPS_CERT_ERROR:
case NGX_HTTPS_NO_CERT:
case NGX_HTTP_INTERNAL_SERVER_ERROR:
+ case NGX_HTTP_NOT_IMPLEMENTED:
r->keepalive = 0;
}
}
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/http/ngx_http_upstream.c
^
|
@@ -1809,9 +1809,16 @@
#if (NGX_HAVE_KQUEUE)
if (ngx_event_flags & NGX_USE_KQUEUE_EVENT) {
- if (c->write->pending_eof) {
+ if (c->write->pending_eof || c->read->pending_eof) {
+ if (c->write->pending_eof) {
+ err = c->write->kq_errno;
+
+ } else {
+ err = c->read->kq_errno;
+ }
+
c->log->action = "connecting to upstream";
- (void) ngx_connection_error(c, c->write->kq_errno,
+ (void) ngx_connection_error(c, err,
"kevent() reported that connect() failed");
return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/http/ngx_http_upstream_round_robin.c
^
|
@@ -430,6 +430,10 @@
if (rrp->peers->single) {
peer = &rrp->peers->peer[0];
+ if (peer->down) {
+ goto failed;
+ }
+
} else {
/* there are several peers */
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/http/ngx_http_variables.c
^
|
@@ -79,6 +79,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_request_body_file(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_request_time(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_status(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
@@ -108,6 +110,8 @@
ngx_http_variable_value_t *v, uintptr_t data);
static ngx_int_t ngx_http_variable_pid(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data);
+static ngx_int_t ngx_http_variable_msec(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data);
/*
* TODO:
@@ -237,6 +241,9 @@
ngx_http_variable_request_body_file,
0, 0, 0 },
+ { ngx_string("request_time"), NULL, ngx_http_variable_request_time,
+ 0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
+
{ ngx_string("status"), NULL,
ngx_http_variable_status, 0,
NGX_HTTP_VAR_NOCACHEABLE, 0 },
@@ -285,6 +292,9 @@
{ ngx_string("pid"), NULL, ngx_http_variable_pid,
0, 0, 0 },
+ { ngx_string("msec"), NULL, ngx_http_variable_msec,
+ 0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
+
#if (NGX_HAVE_TCP_INFO)
{ ngx_string("tcpinfo_rtt"), NULL, ngx_http_variable_tcpinfo,
0, NGX_HTTP_VAR_NOCACHEABLE, 0 },
@@ -1757,7 +1767,7 @@
{
u_char *p;
size_t len;
- ngx_buf_t *buf, *next;
+ ngx_buf_t *buf;
ngx_chain_t *cl;
if (r->request_body == NULL
@@ -1782,8 +1792,13 @@
return NGX_OK;
}
- next = cl->next->buf;
- len = (buf->last - buf->pos) + (next->last - next->pos);
+ len = buf->last - buf->pos;
+ cl = cl->next;
+
+ for ( /* void */ ; cl; cl = cl->next) {
+ buf = cl->buf;
+ len += buf->last - buf->pos;
+ }
p = ngx_pnalloc(r->pool, len);
if (p == NULL) {
@@ -1791,9 +1806,12 @@
}
v->data = p;
+ cl = r->request_body->bufs;
- p = ngx_cpymem(p, buf->pos, buf->last - buf->pos);
- ngx_memcpy(p, next->pos, next->last - next->pos);
+ for ( /* void */ ; cl; cl = cl->next) {
+ buf = cl->buf;
+ p = ngx_cpymem(p, buf->pos, buf->last - buf->pos);
+ }
v->len = len;
v->valid = 1;
@@ -1825,6 +1843,35 @@
static ngx_int_t
+ngx_http_variable_request_time(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ u_char *p;
+ ngx_time_t *tp;
+ ngx_msec_int_t ms;
+
+ p = ngx_pnalloc(r->pool, NGX_TIME_T_LEN + 4);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
+
+ tp = ngx_timeofday();
+
+ ms = (ngx_msec_int_t)
+ ((tp->sec - r->start_sec) * 1000 + (tp->msec - r->start_msec));
+ ms = ngx_max(ms, 0);
+
+ v->len = ngx_sprintf(p, "%T.%03M", ms / 1000, ms % 1000) - p;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
+ v->data = p;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
ngx_http_variable_connection(ngx_http_request_t *r,
ngx_http_variable_value_t *v, uintptr_t data)
{
@@ -1909,6 +1956,30 @@
v->valid = 1;
v->no_cacheable = 0;
v->not_found = 0;
+ v->data = p;
+
+ return NGX_OK;
+}
+
+
+static ngx_int_t
+ngx_http_variable_msec(ngx_http_request_t *r,
+ ngx_http_variable_value_t *v, uintptr_t data)
+{
+ u_char *p;
+ ngx_time_t *tp;
+
+ p = ngx_pnalloc(r->pool, NGX_TIME_T_LEN + 4);
+ if (p == NULL) {
+ return NGX_ERROR;
+ }
+
+ tp = ngx_timeofday();
+
+ v->len = ngx_sprintf(p, "%T.%03M", tp->sec, tp->msec) - p;
+ v->valid = 1;
+ v->no_cacheable = 0;
+ v->not_found = 0;
v->data = p;
return NGX_OK;
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/os/unix/ngx_files.c
^
|
@@ -241,8 +241,12 @@
return NGX_ERROR;
}
+ ngx_log_debug2(NGX_LOG_DEBUG_CORE, file->log, 0,
+ "writev: %d, %z", file->fd, n);
+
file->sys_offset += n;
file->offset += n;
+ offset += n;
total += n;
} while (cl);
|
[-]
[+]
|
Changed |
nginx-1.2.6.tar.bz2/src/os/unix/ngx_process_cycle.c
^
|
@@ -20,7 +20,7 @@
static ngx_uint_t ngx_reap_children(ngx_cycle_t *cycle);
static void ngx_master_process_exit(ngx_cycle_t *cycle);
static void ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data);
-static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority);
+static void ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker);
static void ngx_worker_process_exit(ngx_cycle_t *cycle);
static void ngx_channel_handler(ngx_event_t *ev);
#if (NGX_THREADS)
@@ -62,7 +62,6 @@
#endif
-uint64_t cpu_affinity;
static u_char master_process[] = "master process";
@@ -360,10 +359,8 @@
for (i = 0; i < n; i++) {
- cpu_affinity = ngx_get_cpu_affinity(i);
-
- ngx_spawn_process(cycle, ngx_worker_process_cycle, NULL,
- "worker process", type);
+ ngx_spawn_process(cycle, ngx_worker_process_cycle,
+ (void *) (intptr_t) i, "worker process", type);
ch.pid = ngx_processes[ngx_process_slot].pid;
ch.slot = ngx_process_slot;
@@ -371,8 +368,6 @@
ngx_pass_open_channel(cycle, &ch);
}
-
- cpu_affinity = 0;
}
@@ -726,12 +721,14 @@
static void
ngx_worker_process_cycle(ngx_cycle_t *cycle, void *data)
{
+ ngx_int_t worker = (intptr_t) data;
+
ngx_uint_t i;
ngx_connection_t *c;
ngx_process = NGX_PROCESS_WORKER;
- ngx_worker_process_init(cycle, 1);
+ ngx_worker_process_init(cycle, worker);
ngx_setproctitle("worker process");
@@ -837,9 +834,10 @@
static void
-ngx_worker_process_init(ngx_cycle_t *cycle, ngx_uint_t priority)
+ngx_worker_process_init(ngx_cycle_t *cycle, ngx_int_t worker)
{
sigset_t set;
+ uint64_t cpu_affinity;
ngx_int_t n;
ngx_uint_t i;
struct rlimit rlmt;
@@ -853,7 +851,7 @@
ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
- if (priority && ccf->priority != 0) {
+ if (worker >= 0 && ccf->priority != 0) {
if (setpriority(PRIO_PROCESS, 0, ccf->priority) == -1) {
ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
"setpriority(%d) failed", ccf->priority);
@@ -917,8 +915,12 @@
}
}
- if (cpu_affinity) {
- ngx_setaffinity(cpu_affinity, cycle->log);
+ if (worker >= 0) {
+ cpu_affinity = ngx_get_cpu_affinity(worker);
+
+ if (cpu_affinity) {
+ ngx_setaffinity(cpu_affinity, cycle->log);
+ }
}
#if (NGX_HAVE_PR_SET_DUMPABLE)
@@ -1294,14 +1296,19 @@
void *ident[4];
ngx_event_t ev;
- cycle->connection_n = 512;
-
+ /*
+ * Set correct process type since closing listening Unix domain socket
+ * in a master process also removes the Unix domain socket file.
+ */
ngx_process = NGX_PROCESS_HELPER;
- ngx_worker_process_init(cycle, 0);
-
ngx_close_listening_sockets(cycle);
+ /* Set a moderate number of connections for a helper process. */
+ cycle->connection_n = 512;
+
+ ngx_worker_process_init(cycle, -1);
+
ngx_memzero(&ev, sizeof(ngx_event_t));
ev.handler = ctx->handler;
ev.data = ident;
|