Merge lp:~groldster/ubuntu/maverick/nginx/merge-from-sid-0.7.67-2 into lp:ubuntu/maverick/nginx

Proposed by Mikhail Turov on 2010-07-21
Status: Merged
Merged at revision: 33
Proposed branch: lp:~groldster/ubuntu/maverick/nginx/merge-from-sid-0.7.67-2
Merge into: lp:ubuntu/maverick/nginx
Diff against target: 4347 lines (+2367/-363)
83 files modified
.pc/applied-patches (+1/-0)
.pc/fix_reloading_ipv6.diff/src/core/ngx_cycle.c (+1343/-0)
CHANGES (+121/-0)
CHANGES.ru (+126/-2)
auto/cc/conf (+1/-0)
auto/cc/gcc (+0/-2)
auto/feature (+1/-1)
auto/lib/openssl/conf (+2/-0)
auto/lib/openssl/make (+1/-1)
auto/lib/openssl/makefile.bcc (+1/-2)
auto/lib/openssl/makefile.msvc (+1/-2)
auto/lib/zlib/make (+3/-3)
auto/modules (+8/-8)
auto/unix (+10/-0)
debian/README.Debian (+9/-0)
debian/changelog (+101/-0)
debian/conf/mime.types (+2/-0)
debian/conf/sites-available/default (+7/-4)
debian/control (+2/-1)
debian/copyright (+37/-36)
debian/init.d (+2/-1)
debian/patches/fix_reloading_ipv6.diff (+15/-0)
debian/patches/series (+1/-0)
debian/rules (+10/-5)
src/core/nginx.h (+2/-2)
src/core/ngx_cycle.c (+2/-2)
src/core/ngx_file.c (+6/-4)
src/core/ngx_open_file_cache.c (+8/-1)
src/core/ngx_string.c (+2/-2)
src/core/ngx_times.c (+73/-9)
src/core/ngx_times.h (+2/-1)
src/event/modules/ngx_devpoll_module.c (+2/-2)
src/event/modules/ngx_epoll_module.c (+2/-2)
src/event/modules/ngx_eventport_module.c (+2/-2)
src/event/modules/ngx_kqueue_module.c (+3/-3)
src/event/modules/ngx_poll_module.c (+2/-2)
src/event/modules/ngx_rtsig_module.c (+4/-4)
src/event/modules/ngx_select_module.c (+2/-2)
src/event/modules/ngx_win32_select_module.c (+1/-1)
src/event/ngx_event.c (+0/-2)
src/event/ngx_event_openssl.c (+12/-2)
src/event/ngx_event_openssl.h (+1/-0)
src/http/modules/ngx_http_autoindex_module.c (+0/-4)
src/http/modules/ngx_http_chunked_filter_module.c (+10/-2)
src/http/modules/ngx_http_dav_module.c (+7/-11)
src/http/modules/ngx_http_fastcgi_module.c (+11/-0)
src/http/modules/ngx_http_flv_module.c (+0/-4)
src/http/modules/ngx_http_geo_module.c (+1/-1)
src/http/modules/ngx_http_geoip_module.c (+80/-28)
src/http/modules/ngx_http_gzip_static_module.c (+1/-5)
src/http/modules/ngx_http_image_filter_module.c (+33/-13)
src/http/modules/ngx_http_index_module.c (+0/-4)
src/http/modules/ngx_http_memcached_module.c (+8/-3)
src/http/modules/ngx_http_proxy_module.c (+22/-2)
src/http/modules/ngx_http_random_index_module.c (+0/-4)
src/http/modules/ngx_http_referer_module.c (+20/-11)
src/http/modules/ngx_http_rewrite_module.c (+4/-7)
src/http/modules/ngx_http_ssi_filter_module.c (+17/-21)
src/http/modules/ngx_http_static_module.c (+1/-5)
src/http/modules/ngx_http_userid_filter_module.c (+1/-1)
src/http/modules/perl/nginx.pm (+1/-1)
src/http/modules/perl/nginx.xs (+1/-4)
src/http/modules/perl/ngx_http_perl_module.c (+0/-10)
src/http/ngx_http_cache.h (+5/-0)
src/http/ngx_http_copy_filter_module.c (+3/-1)
src/http/ngx_http_core_module.c (+29/-10)
src/http/ngx_http_core_module.h (+1/-0)
src/http/ngx_http_file_cache.c (+68/-2)
src/http/ngx_http_header_filter_module.c (+2/-2)
src/http/ngx_http_parse.c (+19/-38)
src/http/ngx_http_request.c (+28/-7)
src/http/ngx_http_request.h (+3/-4)
src/http/ngx_http_special_response.c (+11/-13)
src/http/ngx_http_upstream.c (+13/-10)
src/http/ngx_http_upstream.h (+1/-0)
src/http/ngx_http_variables.c (+6/-10)
src/http/ngx_http_variables.h (+1/-1)
src/mail/ngx_mail_pop3_handler.c (+0/-2)
src/mail/ngx_mail_proxy_module.c (+1/-1)
src/os/unix/ngx_errno.h (+13/-1)
src/os/unix/ngx_files.h (+4/-0)
src/os/unix/ngx_process.c (+7/-6)
src/os/unix/ngx_process_cycle.c (+3/-3)
To merge this branch: bzr merge lp:~groldster/ubuntu/maverick/nginx/merge-from-sid-0.7.67-2
Reviewer Review Type Date Requested Status
Daniel Holbach Approve on 2010-07-22
Ubuntu branches 2010-07-21 Pending
Review via email: mp+30513@code.launchpad.net

Description of the change

merging nginx 0.7.67 (httpd) from Debian unstable (httpd)

To post a comment you must log in.
Daniel Holbach (dholbach) wrote :

Good work.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file '.pc/applied-patches'
2--- .pc/applied-patches 2010-03-03 23:50:36 +0000
3+++ .pc/applied-patches 2010-07-21 11:15:58 +0000
4@@ -1,2 +1,3 @@
5 nginx-upstream-fair.diff
6 dlopen.diff
7+fix_reloading_ipv6.diff
8
9=== added directory '.pc/fix_reloading_ipv6.diff'
10=== added directory '.pc/fix_reloading_ipv6.diff/src'
11=== added directory '.pc/fix_reloading_ipv6.diff/src/core'
12=== added file '.pc/fix_reloading_ipv6.diff/src/core/ngx_cycle.c'
13--- .pc/fix_reloading_ipv6.diff/src/core/ngx_cycle.c 1970-01-01 00:00:00 +0000
14+++ .pc/fix_reloading_ipv6.diff/src/core/ngx_cycle.c 2010-07-21 11:15:58 +0000
15@@ -0,0 +1,1343 @@
16+
17+/*
18+ * Copyright (C) Igor Sysoev
19+ */
20+
21+
22+#include <ngx_config.h>
23+#include <ngx_core.h>
24+#include <ngx_event.h>
25+
26+
27+static void ngx_destroy_cycle_pools(ngx_conf_t *conf);
28+static ngx_int_t ngx_cmp_sockaddr(struct sockaddr *sa1, struct sockaddr *sa2);
29+static ngx_int_t ngx_init_zone_pool(ngx_cycle_t *cycle,
30+ ngx_shm_zone_t *shm_zone);
31+static ngx_int_t ngx_test_lockfile(u_char *file, ngx_log_t *log);
32+static void ngx_clean_old_cycles(ngx_event_t *ev);
33+
34+
35+volatile ngx_cycle_t *ngx_cycle;
36+ngx_array_t ngx_old_cycles;
37+
38+static ngx_pool_t *ngx_temp_pool;
39+static ngx_event_t ngx_cleaner_event;
40+
41+ngx_uint_t ngx_test_config;
42+
43+#if (NGX_THREADS)
44+ngx_tls_key_t ngx_core_tls_key;
45+#endif
46+
47+
48+/* STUB NAME */
49+static ngx_connection_t dumb;
50+/* STUB */
51+
52+static ngx_str_t error_log = ngx_string(NGX_ERROR_LOG_PATH);
53+
54+
55+ngx_cycle_t *
56+ngx_init_cycle(ngx_cycle_t *old_cycle)
57+{
58+ void *rv;
59+ char **senv, **env;
60+ ngx_uint_t i, n;
61+ ngx_log_t *log;
62+ ngx_time_t *tp;
63+ ngx_conf_t conf;
64+ ngx_pool_t *pool;
65+ ngx_cycle_t *cycle, **old;
66+ ngx_shm_zone_t *shm_zone, *oshm_zone;
67+ ngx_list_part_t *part, *opart;
68+ ngx_open_file_t *file;
69+ ngx_listening_t *ls, *nls;
70+ ngx_core_conf_t *ccf, *old_ccf;
71+ ngx_core_module_t *module;
72+ char hostname[NGX_MAXHOSTNAMELEN];
73+
74+ ngx_timezone_update();
75+
76+ /* force localtime update with a new timezone */
77+
78+ tp = ngx_timeofday();
79+ tp->sec = 0;
80+
81+ ngx_time_update();
82+
83+
84+ log = old_cycle->log;
85+
86+ pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log);
87+ if (pool == NULL) {
88+ return NULL;
89+ }
90+ pool->log = log;
91+
92+ cycle = ngx_pcalloc(pool, sizeof(ngx_cycle_t));
93+ if (cycle == NULL) {
94+ ngx_destroy_pool(pool);
95+ return NULL;
96+ }
97+
98+ cycle->pool = pool;
99+ cycle->log = log;
100+ cycle->new_log.log_level = NGX_LOG_ERR;
101+ cycle->old_cycle = old_cycle;
102+
103+ cycle->conf_prefix.len = old_cycle->conf_prefix.len;
104+ cycle->conf_prefix.data = ngx_pstrdup(pool, &old_cycle->conf_prefix);
105+ if (cycle->conf_prefix.data == NULL) {
106+ ngx_destroy_pool(pool);
107+ return NULL;
108+ }
109+
110+ cycle->prefix.len = old_cycle->prefix.len;
111+ cycle->prefix.data = ngx_pstrdup(pool, &old_cycle->prefix);
112+ if (cycle->prefix.data == NULL) {
113+ ngx_destroy_pool(pool);
114+ return NULL;
115+ }
116+
117+ cycle->conf_file.len = old_cycle->conf_file.len;
118+ cycle->conf_file.data = ngx_pnalloc(pool, old_cycle->conf_file.len + 1);
119+ if (cycle->conf_file.data == NULL) {
120+ ngx_destroy_pool(pool);
121+ return NULL;
122+ }
123+ ngx_cpystrn(cycle->conf_file.data, old_cycle->conf_file.data,
124+ old_cycle->conf_file.len + 1);
125+
126+ cycle->conf_param.len = old_cycle->conf_param.len;
127+ cycle->conf_param.data = ngx_pstrdup(pool, &old_cycle->conf_param);
128+ if (cycle->conf_param.data == NULL) {
129+ ngx_destroy_pool(pool);
130+ return NULL;
131+ }
132+
133+
134+ n = old_cycle->pathes.nelts ? old_cycle->pathes.nelts : 10;
135+
136+ cycle->pathes.elts = ngx_pcalloc(pool, n * sizeof(ngx_path_t *));
137+ if (cycle->pathes.elts == NULL) {
138+ ngx_destroy_pool(pool);
139+ return NULL;
140+ }
141+
142+ cycle->pathes.nelts = 0;
143+ cycle->pathes.size = sizeof(ngx_path_t *);
144+ cycle->pathes.nalloc = n;
145+ cycle->pathes.pool = pool;
146+
147+
148+ if (old_cycle->open_files.part.nelts) {
149+ n = old_cycle->open_files.part.nelts;
150+ for (part = old_cycle->open_files.part.next; part; part = part->next) {
151+ n += part->nelts;
152+ }
153+
154+ } else {
155+ n = 20;
156+ }
157+
158+ if (ngx_list_init(&cycle->open_files, pool, n, sizeof(ngx_open_file_t))
159+ != NGX_OK)
160+ {
161+ ngx_destroy_pool(pool);
162+ return NULL;
163+ }
164+
165+
166+ if (old_cycle->shared_memory.part.nelts) {
167+ n = old_cycle->shared_memory.part.nelts;
168+ for (part = old_cycle->shared_memory.part.next; part; part = part->next)
169+ {
170+ n += part->nelts;
171+ }
172+
173+ } else {
174+ n = 1;
175+ }
176+
177+ if (ngx_list_init(&cycle->shared_memory, pool, n, sizeof(ngx_shm_zone_t))
178+ != NGX_OK)
179+ {
180+ ngx_destroy_pool(pool);
181+ return NULL;
182+ }
183+
184+ n = old_cycle->listening.nelts ? old_cycle->listening.nelts : 10;
185+
186+ cycle->listening.elts = ngx_pcalloc(pool, n * sizeof(ngx_listening_t));
187+ if (cycle->listening.elts == NULL) {
188+ ngx_destroy_pool(pool);
189+ return NULL;
190+ }
191+
192+ cycle->listening.nelts = 0;
193+ cycle->listening.size = sizeof(ngx_listening_t);
194+ cycle->listening.nalloc = n;
195+ cycle->listening.pool = pool;
196+
197+
198+ cycle->conf_ctx = ngx_pcalloc(pool, ngx_max_module * sizeof(void *));
199+ if (cycle->conf_ctx == NULL) {
200+ ngx_destroy_pool(pool);
201+ return NULL;
202+ }
203+
204+
205+ if (gethostname(hostname, NGX_MAXHOSTNAMELEN) == -1) {
206+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "gethostname() failed");
207+ ngx_destroy_pool(pool);
208+ return NULL;
209+ }
210+
211+ /* on Linux gethostname() silently truncates name that does not fit */
212+
213+ hostname[NGX_MAXHOSTNAMELEN - 1] = '\0';
214+ cycle->hostname.len = ngx_strlen(hostname);
215+
216+ cycle->hostname.data = ngx_pnalloc(pool, cycle->hostname.len);
217+ if (cycle->hostname.data == NULL) {
218+ ngx_destroy_pool(pool);
219+ return NULL;
220+ }
221+
222+ ngx_memcpy(cycle->hostname.data, hostname, cycle->hostname.len);
223+
224+
225+ for (i = 0; ngx_modules[i]; i++) {
226+ if (ngx_modules[i]->type != NGX_CORE_MODULE) {
227+ continue;
228+ }
229+
230+ module = ngx_modules[i]->ctx;
231+
232+ if (module->create_conf) {
233+ rv = module->create_conf(cycle);
234+ if (rv == NULL) {
235+ ngx_destroy_pool(pool);
236+ return NULL;
237+ }
238+ cycle->conf_ctx[ngx_modules[i]->index] = rv;
239+ }
240+ }
241+
242+
243+ senv = environ;
244+
245+
246+ ngx_memzero(&conf, sizeof(ngx_conf_t));
247+ /* STUB: init array ? */
248+ conf.args = ngx_array_create(pool, 10, sizeof(ngx_str_t));
249+ if (conf.args == NULL) {
250+ ngx_destroy_pool(pool);
251+ return NULL;
252+ }
253+
254+ conf.temp_pool = ngx_create_pool(NGX_CYCLE_POOL_SIZE, log);
255+ if (conf.temp_pool == NULL) {
256+ ngx_destroy_pool(pool);
257+ return NULL;
258+ }
259+
260+
261+ conf.ctx = cycle->conf_ctx;
262+ conf.cycle = cycle;
263+ conf.pool = pool;
264+ conf.log = log;
265+ conf.module_type = NGX_CORE_MODULE;
266+ conf.cmd_type = NGX_MAIN_CONF;
267+
268+#if 0
269+ log->log_level = NGX_LOG_DEBUG_ALL;
270+#endif
271+
272+ if (ngx_conf_param(&conf) != NGX_CONF_OK) {
273+ environ = senv;
274+ ngx_destroy_cycle_pools(&conf);
275+ return NULL;
276+ }
277+
278+ if (ngx_conf_parse(&conf, &cycle->conf_file) != NGX_CONF_OK) {
279+ environ = senv;
280+ ngx_destroy_cycle_pools(&conf);
281+ return NULL;
282+ }
283+
284+ if (ngx_test_config) {
285+ ngx_log_stderr(0, "the configuration file %s syntax is ok",
286+ cycle->conf_file.data);
287+ }
288+
289+ for (i = 0; ngx_modules[i]; i++) {
290+ if (ngx_modules[i]->type != NGX_CORE_MODULE) {
291+ continue;
292+ }
293+
294+ module = ngx_modules[i]->ctx;
295+
296+ if (module->init_conf) {
297+ if (module->init_conf(cycle, cycle->conf_ctx[ngx_modules[i]->index])
298+ == NGX_CONF_ERROR)
299+ {
300+ environ = senv;
301+ ngx_destroy_cycle_pools(&conf);
302+ return NULL;
303+ }
304+ }
305+ }
306+
307+ if (ngx_process == NGX_PROCESS_SIGNALLER) {
308+ return cycle;
309+ }
310+
311+ ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
312+
313+ if (ngx_test_config) {
314+
315+ if (ngx_create_pidfile(&ccf->pid, log) != NGX_OK) {
316+ goto failed;
317+ }
318+
319+ } else if (!ngx_is_init_cycle(old_cycle)) {
320+
321+ /*
322+ * we do not create the pid file in the first ngx_init_cycle() call
323+ * because we need to write the demonized process pid
324+ */
325+
326+ old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,
327+ ngx_core_module);
328+ if (ccf->pid.len != old_ccf->pid.len
329+ || ngx_strcmp(ccf->pid.data, old_ccf->pid.data) != 0)
330+ {
331+ /* new pid file name */
332+
333+ if (ngx_create_pidfile(&ccf->pid, log) != NGX_OK) {
334+ goto failed;
335+ }
336+
337+ ngx_delete_pidfile(old_cycle);
338+ }
339+ }
340+
341+
342+ if (ngx_test_lockfile(cycle->lock_file.data, log) != NGX_OK) {
343+ goto failed;
344+ }
345+
346+
347+ if (ngx_create_pathes(cycle, ccf->user) != NGX_OK) {
348+ goto failed;
349+ }
350+
351+
352+ if (cycle->new_log.file == NULL) {
353+ cycle->new_log.file = ngx_conf_open_file(cycle, &error_log);
354+ if (cycle->new_log.file == NULL) {
355+ goto failed;
356+ }
357+ }
358+
359+ /* open the new files */
360+
361+ part = &cycle->open_files.part;
362+ file = part->elts;
363+
364+ for (i = 0; /* void */ ; i++) {
365+
366+ if (i >= part->nelts) {
367+ if (part->next == NULL) {
368+ break;
369+ }
370+ part = part->next;
371+ file = part->elts;
372+ i = 0;
373+ }
374+
375+ if (file[i].name.len == 0) {
376+ continue;
377+ }
378+
379+ file[i].fd = ngx_open_file(file[i].name.data,
380+ NGX_FILE_APPEND,
381+ NGX_FILE_CREATE_OR_OPEN,
382+ NGX_FILE_DEFAULT_ACCESS);
383+
384+ ngx_log_debug3(NGX_LOG_DEBUG_CORE, log, 0,
385+ "log: %p %d \"%s\"",
386+ &file[i], file[i].fd, file[i].name.data);
387+
388+ if (file[i].fd == NGX_INVALID_FILE) {
389+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
390+ ngx_open_file_n " \"%s\" failed",
391+ file[i].name.data);
392+ goto failed;
393+ }
394+
395+#if !(NGX_WIN32)
396+ if (fcntl(file[i].fd, F_SETFD, FD_CLOEXEC) == -1) {
397+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
398+ "fcntl(FD_CLOEXEC) \"%s\" failed",
399+ file[i].name.data);
400+ goto failed;
401+ }
402+#endif
403+ }
404+
405+ cycle->log = &cycle->new_log;
406+ pool->log = &cycle->new_log;
407+
408+
409+ /* create shared memory */
410+
411+ part = &cycle->shared_memory.part;
412+ shm_zone = part->elts;
413+
414+ for (i = 0; /* void */ ; i++) {
415+
416+ if (i >= part->nelts) {
417+ if (part->next == NULL) {
418+ break;
419+ }
420+ part = part->next;
421+ shm_zone = part->elts;
422+ i = 0;
423+ }
424+
425+ if (shm_zone[i].shm.size == 0) {
426+ ngx_log_error(NGX_LOG_EMERG, log, 0,
427+ "zero size shared memory zone \"%V\"",
428+ &shm_zone[i].shm.name);
429+ goto failed;
430+ }
431+
432+ if (shm_zone[i].init == NULL) {
433+ /* unused shared zone */
434+ continue;
435+ }
436+
437+ shm_zone[i].shm.log = cycle->log;
438+
439+ opart = &old_cycle->shared_memory.part;
440+ oshm_zone = opart->elts;
441+
442+ for (n = 0; /* void */ ; n++) {
443+
444+ if (n >= opart->nelts) {
445+ if (opart->next == NULL) {
446+ break;
447+ }
448+ opart = opart->next;
449+ oshm_zone = opart->elts;
450+ n = 0;
451+ }
452+
453+ if (shm_zone[i].shm.name.len != oshm_zone[n].shm.name.len) {
454+ continue;
455+ }
456+
457+ if (ngx_strncmp(shm_zone[i].shm.name.data,
458+ oshm_zone[n].shm.name.data,
459+ shm_zone[i].shm.name.len)
460+ != 0)
461+ {
462+ continue;
463+ }
464+
465+ if (shm_zone[i].shm.size == oshm_zone[n].shm.size) {
466+ shm_zone[i].shm.addr = oshm_zone[n].shm.addr;
467+
468+ if (shm_zone[i].init(&shm_zone[i], oshm_zone[n].data)
469+ != NGX_OK)
470+ {
471+ goto failed;
472+ }
473+
474+ goto shm_zone_found;
475+ }
476+
477+ ngx_shm_free(&oshm_zone[n].shm);
478+
479+ break;
480+ }
481+
482+ if (ngx_shm_alloc(&shm_zone[i].shm) != NGX_OK) {
483+ goto failed;
484+ }
485+
486+ if (ngx_init_zone_pool(cycle, &shm_zone[i]) != NGX_OK) {
487+ goto failed;
488+ }
489+
490+ if (shm_zone[i].init(&shm_zone[i], NULL) != NGX_OK) {
491+ goto failed;
492+ }
493+
494+ shm_zone_found:
495+
496+ continue;
497+ }
498+
499+
500+ /* handle the listening sockets */
501+
502+ if (old_cycle->listening.nelts) {
503+ ls = old_cycle->listening.elts;
504+ for (i = 0; i < old_cycle->listening.nelts; i++) {
505+ ls[i].remain = 0;
506+ }
507+
508+ nls = cycle->listening.elts;
509+ for (n = 0; n < cycle->listening.nelts; n++) {
510+
511+ for (i = 0; i < old_cycle->listening.nelts; i++) {
512+ if (ls[i].ignore) {
513+ continue;
514+ }
515+
516+ if (ngx_cmp_sockaddr(nls[n].sockaddr, ls[i].sockaddr) == NGX_OK)
517+ {
518+ nls[n].fd = ls[i].fd;
519+ nls[n].previous = &ls[i];
520+ ls[i].remain = 1;
521+
522+ if (ls[n].backlog != nls[i].backlog) {
523+ nls[n].listen = 1;
524+ }
525+
526+#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
527+
528+ /*
529+ * FreeBSD, except the most recent versions,
530+ * could not remove accept filter
531+ */
532+ nls[n].deferred_accept = ls[i].deferred_accept;
533+
534+ if (ls[i].accept_filter && nls[n].accept_filter) {
535+ if (ngx_strcmp(ls[i].accept_filter,
536+ nls[n].accept_filter)
537+ != 0)
538+ {
539+ nls[n].delete_deferred = 1;
540+ nls[n].add_deferred = 1;
541+ }
542+
543+ } else if (ls[i].accept_filter) {
544+ nls[n].delete_deferred = 1;
545+
546+ } else if (nls[n].accept_filter) {
547+ nls[n].add_deferred = 1;
548+ }
549+#endif
550+
551+#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
552+
553+ if (ls[n].deferred_accept && !nls[n].deferred_accept) {
554+ nls[n].delete_deferred = 1;
555+
556+ } else if (ls[i].deferred_accept != nls[n].deferred_accept)
557+ {
558+ nls[n].add_deferred = 1;
559+ }
560+#endif
561+ break;
562+ }
563+ }
564+
565+ if (nls[n].fd == -1) {
566+ nls[n].open = 1;
567+ }
568+ }
569+
570+ } else {
571+ ls = cycle->listening.elts;
572+ for (i = 0; i < cycle->listening.nelts; i++) {
573+ ls[i].open = 1;
574+#if (NGX_HAVE_DEFERRED_ACCEPT && defined SO_ACCEPTFILTER)
575+ if (ls[i].accept_filter) {
576+ ls[i].add_deferred = 1;
577+ }
578+#endif
579+#if (NGX_HAVE_DEFERRED_ACCEPT && defined TCP_DEFER_ACCEPT)
580+ if (ls[i].deferred_accept) {
581+ ls[i].add_deferred = 1;
582+ }
583+#endif
584+ }
585+ }
586+
587+ if (ngx_open_listening_sockets(cycle) != NGX_OK) {
588+ goto failed;
589+ }
590+
591+ if (!ngx_test_config) {
592+ ngx_configure_listening_sockets(cycle);
593+ }
594+
595+
596+ /* commit the new cycle configuration */
597+
598+ if (!ngx_use_stderr && cycle->log->file->fd != ngx_stderr) {
599+
600+ if (ngx_set_stderr(cycle->log->file->fd) == NGX_FILE_ERROR) {
601+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
602+ ngx_set_stderr_n " failed");
603+ }
604+ }
605+
606+ pool->log = cycle->log;
607+
608+ for (i = 0; ngx_modules[i]; i++) {
609+ if (ngx_modules[i]->init_module) {
610+ if (ngx_modules[i]->init_module(cycle) != NGX_OK) {
611+ /* fatal */
612+ exit(1);
613+ }
614+ }
615+ }
616+
617+
618+ /* close and delete stuff that lefts from an old cycle */
619+
620+ /* free the unnecessary shared memory */
621+
622+ opart = &old_cycle->shared_memory.part;
623+ oshm_zone = opart->elts;
624+
625+ for (i = 0; /* void */ ; i++) {
626+
627+ if (i >= opart->nelts) {
628+ if (opart->next == NULL) {
629+ goto old_shm_zone_done;
630+ }
631+ opart = opart->next;
632+ oshm_zone = opart->elts;
633+ i = 0;
634+ }
635+
636+ part = &cycle->shared_memory.part;
637+ shm_zone = part->elts;
638+
639+ for (n = 0; /* void */ ; n++) {
640+
641+ if (n >= part->nelts) {
642+ if (part->next == NULL) {
643+ break;
644+ }
645+ part = part->next;
646+ shm_zone = part->elts;
647+ n = 0;
648+ }
649+
650+ if (oshm_zone[i].shm.name.len == shm_zone[n].shm.name.len
651+ && ngx_strncmp(oshm_zone[i].shm.name.data,
652+ shm_zone[n].shm.name.data,
653+ oshm_zone[i].shm.name.len)
654+ == 0)
655+ {
656+ goto live_shm_zone;
657+ }
658+ }
659+
660+ ngx_shm_free(&oshm_zone[i].shm);
661+
662+ live_shm_zone:
663+
664+ continue;
665+ }
666+
667+old_shm_zone_done:
668+
669+
670+ /* close the unnecessary listening sockets */
671+
672+ ls = old_cycle->listening.elts;
673+ for (i = 0; i < old_cycle->listening.nelts; i++) {
674+
675+ if (ls[i].remain || ls[i].fd == -1) {
676+ continue;
677+ }
678+
679+ if (ngx_close_socket(ls[i].fd) == -1) {
680+ ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
681+ ngx_close_socket_n " listening socket on %V failed",
682+ &ls[i].addr_text);
683+ }
684+ }
685+
686+
687+ /* close the unnecessary open files */
688+
689+ part = &old_cycle->open_files.part;
690+ file = part->elts;
691+
692+ for (i = 0; /* void */ ; i++) {
693+
694+ if (i >= part->nelts) {
695+ if (part->next == NULL) {
696+ break;
697+ }
698+ part = part->next;
699+ file = part->elts;
700+ i = 0;
701+ }
702+
703+ if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) {
704+ continue;
705+ }
706+
707+ if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
708+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
709+ ngx_close_file_n " \"%s\" failed",
710+ file[i].name.data);
711+ }
712+ }
713+
714+ ngx_destroy_pool(conf.temp_pool);
715+
716+ if (ngx_process == NGX_PROCESS_MASTER || ngx_is_init_cycle(old_cycle)) {
717+
718+ /*
719+ * perl_destruct() frees environ, if it is not the same as it was at
720+ * perl_construct() time, therefore we save the previous cycle
721+ * environment before ngx_conf_parse() where it will be changed.
722+ */
723+
724+ env = environ;
725+ environ = senv;
726+
727+ ngx_destroy_pool(old_cycle->pool);
728+ cycle->old_cycle = NULL;
729+
730+ environ = env;
731+
732+ return cycle;
733+ }
734+
735+
736+ if (ngx_temp_pool == NULL) {
737+ ngx_temp_pool = ngx_create_pool(128, cycle->log);
738+ if (ngx_temp_pool == NULL) {
739+ ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
740+ "can not create ngx_temp_pool");
741+ exit(1);
742+ }
743+
744+ n = 10;
745+ ngx_old_cycles.elts = ngx_pcalloc(ngx_temp_pool,
746+ n * sizeof(ngx_cycle_t *));
747+ if (ngx_old_cycles.elts == NULL) {
748+ exit(1);
749+ }
750+ ngx_old_cycles.nelts = 0;
751+ ngx_old_cycles.size = sizeof(ngx_cycle_t *);
752+ ngx_old_cycles.nalloc = n;
753+ ngx_old_cycles.pool = ngx_temp_pool;
754+
755+ ngx_cleaner_event.handler = ngx_clean_old_cycles;
756+ ngx_cleaner_event.log = cycle->log;
757+ ngx_cleaner_event.data = &dumb;
758+ dumb.fd = (ngx_socket_t) -1;
759+ }
760+
761+ ngx_temp_pool->log = cycle->log;
762+
763+ old = ngx_array_push(&ngx_old_cycles);
764+ if (old == NULL) {
765+ exit(1);
766+ }
767+ *old = old_cycle;
768+
769+ if (!ngx_cleaner_event.timer_set) {
770+ ngx_add_timer(&ngx_cleaner_event, 30000);
771+ ngx_cleaner_event.timer_set = 1;
772+ }
773+
774+ return cycle;
775+
776+
777+failed:
778+
779+ if (!ngx_is_init_cycle(old_cycle)) {
780+ old_ccf = (ngx_core_conf_t *) ngx_get_conf(old_cycle->conf_ctx,
781+ ngx_core_module);
782+ if (old_ccf->environment) {
783+ environ = old_ccf->environment;
784+ }
785+ }
786+
787+ /* rollback the new cycle configuration */
788+
789+ part = &cycle->open_files.part;
790+ file = part->elts;
791+
792+ for (i = 0; /* void */ ; i++) {
793+
794+ if (i >= part->nelts) {
795+ if (part->next == NULL) {
796+ break;
797+ }
798+ part = part->next;
799+ file = part->elts;
800+ i = 0;
801+ }
802+
803+ if (file[i].fd == NGX_INVALID_FILE || file[i].fd == ngx_stderr) {
804+ continue;
805+ }
806+
807+ if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
808+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
809+ ngx_close_file_n " \"%s\" failed",
810+ file[i].name.data);
811+ }
812+ }
813+
814+ if (ngx_test_config) {
815+ ngx_destroy_cycle_pools(&conf);
816+ return NULL;
817+ }
818+
819+ ls = cycle->listening.elts;
820+ for (i = 0; i < cycle->listening.nelts; i++) {
821+ if (ls[i].fd == -1 || !ls[i].open) {
822+ continue;
823+ }
824+
825+ if (ngx_close_socket(ls[i].fd) == -1) {
826+ ngx_log_error(NGX_LOG_EMERG, log, ngx_socket_errno,
827+ ngx_close_socket_n " %V failed",
828+ &ls[i].addr_text);
829+ }
830+ }
831+
832+ ngx_destroy_cycle_pools(&conf);
833+
834+ return NULL;
835+}
836+
837+
838+static void
839+ngx_destroy_cycle_pools(ngx_conf_t *conf)
840+{
841+ ngx_destroy_pool(conf->temp_pool);
842+ ngx_destroy_pool(conf->pool);
843+}
844+
845+
846+static ngx_int_t
847+ngx_cmp_sockaddr(struct sockaddr *sa1, struct sockaddr *sa2)
848+{
849+ struct sockaddr_in *sin1, *sin2;
850+#if (NGX_HAVE_INET6)
851+ struct sockaddr_in6 *sin61, *sin62;
852+#endif
853+
854+ if (sa1->sa_family != sa2->sa_family) {
855+ return NGX_DECLINED;
856+ }
857+
858+ switch (sa1->sa_family) {
859+
860+#if (NGX_HAVE_INET6)
861+ case AF_INET6:
862+ sin61 = (struct sockaddr_in6 *) sa1;
863+ sin62 = (struct sockaddr_in6 *) sa2;
864+
865+ if (sin61->sin6_port != sin61->sin6_port) {
866+ return NGX_DECLINED;
867+ }
868+
869+ if (ngx_memcmp(&sin61->sin6_addr, &sin62->sin6_addr, 16) != 0) {
870+ return NGX_DECLINED;
871+ }
872+
873+ break;
874+#endif
875+
876+ default: /* AF_INET */
877+
878+ sin1 = (struct sockaddr_in *) sa1;
879+ sin2 = (struct sockaddr_in *) sa2;
880+
881+ if (sin1->sin_port != sin2->sin_port) {
882+ return NGX_DECLINED;
883+ }
884+
885+ if (sin1->sin_addr.s_addr != sin2->sin_addr.s_addr) {
886+ return NGX_DECLINED;
887+ }
888+
889+ break;
890+ }
891+
892+ return NGX_OK;
893+}
894+
895+
896+static ngx_int_t
897+ngx_init_zone_pool(ngx_cycle_t *cycle, ngx_shm_zone_t *zn)
898+{
899+ u_char *file;
900+ ngx_slab_pool_t *sp;
901+
902+ sp = (ngx_slab_pool_t *) zn->shm.addr;
903+
904+ if (zn->shm.exists) {
905+
906+ if (sp == sp->addr) {
907+ return NGX_OK;
908+ }
909+
910+ ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,
911+ "shared zone \"%V\" has no equal addresses: %p vs %p",
912+ &zn->shm.name, sp->addr, sp);
913+ return NGX_ERROR;
914+ }
915+
916+ sp->end = zn->shm.addr + zn->shm.size;
917+ sp->min_shift = 3;
918+ sp->addr = zn->shm.addr;
919+
920+#if (NGX_HAVE_ATOMIC_OPS)
921+
922+ file = NULL;
923+
924+#else
925+
926+ file = ngx_pnalloc(cycle->pool, cycle->lock_file.len + zn->shm.name.len);
927+ if (file == NULL) {
928+ return NGX_ERROR;
929+ }
930+
931+ (void) ngx_sprintf(file, "%V%V%Z", &cycle->lock_file, &zn->shm.name);
932+
933+#endif
934+
935+ if (ngx_shmtx_create(&sp->mutex, (void *) &sp->lock, file) != NGX_OK) {
936+ return NGX_ERROR;
937+ }
938+
939+ ngx_slab_init(sp);
940+
941+ return NGX_OK;
942+}
943+
944+
945+ngx_int_t
946+ngx_create_pidfile(ngx_str_t *name, ngx_log_t *log)
947+{
948+ size_t len;
949+ ngx_uint_t create;
950+ ngx_file_t file;
951+ u_char pid[NGX_INT64_LEN + 2];
952+
953+ if (ngx_process > NGX_PROCESS_MASTER) {
954+ return NGX_OK;
955+ }
956+
957+ ngx_memzero(&file, sizeof(ngx_file_t));
958+
959+ file.name = *name;
960+ file.log = log;
961+
962+ create = ngx_test_config ? NGX_FILE_CREATE_OR_OPEN : NGX_FILE_TRUNCATE;
963+
964+ file.fd = ngx_open_file(file.name.data, NGX_FILE_RDWR,
965+ create, NGX_FILE_DEFAULT_ACCESS);
966+
967+ if (file.fd == NGX_INVALID_FILE) {
968+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
969+ ngx_open_file_n " \"%s\" failed", file.name.data);
970+ return NGX_ERROR;
971+ }
972+
973+ if (!ngx_test_config) {
974+ len = ngx_snprintf(pid, NGX_INT64_LEN + 2, "%P%N", ngx_pid) - pid;
975+
976+ if (ngx_write_file(&file, pid, len, 0) == NGX_ERROR) {
977+ return NGX_ERROR;
978+ }
979+ }
980+
981+ if (ngx_close_file(file.fd) == NGX_FILE_ERROR) {
982+ ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
983+ ngx_close_file_n " \"%s\" failed", file.name.data);
984+ }
985+
986+ return NGX_OK;
987+}
988+
989+
990+void
991+ngx_delete_pidfile(ngx_cycle_t *cycle)
992+{
993+ u_char *name;
994+ ngx_core_conf_t *ccf;
995+
996+ ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
997+
998+ name = ngx_new_binary ? ccf->oldpid.data : ccf->pid.data;
999+
1000+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
1001+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
1002+ ngx_delete_file_n " \"%s\" failed", name);
1003+ }
1004+}
1005+
1006+
1007+ngx_int_t
1008+ngx_signal_process(ngx_cycle_t *cycle, char *sig)
1009+{
1010+ ssize_t n;
1011+ ngx_int_t pid;
1012+ ngx_file_t file;
1013+ ngx_core_conf_t *ccf;
1014+ u_char buf[NGX_INT64_LEN + 2];
1015+
1016+ ngx_log_error(NGX_LOG_NOTICE, cycle->log, 0, "signal process started");
1017+
1018+ ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
1019+
1020+ file.name = ccf->pid;
1021+ file.log = cycle->log;
1022+
1023+ file.fd = ngx_open_file(file.name.data, NGX_FILE_RDONLY,
1024+ NGX_FILE_OPEN, NGX_FILE_DEFAULT_ACCESS);
1025+
1026+ if (file.fd == NGX_INVALID_FILE) {
1027+ ngx_log_error(NGX_LOG_ERR, cycle->log, ngx_errno,
1028+ ngx_open_file_n " \"%s\" failed", file.name.data);
1029+ return 1;
1030+ }
1031+
1032+ n = ngx_read_file(&file, buf, NGX_INT64_LEN + 2, 0);
1033+
1034+ if (ngx_close_file(file.fd) == NGX_FILE_ERROR) {
1035+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
1036+ ngx_close_file_n " \"%s\" failed", file.name.data);
1037+ }
1038+
1039+ if (n == NGX_ERROR) {
1040+ return 1;
1041+ }
1042+
1043+ while (n-- && (buf[n] == CR || buf[n] == LF)) { /* void */ }
1044+
1045+ pid = ngx_atoi(buf, ++n);
1046+
1047+ if (pid == NGX_ERROR) {
1048+ ngx_log_error(NGX_LOG_ERR, cycle->log, 0,
1049+ "invalid PID number \"%*s\" in \"%s\"",
1050+ n, buf, file.name.data);
1051+ return 1;
1052+ }
1053+
1054+ return ngx_os_signal_process(cycle, sig, pid);
1055+
1056+}
1057+
1058+
1059+static ngx_int_t
1060+ngx_test_lockfile(u_char *file, ngx_log_t *log)
1061+{
1062+#if !(NGX_HAVE_ATOMIC_OPS)
1063+ ngx_fd_t fd;
1064+
1065+ fd = ngx_open_file(file, NGX_FILE_RDWR, NGX_FILE_CREATE_OR_OPEN,
1066+ NGX_FILE_DEFAULT_ACCESS);
1067+
1068+ if (fd == NGX_INVALID_FILE) {
1069+ ngx_log_error(NGX_LOG_EMERG, log, ngx_errno,
1070+ ngx_open_file_n " \"%s\" failed", file);
1071+ return NGX_ERROR;
1072+ }
1073+
1074+ if (ngx_close_file(fd) == NGX_FILE_ERROR) {
1075+ ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
1076+ ngx_close_file_n " \"%s\" failed", file);
1077+ }
1078+
1079+ if (ngx_delete_file(file) == NGX_FILE_ERROR) {
1080+ ngx_log_error(NGX_LOG_ALERT, log, ngx_errno,
1081+ ngx_delete_file_n " \"%s\" failed", file);
1082+ }
1083+
1084+#endif
1085+
1086+ return NGX_OK;
1087+}
1088+
1089+
1090+void
1091+ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
1092+{
1093+ ssize_t n, len;
1094+ ngx_fd_t fd;
1095+ ngx_uint_t i;
1096+ ngx_list_part_t *part;
1097+ ngx_open_file_t *file;
1098+
1099+ part = &cycle->open_files.part;
1100+ file = part->elts;
1101+
1102+ for (i = 0; /* void */ ; i++) {
1103+
1104+ if (i >= part->nelts) {
1105+ if (part->next == NULL) {
1106+ break;
1107+ }
1108+ part = part->next;
1109+ file = part->elts;
1110+ i = 0;
1111+ }
1112+
1113+ if (file[i].name.len == 0) {
1114+ continue;
1115+ }
1116+
1117+ len = file[i].pos - file[i].buffer;
1118+
1119+ if (file[i].buffer && len != 0) {
1120+
1121+ n = ngx_write_fd(file[i].fd, file[i].buffer, len);
1122+
1123+ if (n == NGX_FILE_ERROR) {
1124+ ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
1125+ ngx_write_fd_n " to \"%s\" failed",
1126+ file[i].name.data);
1127+
1128+ } else if (n != len) {
1129+ ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
1130+ ngx_write_fd_n " to \"%s\" was incomplete: %z of %uz",
1131+ file[i].name.data, n, len);
1132+ }
1133+
1134+ file[i].pos = file[i].buffer;
1135+ }
1136+
1137+ fd = ngx_open_file(file[i].name.data, NGX_FILE_APPEND,
1138+ NGX_FILE_CREATE_OR_OPEN, NGX_FILE_DEFAULT_ACCESS);
1139+
1140+ ngx_log_debug3(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
1141+ "reopen file \"%s\", old:%d new:%d",
1142+ file[i].name.data, file[i].fd, fd);
1143+
1144+ if (fd == NGX_INVALID_FILE) {
1145+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1146+ ngx_open_file_n " \"%s\" failed", file[i].name.data);
1147+ continue;
1148+ }
1149+
1150+#if !(NGX_WIN32)
1151+ if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) {
1152+ ngx_file_info_t fi;
1153+
1154+ if (ngx_file_info((const char *) file[i].name.data, &fi)
1155+ == NGX_FILE_ERROR)
1156+ {
1157+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1158+ ngx_file_info_n " \"%s\" failed",
1159+ file[i].name.data);
1160+
1161+ if (ngx_close_file(fd) == NGX_FILE_ERROR) {
1162+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1163+ ngx_close_file_n " \"%s\" failed",
1164+ file[i].name.data);
1165+ }
1166+ }
1167+
1168+ if (fi.st_uid != user) {
1169+ if (chown((const char *) file[i].name.data, user, -1) == -1) {
1170+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1171+ "chown(\"%s\", %d) failed",
1172+ file[i].name.data, user);
1173+
1174+ if (ngx_close_file(fd) == NGX_FILE_ERROR) {
1175+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1176+ ngx_close_file_n " \"%s\" failed",
1177+ file[i].name.data);
1178+ }
1179+ }
1180+ }
1181+
1182+ if ((fi.st_mode & (S_IRUSR|S_IWUSR)) != (S_IRUSR|S_IWUSR)) {
1183+
1184+ fi.st_mode |= (S_IRUSR|S_IWUSR);
1185+
1186+ if (chmod((const char *) file[i].name.data, fi.st_mode) == -1) {
1187+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1188+ "chmod() \"%s\" failed", file[i].name.data);
1189+
1190+ if (ngx_close_file(fd) == NGX_FILE_ERROR) {
1191+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1192+ ngx_close_file_n " \"%s\" failed",
1193+ file[i].name.data);
1194+ }
1195+ }
1196+ }
1197+ }
1198+
1199+ if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) {
1200+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1201+ "fcntl(FD_CLOEXEC) \"%s\" failed",
1202+ file[i].name.data);
1203+
1204+ if (ngx_close_file(fd) == NGX_FILE_ERROR) {
1205+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1206+ ngx_close_file_n " \"%s\" failed",
1207+ file[i].name.data);
1208+ }
1209+
1210+ continue;
1211+ }
1212+#endif
1213+
1214+ if (ngx_close_file(file[i].fd) == NGX_FILE_ERROR) {
1215+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1216+ ngx_close_file_n " \"%s\" failed",
1217+ file[i].name.data);
1218+ }
1219+
1220+ file[i].fd = fd;
1221+ }
1222+
1223+#if !(NGX_WIN32)
1224+
1225+ if (cycle->log->file->fd != STDERR_FILENO) {
1226+ if (dup2(cycle->log->file->fd, STDERR_FILENO) == -1) {
1227+ ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
1228+ "dup2(STDERR) failed");
1229+ }
1230+ }
1231+
1232+#endif
1233+}
1234+
1235+
1236+ngx_shm_zone_t *
1237+ngx_shared_memory_add(ngx_conf_t *cf, ngx_str_t *name, size_t size, void *tag)
1238+{
1239+ ngx_uint_t i;
1240+ ngx_shm_zone_t *shm_zone;
1241+ ngx_list_part_t *part;
1242+
1243+ part = &cf->cycle->shared_memory.part;
1244+ shm_zone = part->elts;
1245+
1246+ for (i = 0; /* void */ ; i++) {
1247+
1248+ if (i >= part->nelts) {
1249+ if (part->next == NULL) {
1250+ break;
1251+ }
1252+ part = part->next;
1253+ shm_zone = part->elts;
1254+ i = 0;
1255+ }
1256+
1257+ if (name->len != shm_zone[i].shm.name.len) {
1258+ continue;
1259+ }
1260+
1261+ if (ngx_strncmp(name->data, shm_zone[i].shm.name.data, name->len)
1262+ != 0)
1263+ {
1264+ continue;
1265+ }
1266+
1267+ if (size && size != shm_zone[i].shm.size) {
1268+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1269+ "the size %uz of shared memory zone \"%V\" "
1270+ "conflicts with already declared size %uz",
1271+ size, &shm_zone[i].shm.name, shm_zone[i].shm.size);
1272+ return NULL;
1273+ }
1274+
1275+ if (tag != shm_zone[i].tag) {
1276+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1277+ "the shared memory zone \"%V\" is "
1278+ "already declared for a different use",
1279+ &shm_zone[i].shm.name);
1280+ return NULL;
1281+ }
1282+
1283+ return &shm_zone[i];
1284+ }
1285+
1286+ shm_zone = ngx_list_push(&cf->cycle->shared_memory);
1287+
1288+ if (shm_zone == NULL) {
1289+ return NULL;
1290+ }
1291+
1292+ shm_zone->data = NULL;
1293+ shm_zone->shm.log = cf->cycle->log;
1294+ shm_zone->shm.size = size;
1295+ shm_zone->shm.name = *name;
1296+ shm_zone->shm.exists = 0;
1297+ shm_zone->init = NULL;
1298+ shm_zone->tag = tag;
1299+
1300+ return shm_zone;
1301+}
1302+
1303+
1304+static void
1305+ngx_clean_old_cycles(ngx_event_t *ev)
1306+{
1307+ ngx_uint_t i, n, found, live;
1308+ ngx_log_t *log;
1309+ ngx_cycle_t **cycle;
1310+
1311+ log = ngx_cycle->log;
1312+ ngx_temp_pool->log = log;
1313+
1314+ ngx_log_debug0(NGX_LOG_DEBUG_CORE, log, 0, "clean old cycles");
1315+
1316+ live = 0;
1317+
1318+ cycle = ngx_old_cycles.elts;
1319+ for (i = 0; i < ngx_old_cycles.nelts; i++) {
1320+
1321+ if (cycle[i] == NULL) {
1322+ continue;
1323+ }
1324+
1325+ found = 0;
1326+
1327+ for (n = 0; n < cycle[i]->connection_n; n++) {
1328+ if (cycle[i]->connections[n].fd != (ngx_socket_t) -1) {
1329+ found = 1;
1330+
1331+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "live fd:%d", n);
1332+
1333+ break;
1334+ }
1335+ }
1336+
1337+ if (found) {
1338+ live = 1;
1339+ continue;
1340+ }
1341+
1342+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "clean old cycle: %d", i);
1343+
1344+ ngx_destroy_pool(cycle[i]->pool);
1345+ cycle[i] = NULL;
1346+ }
1347+
1348+ ngx_log_debug1(NGX_LOG_DEBUG_CORE, log, 0, "old cycles status: %d", live);
1349+
1350+ if (live) {
1351+ ngx_add_timer(ev, 30000);
1352+
1353+ } else {
1354+ ngx_destroy_pool(ngx_temp_pool);
1355+ ngx_temp_pool = NULL;
1356+ ngx_old_cycles.nelts = 0;
1357+ }
1358+}
1359
1360=== modified file 'CHANGES'
1361--- CHANGES 2010-03-03 23:50:36 +0000
1362+++ CHANGES 2010-07-21 11:15:58 +0000
1363@@ -1,4 +1,125 @@
1364
1365+Changes with nginx 0.7.67 15 Jun 2010
1366+
1367+ *) Security: nginx/Windows worker might be terminated abnormally if a
1368+ requested file name has invalid UTF-8 encoding.
1369+
1370+
1371+Changes with nginx 0.7.66 07 Jun 2010
1372+
1373+ *) Security: now nginx/Windows ignores default file stream name.
1374+ Thanks to Jose Antonio Vazquez Gonzalez.
1375+
1376+ *) Change: now the charset filter runs before the SSI filter.
1377+
1378+ *) Change: now no message is written in an error log if a variable is
1379+ not found by $r->variable() method.
1380+
1381+ *) Change: now keepalive connections after POST requests are not
1382+ disabled for MSIE 7.0+.
1383+ Thanks to Adam Lounds.
1384+
1385+ *) Feature: the "proxy_no_cache" and "fastcgi_no_cache" directives.
1386+
1387+ *) Feature: now the "rewrite" directive does a redirect automatically
1388+ if the $scheme variable is used.
1389+ Thanks to Piotr Sikora.
1390+
1391+ *) Feature: the "chunked_transfer_encoding" directive.
1392+
1393+ *) Feature: the $geoip_city_continent_code, $geoip_latitude, and
1394+ $geoip_longitude variables.
1395+ Thanks to Arvind Sundararajan.
1396+
1397+ *) Feature: now the ngx_http_image_filter_module deletes always EXIF
1398+ and other application specific data if the data consume more than 5%
1399+ of a JPEG file.
1400+
1401+ *) Feature: now the "msie_padding" directive works for Chrome too.
1402+
1403+ *) Workaround: now keepalive connections are disabled for Safari.
1404+ Thanks to Joshua Sierles.
1405+
1406+ *) Bugfix: nginx ignored the "private" and "no-store" values in the
1407+ "Cache-Control" backend response header line.
1408+
1409+ *) Bugfix: an "&" character was not escaped when it was copied in
1410+ arguments part in a rewrite rule.
1411+
1412+ *) Bugfix: nginx might be terminated abnormally while a signal
1413+ processing or if the directive "timer_resolution" was used on
1414+ platforms which do not support kqueue or eventport notification
1415+ methods.
1416+ Thanks to George Xie and Maxim Dounin.
1417+
1418+ *) Bugfix: if temporary files and permanent storage area resided at
1419+ different file systems, then permanent file modification times were
1420+ incorrect.
1421+ Thanks to Maxim Dounin.
1422+
1423+ *) Bugfix: ngx_http_memcached_module might issue the error message
1424+ "memcached sent invalid trailer".
1425+ Thanks to Maxim Dounin.
1426+
1427+ *) Bugfix: nginx could not built zlib-1.2.4 library using the library
1428+ sources.
1429+ Thanks to Maxim Dounin.
1430+
1431+ *) Bugfix: values of the $query_string, $arg_..., etc. variables cached
1432+ in main request were used by the SSI module in subrequests.
1433+
1434+ *) Bugfix: nginx did not support HTTPS referrers.
1435+
1436+ *) Bugfix: nginx/Windows might not find file if path in configuration
1437+ was given in other character case; the bug had appeared in 0.7.65.
1438+
1439+ *) Bugfix: the $date_local variable has an incorrect value, if the "%s"
1440+ format was used.
1441+ Thanks to Maxim Dounin.
1442+
1443+ *) Bugfix: nginx did not support all ciphers and digests used in client
1444+ certificates.
1445+ Thanks to Innocenty Enikeew.
1446+
1447+ *) Bugfix: if ssl_session_cache was not set or was set to "none", then
1448+ during client certificate verify the error "session id context
1449+ uninitialized" might occur; the bug had appeared in 0.7.1.
1450+
1451+ *) Bugfix: OpenSSL-1.0.0 compatibility on 64-bit Linux.
1452+ Thanks to Maxim Dounin.
1453+
1454+ *) Bugfix: a geo range returned default value if the range included two
1455+ or more /16 networks and did not begin at /16 network boundary.
1456+
1457+ *) Bugfix: the $uid_got variable might not be used in the SSI and perl
1458+ modules.
1459+
1460+ *) Bugfix: a worker process hung if a FIFO file was requested.
1461+ Thanks to Vicente Aguilar and Maxim Dounin.
1462+
1463+ *) Bugfix: a variable value was repeatedly encoded after each an "echo"
1464+ SSI-command output; the bug had appeared in 0.6.14.
1465+
1466+ *) Bugfix: a "stub" parameter of an "include" SSI directive was not
1467+ used, if empty response has 200 status code.
1468+
1469+ *) Bugfix: a block used in a "stub" parameter of an "include" SSI
1470+ directive was output with "text/plain" MIME type.
1471+
1472+ *) Bugfix: if a proxied or FastCGI request was internally redirected to
1473+ another proxied or FastCGI location, then a segmentation fault might
1474+ occur in a worker process; the bug had appeared in 0.7.65.
1475+ Thanks to Yichun Zhang.
1476+
1477+ *) Bugfix: IMAP connections may hang until they timed out while talking
1478+ to Zimbra server.
1479+ Thanks to Alan Batie.
1480+
1481+ *) Bugfix: nginx did not support chunked transfer encoding for 201
1482+ responses.
1483+ Thanks to Julian Reich.
1484+
1485+
1486 Changes with nginx 0.7.65 01 Feb 2010
1487
1488 *) Security: now nginx/Windows ignores trailing spaces in URI.
1489
1490=== modified file 'CHANGES.ru'
1491--- CHANGES.ru 2010-03-03 23:50:36 +0000
1492+++ CHANGES.ru 2010-07-21 11:15:58 +0000
1493@@ -1,4 +1,128 @@
1494
1495+éÚÍÅÎÅÎÉÑ × nginx 0.7.67 15.06.2010
1496+
1497+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ nginx/Windows ÍÏÇ ÚÁ×ÅÒÛÁÔØÓÑ Á×ÁÒÉÊÎÏ
1498+ ÐÒÉ ÚÁÐÒÏÓÅ ÆÁÊÌÁ Ó ÎÅ×ÅÒÎÏÊ ËÏÄÉÒÏ×ËÏÊ UTF-8.
1499+
1500+
1501+éÚÍÅÎÅÎÉÑ × nginx 0.7.66 07.06.2010
1502+
1503+ *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ÉÍÑ ÐÏÔÏËÁ ÆÁÊÌÁ ÐÏ
1504+ ÕÍÏÌÞÁÎÉÀ.
1505+ óÐÁÓÉÂÏ Jose Antonio Vazquez Gonzalez.
1506+
1507+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ charset-ÆÉÌØÔÒ ÒÁÂÏÔÁÅÔ ÄÏ SSI-ÆÉÌØÔÒÁ.
1508+
1509+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ × ÌÏÇ ÏÛÉÂÏË ÎÅ ÐÉÛÅÔÓÑ ÓÏÏÂÝÅÎÉÅ, ÅÓÌÉ ÐÅÒÅÍÅÎÎÁÑ
1510+ ÎÅ ÎÁÊÄÅÎÁ Ó ÐÏÍÏÝØÀ ÍÅÔÏÄÁ $r->variable().
1511+
1512+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ keepalive ÓÏÅÄÉÎÅÎÉÑ ÐÏÓÌÅ ÚÁÐÒÏÓÏ× POST ÎÅ
1513+ ÚÁÐÒÅÝÁÀÔÓÑ ÄÌÑ MSIE 7.0+.
1514+ óÐÁÓÉÂÏ Adam Lounds.
1515+
1516+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù proxy_no_cache É fastcgi_no_cache.
1517+
1518+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÐÅÒÅÍÅÎÎÏÊ $scheme × ÄÉÒÅËÔÉ×Å
1519+ rewrite Á×ÔÏÍÁÔÉÞÅÓËÉ ÄÅÌÁÅÔÓÑ ÒÅÄÉÒÅËÔ.
1520+ óÐÁÓÉÂÏ Piotr Sikora.
1521+
1522+ *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Á chunked_transfer_encoding.
1523+
1524+ *) äÏÂÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÙÅ $geoip_city_continent_code, $geoip_latitude É
1525+ $geoip_longitude.
1526+ óÐÁÓÉÂÏ Arvind Sundararajan.
1527+
1528+ *) äÏÂÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_image_filter_module ÔÅÐÅÒØ ×ÓÅÇÄÁ
1529+ ÕÄÁÌÑÅÔ EXIF É ÄÒÕÇÉÅ ÄÁÎÎÙÅ, ÅÓÌÉ ÏÎÉ ÚÁÎÉÍÁÀÔ ÂÏÌØÛÅ 5% ×
1530+ JPEG-ÆÁÊÌÅ.
1531+
1532+ *) äÏÂÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÄÉÒÅËÔÉ×Á msie_padding ÒÁÂÏÔÁÅÔ É ÄÌÑ Chrome.
1533+
1534+ *) éÚÍÅÎÅÎÉÅ: ÔÅÐÅÒØ keepalive ÓÏÅÄÉÎÅÎÉÑ ÚÁÐÒÅÝÅÎÙ ÄÌÑ Safari.
1535+ óÐÁÓÉÂÏ Joshua Sierles.
1536+
1537+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÉÇÎÏÒÉÒÏ×ÁÌ ÚÎÁÞÅÎÉÑ "private" É "no-store" ×
1538+ ÓÔÒÏËÅ "Cache-Control" × ÚÁÇÏÌÏ×ËÅ ÏÔ×ÅÔÁ ÂÜËÅÎÄÁ.
1539+
1540+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÉÍ×ÏÌ "&" ÐÒÉ ËÏÐÉÒÏ×ÁÎÉÉ × ÁÒÇÕÍÅÎÔÙ × ÐÒÁ×ÉÌÁÈ
1541+ rewrite ÎÅ ÜËÒÁÎÉÒÏ×ÁÌÓÑ.
1542+
1543+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÍÏÇ ÚÁ×ÅÒÛÁÔØÓÑ Á×ÁÒÉÊÎÏ ×Ï ×ÒÅÍÑ ÏÂÒÁÂÏÔËÉ
1544+ ÓÉÇÎÁÌÁ ÉÌÉ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ ÄÉÒÅËÔÉ×Ù timer_resolution ÎÁ
1545+ ÐÌÁÔÆÏÒÍÁÈ, ÎÅ ÐÏÄÄÅÒÖÉ×ÁÀÝÉÈ ÍÅÔÏÄÙ kqueue ÉÌÉ eventport.
1546+ óÐÁÓÉÂÏ George Xie É íÁËÓÉÍÕ äÕÎÉÎÕ.
1547+
1548+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ×ÒÅÍÅÎÎÙÅ ÆÁÊÌÙ É ÐÏÓÔÏÑÎÎÏÅ ÍÅÓÔÏ ÈÒÁÎÅÎÉÑ
1549+ ÒÁÓÐÏÌÁÇÁÌÉÓØ ÎÁ ÒÁÚÎÙÈ ÆÁÊÌÏ×ÙÈ ÓÉÓÔÅÍÁÈ, ÔÏ Õ ÐÏÓÔÏÑÎÎÙÈ ÆÁÊÌÏ×
1550+ ×ÒÅÍÑ ÉÚÍÅÎÅÎÉÑ ÂÙÌÏ ÎÅ×ÅÒÎÙÍ.
1551+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
1552+
1553+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ ngx_http_memcached_module ÍÏÇ ×ÙÄÁ×ÁÔØ ÏÛÉÂËÕ
1554+ "memcached sent invalid trailer".
1555+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
1556+
1557+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÍÏÇ ÓÏÂÒÁÔØ ÂÉÂÌÉÏÔÅËÕ zlib-1.2.4 ÉÚ ÉÓÈÏÄÎÙÈ
1558+ ÔÅËÓÔÏ×.
1559+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
1560+
1561+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÍÏÄÕÌØ SSI × ÐÏÄÚÁÐÒÏÓÁÈ ÉÓÐÏÌØÚÏ×ÁÌ ÚÁËÜÛÉÒÏ×ÁÎÎÙÅ ×
1562+ ÏÓÎÏ×ÎÏÍ ÚÁÐÒÏÓÅ ÚÎÁÞÅÎÉÑ ÐÅÒÅÍÅÎÎÙÈ $query_string, $arg_... É ÉÍ
1563+ ÐÏÄÏÂÎÙÈ.
1564+
1565+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ HTTPS-ÒÅÆÅÒÅÒÙ.
1566+
1567+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx/Windows ÍÏÇ ÎÅ ÎÁÈÏÄÉÔØ ÆÁÊÌÙ, ÅÓÌÉ ÐÕÔØ ×
1568+ ËÏÎÆÉÇÕÒÁÃÉÉ ÂÙÌ ÚÁÄÁÎ × ÄÒÕÇÏÍ ÒÅÇÉÓÔÒÅ; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.65.
1569+
1570+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÁÑ $date_local ×ÙÄÁ×ÁÌÁ ÎÅ×ÅÒÎÏÅ ×ÒÅÍÑ, ÅÓÌÉ
1571+ ÉÓÐÏÌØÚÏ×ÁÌÓÑ ÆÏÒÍÁÔ "%s".
1572+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
1573+
1574+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ ×ÓÅ ÛÉÆÒÙ, ÉÓÐÏÌØÚÕÅÍÙÅ ×
1575+ ËÌÉÅÎÔÓËÉÈ ÓÅÒÔÉÆÉËÁÔÁÈ.
1576+ óÐÁÓÉÂÏ éÎÎÏËÅÎÔÉÀ åÎÉËÅÅ×Õ.
1577+
1578+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ssl_session_cache ÎÅ ÂÙÌ ÕÓÔÁÎÏ×ÌÅÎ ÉÌÉ ÕÓÔÁÎÏ×ÌÅÎ
1579+ × none, ÔÏ ÐÒÉ ÐÒÏ×ÅÒËÅ ËÌÉÅÎÔÓËÏÇÏ ÓÅÒÔÉÆÉËÁÔÙ ÍÏÇÌÁ ÐÒÏÉÓÈÏÄÉÔØ
1580+ ÏÛÉÂËÁ "session id context uninitialized"; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.7.1.
1581+
1582+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÏ×ÍÅÓÔÉÍÏÓÔØ Ó OpenSSL-1.0.0 ÎÁ 64-ÂÉÔÎÏÍ Linux.
1583+ óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
1584+
1585+ *) éÓÐÒÁ×ÌÅÎÉÅ: geo-ÄÉÁÐÁÚÏÎ ×ÏÚ×ÒÁÝÁÌ ÚÎÁÞÅÎÉÅ ÐÏ ÕÍÏÌÞÁÎÉÀ, ÅÓÌÉ
1586+ ÄÉÁÐÁÚÏÎ ×ËÌÀÞÁÌ × ÓÅÂÑ ÏÄÎÕ É ÂÏÌÅÅ ÓÅÔÅÊ ÒÁÚÍÅÒÏÍ /16 É ÎÅ
1587+ ÎÁÞÉÎÁÌÓÑ ÎÁ ÇÒÁÎÉÃÅ ÓÅÔÉ ÒÁÚÍÅÒÏÍ /16.
1588+
1589+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÅÒÅÍÅÎÎÕÀ $uid_got ÎÅÌØÚÑ ÂÙÌÏ ÉÓÐÏÌØÚÏ×ÁÔØ × SSI É
1590+ ÐÅÒÌÏ×ÏÍ ÍÏÄÕÌÑÈ.
1591+
1592+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ ÚÁ×ÉÓÁÌ ÐÒÉ ÚÁÐÒÏÓÅ ÆÁÊÌÁ FIFO.
1593+ óÐÁÓÉÂÏ Vicente Aguilar É íÁËÓÉÍÕ äÕÎÉÎÕ.
1594+
1595+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÚÎÁÞÅÎÉÅ ÐÅÒÅÍÅÎÎÏÊ ÐÏ×ÔÏÒÎÏ ÜËÒÁÎÉÒÏ×ÁÌÏÓØ ÐÏÓÌÅ
1596+ ËÁÖÄÏÇÏ ×Ù×ÏÄÁ SSI-ËÏÍÁÎÄÙ echo; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ × 0.6.14.
1597+
1598+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÐÁÒÁÍÅÔÒ stub × SSI-ÄÉÒÅËÔÉ×Å include ÎÅ ÉÓÐÏÌØÚÏ×ÁÌÓÑ,
1599+ ÅÓÌÉ ÐÕÓÔÏÊ ÏÔ×ÅÔ ÉÍÅÌ ËÏÄ 200.
1600+
1601+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÂÌÏË, ÉÓÐÏÌØÚÕÅÍÙÊ × ÐÁÒÁÍÅÔÒÅ stub × SSI-ÄÉÒÅËÔÉ×Å
1602+ include, ×Ù×ÏÄÉÌÓÑ Ó MIME-ÔÉÐÏÍ "text/plain".
1603+
1604+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÅÓÌÉ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI ÚÁÐÒÏÓ ×ÎÕÔÒÅÎÎÅ
1605+ ÐÅÒÅÎÁÐÒÁ×ÌÑÌÓÑ × ÄÒÕÇÏÊ ÐÒÏËÓÉÒÏ×ÁÎÎÙÊ ÉÌÉ FastCGI location, ÔÏ ×
1606+ ÒÁÂÏÞÅÍ ÐÒÏÃÅÓÓÅ ÍÏÇ ÐÒÏÉÚÏÊÔÉ segmentation fault; ÏÛÉÂËÁ ÐÏÑ×ÉÌÁÓØ
1607+ × 0.7.65.
1608+ óÐÁÓÉÂÏ Yichun Zhang.
1609+
1610+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÓÏÅÄÉÎÅÎÉÑ IMAP Ë ÓÅÒ×ÅÒÕ Zimbra ÍÏÇÌÏ ÚÁ×ÉÓÎÕÔØ ÄÏ
1611+ ÔÁÊÍÁÕÔÁ.
1612+ óÐÁÓÉÂÏ Alan Batie.
1613+
1614+ *) éÓÐÒÁ×ÌÅÎÉÅ: nginx ÎÅ ÐÏÄÄÅÒÖÉ×ÁÌ ÐÅÒÅÄÁÞÕ chunk'ÁÍÉ ÄÌÑ 201-ÙÈ
1615+ ÏÔ×ÅÔÏ×.
1616+ óÐÁÓÉÂÏ Julian Reich.
1617+
1618+
1619 éÚÍÅÎÅÎÉÑ × nginx 0.7.65 01.02.2010
1620
1621 *) âÅÚÏÐÁÓÎÏÓÔØ: ÔÅÐÅÒØ nginx/Windows ÉÇÎÏÒÉÒÕÅÔ ÐÒÏÂÅÌÙ × ËÏÎÃÅ URI.
1622@@ -178,7 +302,7 @@
1623
1624 *) äÏÂÁ×ÌÅÎÉÅ: ÄÉÒÅËÔÉ×Ù limit_req_log_level É limit_conn_log_level.
1625
1626- *) éÓÐÒÁ×ÌÅÎÉÅ: ôÅÐÅÒØ ÄÉÒÅËÔÉ×Á limit_req ÓÏÏÔ×ÅÔÓÔ×ÕÅÔ ÁÌÇÏÒÉÔÍÕ
1627+ *) éÓÐÒÁ×ÌÅÎÉÅ: ÔÅÐÅÒØ ÄÉÒÅËÔÉ×Á limit_req ÓÏÏÔ×ÅÔÓÔ×ÕÅÔ ÁÌÇÏÒÉÔÍÕ
1628 leaky bucket.
1629 óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
1630
1631@@ -1648,7 +1772,7 @@
1632 óÐÁÓÉÂÏ áÎÄÒÅÀ îÉÇÍÁÔÕÌÉÎÕ.
1633
1634 *) éÓÐÒÁ×ÌÅÎÉÅ: ngx_http_memcached_module ÎÅ ÕÓÔÁÎÁ×ÌÉ×ÁÌ
1635- upstream_response_time.
1636+ $upstream_response_time.
1637 óÐÁÓÉÂÏ íÁËÓÉÍÕ äÕÎÉÎÕ.
1638
1639 *) éÓÐÒÁ×ÌÅÎÉÅ: ÒÁÂÏÞÉÊ ÐÒÏÃÅÓÓ ÍÏÇ ÚÁÃÉËÌÉÔØÓÑ ÐÒÉ ÉÓÐÏÌØÚÏ×ÁÎÉÉ
1640
1641=== modified file 'auto/cc/conf'
1642--- auto/cc/conf 2007-02-19 10:30:07 +0000
1643+++ auto/cc/conf 2010-07-21 11:15:58 +0000
1644@@ -104,6 +104,7 @@
1645 fi
1646
1647 CFLAGS="$CFLAGS $NGX_CC_OPT"
1648+NGX_TEST_LD_OPT="$NGX_LD_OPT"
1649
1650
1651 if [ "$NGX_PLATFORM" != win32 ]; then
1652
1653=== modified file 'auto/cc/gcc'
1654--- auto/cc/gcc 2009-10-19 23:22:06 +0000
1655+++ auto/cc/gcc 2010-07-21 11:15:58 +0000
1656@@ -51,8 +51,6 @@
1657 #NGX_GCC_OPT="-Os"
1658 NGX_GCC_OPT="-O"
1659
1660-CFLAGS="$CFLAGS $NGX_GCC_OPT"
1661-
1662 #CFLAGS="$CFLAGS -fomit-frame-pointer"
1663
1664 case $CPU in
1665
1666=== modified file 'auto/feature'
1667--- auto/feature 2008-09-02 20:48:58 +0000
1668+++ auto/feature 2010-07-21 11:15:58 +0000
1669@@ -39,7 +39,7 @@
1670
1671
1672 ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
1673- -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
1674+ -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
1675
1676 ngx_feature_inc_path=
1677
1678
1679=== modified file 'auto/lib/openssl/conf'
1680--- auto/lib/openssl/conf 2010-03-03 23:50:36 +0000
1681+++ auto/lib/openssl/conf 2010-07-21 11:15:58 +0000
1682@@ -19,6 +19,8 @@
1683
1684 # libeay32.lib requires gdi32.lib
1685 CORE_LIBS="$CORE_LIBS gdi32.lib"
1686+ # OpenSSL 1.0.0 requires crypt32.lib
1687+ CORE_LIBS="$CORE_LIBS crypt32.lib"
1688 ;;
1689
1690 *)
1691
1692=== modified file 'auto/lib/openssl/make'
1693--- auto/lib/openssl/make 2010-03-03 23:50:36 +0000
1694+++ auto/lib/openssl/make 2010-07-21 11:15:58 +0000
1695@@ -57,7 +57,7 @@
1696 && \$(MAKE) clean \\
1697 && ./config --prefix=$ngx_prefix no-shared $OPENSSL_OPT \\
1698 && \$(MAKE) \\
1699- && \$(MAKE) install
1700+ && \$(MAKE) install LIBDIR=lib
1701
1702 END
1703
1704
1705=== modified file 'auto/lib/openssl/makefile.bcc'
1706--- auto/lib/openssl/makefile.bcc 2009-10-19 23:22:06 +0000
1707+++ auto/lib/openssl/makefile.bcc 2010-07-21 11:15:58 +0000
1708@@ -5,8 +5,7 @@
1709 all:
1710 cd $(OPENSSL)
1711
1712- perl Configure BC-32 no-shared --prefix=openssl -DNO_SYS_TYPES_H \
1713- $(OPENSSL_OPT)
1714+ perl Configure BC-32 no-shared --prefix=openssl $(OPENSSL_OPT)
1715
1716 ms\do_nasm
1717
1718
1719=== modified file 'auto/lib/openssl/makefile.msvc'
1720--- auto/lib/openssl/makefile.msvc 2009-10-19 23:22:06 +0000
1721+++ auto/lib/openssl/makefile.msvc 2010-07-21 11:15:58 +0000
1722@@ -5,8 +5,7 @@
1723 all:
1724 cd $(OPENSSL)
1725
1726- perl Configure VC-WIN32 no-shared --prefix=openssl -DNO_SYS_TYPES_H \
1727- $(OPENSSL_OPT)
1728+ perl Configure VC-WIN32 no-shared --prefix=openssl $(OPENSSL_OPT)
1729
1730 ms\do_ms
1731
1732
1733=== modified file 'auto/lib/zlib/make'
1734--- auto/lib/zlib/make 2009-10-19 23:22:06 +0000
1735+++ auto/lib/zlib/make 2010-07-21 11:15:58 +0000
1736@@ -53,7 +53,7 @@
1737
1738 $ZLIB/libz.a: $NGX_MAKEFILE
1739 cd $ZLIB \\
1740- && \$(MAKE) clean \\
1741+ && \$(MAKE) distclean \\
1742 && cp contrib/asm586/match.S . \\
1743 && CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\
1744 ./configure \\
1745@@ -70,7 +70,7 @@
1746
1747 $ZLIB/libz.a: $NGX_MAKEFILE
1748 cd $ZLIB \\
1749- && \$(MAKE) clean \\
1750+ && \$(MAKE) distclean \\
1751 && cp contrib/asm686/match.S . \\
1752 && CFLAGS="$ZLIB_OPT -DASMV" CC="\$(CC)" \\
1753 ./configure \\
1754@@ -103,7 +103,7 @@
1755
1756 $ZLIB/libz.a: $NGX_MAKEFILE
1757 cd $ZLIB \\
1758- && \$(MAKE) clean \\
1759+ && \$(MAKE) distclean \\
1760 && CFLAGS="$ZLIB_OPT" CC="\$(CC)" \\
1761 ./configure \\
1762 && \$(MAKE) libz.a
1763
1764=== modified file 'auto/modules'
1765--- auto/modules 2009-11-30 13:34:00 +0000
1766+++ auto/modules 2010-07-21 11:15:58 +0000
1767@@ -101,8 +101,8 @@
1768 # ngx_http_range_header_filter
1769 # ngx_http_gzip_filter
1770 # ngx_http_postpone_filter
1771+# ngx_http_ssi_filter
1772 # ngx_http_charset_filter
1773-# ngx_http_ssi_filter
1774 # ngx_http_xslt_filter
1775 # ngx_http_image_filter_filter
1776 # ngx_http_sub_filter
1777@@ -130,19 +130,19 @@
1778 HTTP_SRCS="$HTTP_SRCS $HTTP_POSTPONE_FILTER_SRCS"
1779 fi
1780
1781+if [ $HTTP_SSI = YES ]; then
1782+ have=NGX_HTTP_SSI . auto/have
1783+ HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE"
1784+ HTTP_DEPS="$HTTP_DEPS $HTTP_SSI_DEPS"
1785+ HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS"
1786+fi
1787+
1788 if [ $HTTP_CHARSET = YES ]; then
1789 have=NGX_HTTP_CHARSET . auto/have
1790 HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_CHARSET_FILTER_MODULE"
1791 HTTP_SRCS="$HTTP_SRCS $HTTP_CHARSET_SRCS"
1792 fi
1793
1794-if [ $HTTP_SSI = YES ]; then
1795- have=NGX_HTTP_SSI . auto/have
1796- HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_SSI_FILTER_MODULE"
1797- HTTP_DEPS="$HTTP_DEPS $HTTP_SSI_DEPS"
1798- HTTP_SRCS="$HTTP_SRCS $HTTP_SSI_SRCS"
1799-fi
1800-
1801 if [ $HTTP_XSLT = YES ]; then
1802 USE_LIBXSLT=YES
1803 HTTP_FILTER_MODULES="$HTTP_FILTER_MODULES $HTTP_XSLT_FILTER_MODULE"
1804
1805=== modified file 'auto/unix'
1806--- auto/unix 2009-10-19 23:22:06 +0000
1807+++ auto/unix 2010-07-21 11:15:58 +0000
1808@@ -133,6 +133,16 @@
1809 . auto/feature
1810
1811
1812+ngx_feature="sys_errlist[]"
1813+ngx_feature_name="NGX_HAVE_SYS_ERRLIST"
1814+ngx_feature_run=yes
1815+ngx_feature_incs="#include <stdio.h>"
1816+ngx_feature_path=
1817+ngx_feature_libs=
1818+ngx_feature_test="int n = sys_nerr; const char *p = sys_errlist[1];"
1819+. auto/feature
1820+
1821+
1822 ngx_feature="localtime_r()"
1823 ngx_feature_name="NGX_HAVE_LOCALTIME_R"
1824 ngx_feature_run=no
1825
1826=== added file 'debian/README.Debian'
1827--- debian/README.Debian 1970-01-01 00:00:00 +0000
1828+++ debian/README.Debian 2010-07-21 11:15:58 +0000
1829@@ -0,0 +1,9 @@
1830+README for Debian
1831+-----------------
1832+
1833+ Files under /var/www/ are not supported as per Debian Policy.
1834+ Please see: http://lintian.debian.org/tags/dir-or-file-in-var-www.html and,
1835+ http://www.pathname.com/fhs/pub/fhs-2.3.html#THEVARHIERARCHY for more
1836+ details and explanations.
1837+
1838+ -- Kartik Mistry <kartik@debian.org> Fri, 05 Mar 2010 13:31:15 +0530
1839
1840=== modified file 'debian/changelog'
1841--- debian/changelog 2010-03-05 01:36:05 +0000
1842+++ debian/changelog 2010-07-21 11:15:58 +0000
1843@@ -1,3 +1,104 @@
1844+nginx (0.7.67-2ubuntu1) maverick; urgency=low
1845+
1846+ * Merge from Debian unstable (LP: #608172) Remaining changes:
1847+ + debian/rules:
1848+ with-http_dav_module
1849+ with-http_geoip_module
1850+ with-http_gzip_static_module
1851+ with-http_realip_module
1852+ with-http_sub_module
1853+ + .pc/applied-patches
1854+ fix_reloading_ipv6.diff
1855+
1856+ -- Mikhail Turov <groldster@gmail.com> Wed, 21 Jul 2010 11:57:53 +0100
1857+
1858+nginx (0.7.67-2) unstable; urgency=low
1859+
1860+ * debian/conf/sites-available/default:
1861+ + Removed reference to SSLv2 protocol (Closes: #589139)
1862+ * debian/control:
1863+ + Updated Standards-Version to 3.9.0
1864+ * debian/copyright:
1865+ + Don't point to BSD license file, included exact upstream version of
1866+ license text
1867+ + Added missing copyright owner for contrib/ scripts
1868+ + debian/* license is same as upstream now as discussed with co-maintainers
1869+
1870+ -- Kartik Mistry <kartik@debian.org> Mon, 19 Jul 2010 10:36:32 +0530
1871+
1872+nginx (0.7.67-1) unstable; urgency=low
1873+
1874+ * New upstream release
1875+
1876+ -- Kartik Mistry <kartik@debian.org> Wed, 16 Jun 2010 01:26:51 +0530
1877+
1878+nginx (0.7.65-7) unstable; urgency=low
1879+
1880+ [Kartik Mistry]
1881+ * debian/rules:
1882+ + Enabled HTTPSubModule module in configure (Closes: #584828)
1883+ + Arranged configure options in better manner
1884+
1885+ -- Kartik Mistry <kartik@debian.org> Mon, 07 Jun 2010 14:33:24 +0530
1886+
1887+nginx (0.7.65-6) unstable; urgency=low
1888+
1889+ [Kartik Mistry]
1890+ * debian/README.Debian:
1891+ + Fixed typo and somewhat better wordings
1892+ * debian/conf/mime.types:
1893+ + Added entry to support 7zip files (Closes: #580423)
1894+ * debian/init.d:
1895+ + Do not print config testing info until an error found, Thanks to Ubuntu
1896+ bug 568293
1897+ * debian/copyright:
1898+ + Updated as per DEP-5 specification
1899+
1900+ -- Kartik Mistry <kartik@debian.org> Sat, 22 May 2010 01:41:33 +0530
1901+
1902+nginx (0.7.65-5) unstable; urgency=low
1903+
1904+ [Kartik Mistry]
1905+ * debian/patches/fix_reloading_ipv6.diff:
1906+ + Added patch to fix reloading with IPv6 addresses, Thanks to
1907+ Matthias-Christian Ott <ott@mirix.org> for patch (Closes: #577456)
1908+
1909+ -- Kartik Mistry <kartik@debian.org> Wed, 14 Apr 2010 11:36:48 +0530
1910+
1911+nginx (0.7.65-4) unstable; urgency=low
1912+
1913+ [Kartik Mistry]
1914+ * debian/conf/sites-available/default:
1915+ + Really listen for both IPv4 and IPv6 addresses. Thanks to Nikolaus
1916+ Schulz <microschulz@web.de> for notice (Closes: #574983)
1917+ * debian/control, debian/rules:
1918+ + Added GeoIP support, Thanks to Caetano Carezzato
1919+ <caetano@vision.ime.usp.br> (Closes: #575280)
1920+ * debian/conf/mime.types:
1921+ + Added svg entry to mime.types, Jeremy Lal <kapouer@melix.org>
1922+ (Closes: #575155)
1923+
1924+ -- Kartik Mistry <kartik@debian.org> Thu, 25 Mar 2010 00:21:50 +0530
1925+
1926+nginx (0.7.65-3) unstable; urgency=medium
1927+
1928+ [Kartik Mistry]
1929+ * Urgency set to medium due to Release Goal
1930+ * debian/conf/sites-available/default:
1931+ + Listen for both IPv4 and IPv6 addresses by default (Closes: #574983)
1932+
1933+ -- Kartik Mistry <kartik@debian.org> Tue, 23 Mar 2010 10:30:18 +0530
1934+
1935+nginx (0.7.65-2) unstable; urgency=low
1936+
1937+ * debian/README.Debian:
1938+ + Added explanation about not installing files in /var/www/
1939+ (Closes: #572513)
1940+ * debian/rules:
1941+ + Readded realip module support (Closes: #507419)
1942+
1943+ -- Kartik Mistry <kartik@debian.org> Sat, 06 Mar 2010 13:14:48 +0530
1944+
1945 nginx (0.7.65-1ubuntu2) lucid; urgency=low
1946
1947 * Re-enable http_realip_module (debian/rules).
1948
1949=== modified file 'debian/conf/mime.types'
1950--- debian/conf/mime.types 2007-12-08 11:27:54 +0000
1951+++ debian/conf/mime.types 2010-07-21 11:15:58 +0000
1952@@ -20,6 +20,7 @@
1953 image/x-icon ico;
1954 image/x-jng jng;
1955 image/x-ms-bmp bmp;
1956+ image/svg+xml svg svgz;
1957
1958 application/java-archive jar war ear;
1959 application/mac-binhex40 hqx;
1960@@ -31,6 +32,7 @@
1961 application/vnd.ms-powerpoint ppt;
1962 application/vnd.wap.wmlc wmlc;
1963 application/vnd.wap.xhtml+xml xhtml;
1964+ application/x-7z-compressed 7z;
1965 application/x-cocoa cco;
1966 application/x-java-archive-diff jardiff;
1967 application/x-java-jnlp-file jnlp;
1968
1969=== modified file 'debian/conf/sites-available/default'
1970--- debian/conf/sites-available/default 2010-02-01 23:44:21 +0000
1971+++ debian/conf/sites-available/default 2010-07-21 11:15:58 +0000
1972@@ -5,13 +5,16 @@
1973 # statements for each of your virtual hosts
1974
1975 server {
1976- listen 80 default;
1977+
1978+ listen 80; ## listen for ipv4
1979+ listen [::]:80 default ipv6only=on; ## listen for ipv6
1980+
1981 server_name localhost;
1982
1983 access_log /var/log/nginx/localhost.access.log;
1984
1985 location / {
1986- root /var/www/nginx-default;
1987+ root /var/www;
1988 index index.html index.htm;
1989 }
1990
1991@@ -86,8 +89,8 @@
1992
1993 #ssl_session_timeout 5m;
1994
1995-#ssl_protocols SSLv2 SSLv3 TLSv1;
1996-#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
1997+#ssl_protocols SSLv3 TLSv1;
1998+#ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
1999 #ssl_prefer_server_ciphers on;
2000
2001 #location / {
2002
2003=== modified file 'debian/control'
2004--- debian/control 2010-03-03 23:50:36 +0000
2005+++ debian/control 2010-07-21 11:15:58 +0000
2006@@ -7,10 +7,11 @@
2007 Kartik Mistry <kartik@debian.org>
2008 Build-Depends: debhelper (>= 7),
2009 autotools-dev,
2010+ libgeoip-dev,
2011 libssl-dev,
2012 libpcre3-dev,
2013 zlib1g-dev
2014-Standards-Version: 3.8.4
2015+Standards-Version: 3.9.0
2016 Homepage: http://nginx.net
2017 Vcs-Svn: svn://svn.debian.org/svn/collab-maint/deb-maint/nginx/trunk
2018 Vcs-Browser: http://svn.debian.org/wsvn/collab-maint/deb-maint/nginx/trunk
2019
2020=== modified file 'debian/copyright'
2021--- debian/copyright 2010-02-05 11:20:28 +0000
2022+++ debian/copyright 2010-07-21 11:15:58 +0000
2023@@ -1,39 +1,40 @@
2024-This package was debianized by Jose Parrella <joseparrella@cantv.net> on
2025-Tue, 5 Sep 2006 11:33:34 -0400.
2026-
2027-It was downloaded from http://nginx.net/
2028-
2029+Format-Specification: http://svn.debian.org/wsvn/dep/web/deps/dep5.mdwn?op=file&rev=135
2030+Name: nginx
2031+Maintainer: Jose Parrella <joseparrella@cantv.net>
2032+Source: http://nginx.net/
2033 Upstream Author: Igor Sysoev <igor@sysoev.ru>
2034
2035-Copyright © 2002-2010 Igor Sysoev <igor@sysoev.ru>
2036-
2037+Files: *
2038+Copyright: © 2002-2010, Igor Sysoev <igor@sysoev.ru>
2039 License: BSD
2040-
2041- Redistribution and use in source and binary forms, with or without
2042- modification, are permitted provided that the following conditions
2043- are met:
2044- 1. Redistributions of source code must retain the above copyright
2045- notice, this list of conditions and the following disclaimer.
2046- 2. Redistributions in binary form must reproduce the above copyright
2047- notice, this list of conditions and the following disclaimer in the
2048- documentation and/or other materials provided with the distribution.
2049-
2050- THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
2051- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
2052- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
2053- ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
2054- FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2055- DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2056- OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2057- HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2058- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2059- OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2060- SUCH DAMAGE.
2061-
2062-On Debian systems, the complete text of the BSD License can be found in
2063-`/usr/share/common-licenses/BSD'.
2064-
2065-The Debian packaging is © 2006-2010, Jose Parrella <joseparrella@cantv.net>,
2066-Fabio Tranchitella <kobold@debian.org> and © 2009-2010, Kartik Mistry
2067-<kartik@debian.org> and is licensed under the GPL-2 or later, see
2068-`/usr/share/common-licenses/GPL-2' and `/usr/share/common-licenses/GPL-3'.
2069+ Redistribution and use in source and binary forms, with or without
2070+ modification, are permitted provided that the following conditions are met:
2071+ .
2072+ 1. Redistributions of source code must retain the above copyright notice, this
2073+ list of conditions and the following disclaimer.
2074+ 2. Redistributions in binary form must reproduce the above copyright notice,
2075+ this list of conditions and the following disclaimer in the documentation
2076+ and/or other materials provided with the distribution.
2077+ .
2078+ THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
2079+ EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2080+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2081+ DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
2082+ DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2083+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2084+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
2085+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2086+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2087+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2088+
2089+Files: contrib/geo2nginx.pl
2090+Copyright: © 2005, Andrei Nigmatulin
2091+
2092+Files: modules/nginx-upstream-fair/ngx_http_upstream_fair_module.c
2093+Copyright: © 2007, Igor Sysoev, Grzegorz Nosek
2094+
2095+Files: debian/*
2096+Copyright: © 2006-2010, Jose Parrella <joseparrella@cantv.net>,
2097+ Fabio Tranchitella <kobold@debian.org>
2098+ © 2009-2010, Kartik Mistry <kartik@debian.org>
2099+License: Same as upstream license.
2100
2101=== modified file 'debian/init.d'
2102--- debian/init.d 2010-03-03 23:50:36 +0000
2103+++ debian/init.d 2010-07-21 11:15:58 +0000
2104@@ -27,10 +27,11 @@
2105 . /lib/lsb/init-functions
2106
2107 test_nginx_config() {
2108- if nginx -t $DAEMON_OPTS
2109+ if $DAEMON -t $DAEMON_OPTS >/dev/null 2>&1
2110 then
2111 return 0
2112 else
2113+ $DAEMON -t $DAEMON_OPTS
2114 return $?
2115 fi
2116 }
2117
2118=== added file 'debian/patches/fix_reloading_ipv6.diff'
2119--- debian/patches/fix_reloading_ipv6.diff 1970-01-01 00:00:00 +0000
2120+++ debian/patches/fix_reloading_ipv6.diff 2010-07-21 11:15:58 +0000
2121@@ -0,0 +1,15 @@
2122+Description: Patch to fix reloading IPv6 addresses
2123+Debian Bug: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=577456
2124+Author: Matthias-Christian Ott <ott@mirix.org>
2125+
2126+--- nginx-0.7.65.orig/src/core/ngx_cycle.c 2010-04-13 10:07:14.000000000 +0530
2127++++ nginx-0.7.65/src/core/ngx_cycle.c 2010-04-13 10:09:59.000000000 +0530
2128+@@ -847,7 +847,7 @@
2129+ sin61 = (struct sockaddr_in6 *) sa1;
2130+ sin62 = (struct sockaddr_in6 *) sa2;
2131+
2132+- if (sin61->sin6_port != sin61->sin6_port) {
2133++ if (sin61->sin6_port != sin62->sin6_port) {
2134+ return NGX_DECLINED;
2135+ }
2136+
2137
2138=== modified file 'debian/patches/nginx-upstream-fair.diff' (properties changed: +x to -x)
2139=== modified file 'debian/patches/series'
2140--- debian/patches/series 2010-02-01 23:44:21 +0000
2141+++ debian/patches/series 2010-07-21 11:15:58 +0000
2142@@ -1,2 +1,3 @@
2143 nginx-upstream-fair.diff
2144 dlopen.diff
2145+fix_reloading_ipv6.diff
2146
2147=== modified file 'debian/rules'
2148--- debian/rules 2010-03-05 01:36:05 +0000
2149+++ debian/rules 2010-07-21 11:15:58 +0000
2150@@ -23,19 +23,24 @@
2151 endif
2152 ./configure --conf-path=/etc/nginx/nginx.conf \
2153 --error-log-path=/var/log/nginx/error.log \
2154- --pid-path=/var/run/nginx.pid \
2155- --lock-path=/var/lock/nginx.lock \
2156+ --http-client-body-temp-path=/var/lib/nginx/body \
2157+ --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
2158 --http-log-path=/var/log/nginx/access.log \
2159- --http-client-body-temp-path=/var/lib/nginx/body \
2160 --http-proxy-temp-path=/var/lib/nginx/proxy \
2161- --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
2162+ --lock-path=/var/lock/nginx.lock \
2163+ --pid-path=/var/run/nginx.pid \
2164 --with-debug \
2165+ --with-http_dav_module \
2166+ --with-http_flv_module \
2167+ --with-http_geoip_module \
2168+ --with-http_gzip_static_module \
2169+ --with-http_realip_module \
2170 --with-http_stub_status_module \
2171- --with-http_flv_module \
2172 --with-http_ssl_module \
2173 --with-http_dav_module \
2174 --with-http_gzip_static_module \
2175 --with-http_realip_module \
2176+ --with-http_sub_module \
2177 --with-mail \
2178 --with-mail_ssl_module \
2179 --with-ipv6 \
2180
2181=== modified file 'src/core/nginx.h'
2182--- src/core/nginx.h 2010-03-03 23:50:36 +0000
2183+++ src/core/nginx.h 2010-07-21 11:15:58 +0000
2184@@ -8,8 +8,8 @@
2185 #define _NGINX_H_INCLUDED_
2186
2187
2188-#define nginx_version 7065
2189-#define NGINX_VERSION "0.7.65"
2190+#define nginx_version 7067
2191+#define NGINX_VERSION "0.7.67"
2192 #define NGINX_VER "nginx/" NGINX_VERSION
2193
2194 #define NGINX_VAR "NGINX"
2195
2196=== modified file 'src/core/ngx_cycle.c'
2197--- src/core/ngx_cycle.c 2009-11-30 13:34:00 +0000
2198+++ src/core/ngx_cycle.c 2010-07-21 11:15:58 +0000
2199@@ -63,7 +63,7 @@
2200 tp = ngx_timeofday();
2201 tp->sec = 0;
2202
2203- ngx_time_update(0, 0);
2204+ ngx_time_update();
2205
2206
2207 log = old_cycle->log;
2208@@ -847,7 +847,7 @@
2209 sin61 = (struct sockaddr_in6 *) sa1;
2210 sin62 = (struct sockaddr_in6 *) sa2;
2211
2212- if (sin61->sin6_port != sin61->sin6_port) {
2213+ if (sin61->sin6_port != sin62->sin6_port) {
2214 return NGX_DECLINED;
2215 }
2216
2217
2218=== modified file 'src/core/ngx_file.c'
2219--- src/core/ngx_file.c 2010-03-03 23:50:36 +0000
2220+++ src/core/ngx_file.c 2010-07-21 11:15:58 +0000
2221@@ -762,10 +762,12 @@
2222 size -= n;
2223 }
2224
2225- if (ngx_set_file_time(to, nfd, cf->time) != NGX_OK) {
2226- ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
2227- ngx_set_file_time_n " \"%s\" failed", to);
2228- goto failed;
2229+ if (cf->time != -1) {
2230+ if (ngx_set_file_time(to, nfd, cf->time) != NGX_OK) {
2231+ ngx_log_error(NGX_LOG_ALERT, cf->log, ngx_errno,
2232+ ngx_set_file_time_n " \"%s\" failed", to);
2233+ goto failed;
2234+ }
2235 }
2236
2237 rc = NGX_OK;
2238
2239=== modified file 'src/core/ngx_open_file_cache.c'
2240--- src/core/ngx_open_file_cache.c 2010-03-03 23:50:36 +0000
2241+++ src/core/ngx_open_file_cache.c 2010-07-21 11:15:58 +0000
2242@@ -487,7 +487,14 @@
2243 }
2244
2245 if (!of->log) {
2246- fd = ngx_open_file(name, NGX_FILE_RDONLY, NGX_FILE_OPEN, 0);
2247+
2248+ /*
2249+ * Use non-blocking open() not to hang on FIFO files, etc.
2250+ * This flag has no effect on a regular files.
2251+ */
2252+
2253+ fd = ngx_open_file(name, NGX_FILE_RDONLY|NGX_FILE_NONBLOCK,
2254+ NGX_FILE_OPEN, 0);
2255
2256 } else {
2257 fd = ngx_open_file(name, NGX_FILE_APPEND, NGX_FILE_CREATE_OR_OPEN,
2258
2259=== modified file 'src/core/ngx_string.c'
2260--- src/core/ngx_string.c 2010-03-03 23:50:36 +0000
2261+++ src/core/ngx_string.c 2010-07-21 11:15:58 +0000
2262@@ -1277,13 +1277,13 @@
2263 0xffffffff /* 1111 1111 1111 1111 1111 1111 1111 1111 */
2264 };
2265
2266- /* " ", "#", "%", "+", "?", %00-%1F, %7F-%FF */
2267+ /* " ", "#", "%", "&", "+", "?", %00-%1F, %7F-%FF */
2268
2269 static uint32_t args[] = {
2270 0xffffffff, /* 1111 1111 1111 1111 1111 1111 1111 1111 */
2271
2272 /* ?>=< ;:98 7654 3210 /.-, +*)( '&%$ #"! */
2273- 0x80000829, /* 1000 0000 0000 0000 0000 1000 0010 1001 */
2274+ 0x80000869, /* 1000 0000 0000 0000 0000 1000 0110 1001 */
2275
2276 /* _^]\ [ZYX WVUT SRQP ONML KJIH GFED CBA@ */
2277 0x00000000, /* 0000 0000 0000 0000 0000 0000 0000 0000 */
2278
2279=== modified file 'src/core/ngx_times.c'
2280--- src/core/ngx_times.c 2009-10-19 23:22:06 +0000
2281+++ src/core/ngx_times.c 2010-07-21 11:15:58 +0000
2282@@ -28,6 +28,17 @@
2283 volatile ngx_str_t ngx_cached_http_time;
2284 volatile ngx_str_t ngx_cached_http_log_time;
2285
2286+#if !(NGX_WIN32)
2287+
2288+/*
2289+ * locatime() and localtime_r() are not Async-Signal-Safe functions, therefore,
2290+ * they must not be called by a signal handler, so we use the cached
2291+ * GMT offset value. Fortunately the value is changed only two times a year.
2292+ */
2293+
2294+static ngx_int_t cached_gmtoff;
2295+#endif
2296+
2297 static ngx_time_t cached_time[NGX_TIME_SLOTS];
2298 static u_char cached_err_log_time[NGX_TIME_SLOTS]
2299 [sizeof("1970/09/28 12:00:00")];
2300@@ -50,15 +61,17 @@
2301
2302 ngx_cached_time = &cached_time[0];
2303
2304- ngx_time_update(0, 0);
2305+ ngx_time_update();
2306 }
2307
2308
2309 void
2310-ngx_time_update(time_t sec, ngx_uint_t msec)
2311+ngx_time_update(void)
2312 {
2313 u_char *p0, *p1, *p2;
2314 ngx_tm_t tm, gmt;
2315+ time_t sec;
2316+ ngx_uint_t msec;
2317 ngx_time_t *tp;
2318 struct timeval tv;
2319
2320@@ -66,12 +79,10 @@
2321 return;
2322 }
2323
2324- if (sec == 0) {
2325- ngx_gettimeofday(&tv);
2326+ ngx_gettimeofday(&tv);
2327
2328- sec = tv.tv_sec;
2329- msec = tv.tv_usec / 1000;
2330- }
2331+ sec = tv.tv_sec;
2332+ msec = tv.tv_usec / 1000;
2333
2334 ngx_current_msec = (ngx_msec_t) sec * 1000 + msec;
2335
2336@@ -112,12 +123,14 @@
2337 #elif (NGX_HAVE_GMTOFF)
2338
2339 ngx_localtime(sec, &tm);
2340- tp->gmtoff = (ngx_int_t) (tm.ngx_tm_gmtoff / 60);
2341+ cached_gmtoff = (ngx_int_t) (tm.ngx_tm_gmtoff / 60);
2342+ tp->gmtoff = cached_gmtoff;
2343
2344 #else
2345
2346 ngx_localtime(sec, &tm);
2347- tp->gmtoff = ngx_timezone(tm.ngx_tm_isdst);
2348+ cached_gmtoff = ngx_timezone(tm.ngx_tm_isdst);
2349+ tp->gmtoff = cached_gmtoff;
2350
2351 #endif
2352
2353@@ -151,6 +164,57 @@
2354 }
2355
2356
2357+#if !(NGX_WIN32)
2358+
2359+void
2360+ngx_time_sigsafe_update(void)
2361+{
2362+ u_char *p;
2363+ ngx_tm_t tm;
2364+ time_t sec;
2365+ ngx_time_t *tp;
2366+ struct timeval tv;
2367+
2368+ if (!ngx_trylock(&ngx_time_lock)) {
2369+ return;
2370+ }
2371+
2372+ ngx_gettimeofday(&tv);
2373+
2374+ sec = tv.tv_sec;
2375+
2376+ tp = &cached_time[slot];
2377+
2378+ if (tp->sec == sec) {
2379+ ngx_unlock(&ngx_time_lock);
2380+ return;
2381+ }
2382+
2383+ if (slot == NGX_TIME_SLOTS - 1) {
2384+ slot = 0;
2385+ } else {
2386+ slot++;
2387+ }
2388+
2389+ ngx_gmtime(sec + cached_gmtoff * 60, &tm);
2390+
2391+ p = &cached_err_log_time[slot][0];
2392+
2393+ (void) ngx_sprintf(p, "%4d/%02d/%02d %02d:%02d:%02d",
2394+ tm.ngx_tm_year, tm.ngx_tm_mon,
2395+ tm.ngx_tm_mday, tm.ngx_tm_hour,
2396+ tm.ngx_tm_min, tm.ngx_tm_sec);
2397+
2398+ ngx_memory_barrier();
2399+
2400+ ngx_cached_err_log_time.data = p;
2401+
2402+ ngx_unlock(&ngx_time_lock);
2403+}
2404+
2405+#endif
2406+
2407+
2408 u_char *
2409 ngx_http_time(u_char *buf, time_t t)
2410 {
2411
2412=== modified file 'src/core/ngx_times.h'
2413--- src/core/ngx_times.h 2009-10-19 23:22:06 +0000
2414+++ src/core/ngx_times.h 2010-07-21 11:15:58 +0000
2415@@ -20,7 +20,8 @@
2416
2417
2418 void ngx_time_init(void);
2419-void ngx_time_update(time_t sec, ngx_uint_t msec);
2420+void ngx_time_update(void);
2421+void ngx_time_sigsafe_update(void);
2422 u_char *ngx_http_time(u_char *buf, time_t t);
2423 u_char *ngx_http_cookie_time(u_char *buf, time_t t);
2424 void ngx_gmtime(time_t t, ngx_tm_t *tp);
2425
2426=== modified file 'src/event/modules/ngx_devpoll_module.c'
2427--- src/event/modules/ngx_devpoll_module.c 2009-11-08 09:53:46 +0000
2428+++ src/event/modules/ngx_devpoll_module.c 2010-07-21 11:15:58 +0000
2429@@ -375,8 +375,8 @@
2430 err = 0;
2431 }
2432
2433- if (flags & NGX_UPDATE_TIME) {
2434- ngx_time_update(0, 0);
2435+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
2436+ ngx_time_update();
2437 }
2438
2439 if (err) {
2440
2441=== modified file 'src/event/modules/ngx_epoll_module.c'
2442--- src/event/modules/ngx_epoll_module.c 2009-11-08 09:53:46 +0000
2443+++ src/event/modules/ngx_epoll_module.c 2010-07-21 11:15:58 +0000
2444@@ -407,8 +407,8 @@
2445 err = 0;
2446 }
2447
2448- if (flags & NGX_UPDATE_TIME) {
2449- ngx_time_update(0, 0);
2450+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
2451+ ngx_time_update();
2452 }
2453
2454 if (err) {
2455
2456=== modified file 'src/event/modules/ngx_eventport_module.c'
2457--- src/event/modules/ngx_eventport_module.c 2009-11-08 09:53:46 +0000
2458+++ src/event/modules/ngx_eventport_module.c 2010-07-21 11:15:58 +0000
2459@@ -405,7 +405,7 @@
2460 err = ngx_errno;
2461
2462 if (flags & NGX_UPDATE_TIME) {
2463- ngx_time_update(0, 0);
2464+ ngx_time_update();
2465 }
2466
2467 if (n == -1) {
2468@@ -439,7 +439,7 @@
2469 for (i = 0; i < events; i++) {
2470
2471 if (event_list[i].portev_source == PORT_SOURCE_TIMER) {
2472- ngx_time_update(0, 0);
2473+ ngx_time_update();
2474 continue;
2475 }
2476
2477
2478=== modified file 'src/event/modules/ngx_kqueue_module.c'
2479--- src/event/modules/ngx_kqueue_module.c 2009-11-30 13:34:00 +0000
2480+++ src/event/modules/ngx_kqueue_module.c 2010-07-21 11:15:58 +0000
2481@@ -543,8 +543,8 @@
2482 err = 0;
2483 }
2484
2485- if (flags & NGX_UPDATE_TIME) {
2486- ngx_time_update(0, 0);
2487+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
2488+ ngx_time_update();
2489 }
2490
2491 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
2492@@ -595,7 +595,7 @@
2493 #if (NGX_HAVE_TIMER_EVENT)
2494
2495 if (event_list[i].filter == EVFILT_TIMER) {
2496- ngx_time_update(0, 0);
2497+ ngx_time_update();
2498 continue;
2499 }
2500
2501
2502=== modified file 'src/event/modules/ngx_poll_module.c'
2503--- src/event/modules/ngx_poll_module.c 2007-12-08 11:27:54 +0000
2504+++ src/event/modules/ngx_poll_module.c 2010-07-21 11:15:58 +0000
2505@@ -266,8 +266,8 @@
2506 err = 0;
2507 }
2508
2509- if (flags & NGX_UPDATE_TIME) {
2510- ngx_time_update(0, 0);
2511+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
2512+ ngx_time_update();
2513 }
2514
2515 ngx_log_debug2(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
2516
2517=== modified file 'src/event/modules/ngx_rtsig_module.c'
2518--- src/event/modules/ngx_rtsig_module.c 2009-11-08 09:53:46 +0000
2519+++ src/event/modules/ngx_rtsig_module.c 2010-07-21 11:15:58 +0000
2520@@ -323,7 +323,7 @@
2521 "rtsig signo:%d", signo);
2522
2523 if (flags & NGX_UPDATE_TIME) {
2524- ngx_time_update(0, 0);
2525+ ngx_time_update();
2526 }
2527
2528 if (err == NGX_EAGAIN) {
2529@@ -349,7 +349,7 @@
2530 signo, si.si_fd, si.si_band);
2531
2532 if (flags & NGX_UPDATE_TIME) {
2533- ngx_time_update(0, 0);
2534+ ngx_time_update();
2535 }
2536
2537 rtscf = ngx_event_get_conf(ngx_cycle->conf_ctx, ngx_rtsig_module);
2538@@ -419,7 +419,7 @@
2539
2540 } else if (signo == SIGALRM) {
2541
2542- ngx_time_update(0, 0);
2543+ ngx_time_update();
2544
2545 return NGX_OK;
2546
2547@@ -671,7 +671,7 @@
2548 }
2549
2550 if (flags & NGX_UPDATE_TIME) {
2551- ngx_time_update(0, 0);
2552+ ngx_time_update();
2553 }
2554
2555 ngx_log_error(NGX_LOG_ALERT, cycle->log, 0,
2556
2557=== modified file 'src/event/modules/ngx_select_module.c'
2558--- src/event/modules/ngx_select_module.c 2009-10-19 23:22:06 +0000
2559+++ src/event/modules/ngx_select_module.c 2010-07-21 11:15:58 +0000
2560@@ -266,8 +266,8 @@
2561 err = 0;
2562 }
2563
2564- if (flags & NGX_UPDATE_TIME) {
2565- ngx_time_update(0, 0);
2566+ if (flags & NGX_UPDATE_TIME || ngx_event_timer_alarm) {
2567+ ngx_time_update();
2568 }
2569
2570 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
2571
2572=== modified file 'src/event/modules/ngx_win32_select_module.c'
2573--- src/event/modules/ngx_win32_select_module.c 2009-10-19 23:22:06 +0000
2574+++ src/event/modules/ngx_win32_select_module.c 2010-07-21 11:15:58 +0000
2575@@ -273,7 +273,7 @@
2576 }
2577
2578 if (flags & NGX_UPDATE_TIME) {
2579- ngx_time_update(0, 0);
2580+ ngx_time_update();
2581 }
2582
2583 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
2584
2585=== modified file 'src/event/ngx_event.c'
2586--- src/event/ngx_event.c 2009-11-30 13:34:00 +0000
2587+++ src/event/ngx_event.c 2010-07-21 11:15:58 +0000
2588@@ -562,8 +562,6 @@
2589 {
2590 ngx_event_timer_alarm = 1;
2591
2592- ngx_time_update(0, 0);
2593-
2594 #if 1
2595 ngx_log_debug0(NGX_LOG_DEBUG_EVENT, ngx_cycle->log, 0, "timer signal");
2596 #endif
2597
2598=== modified file 'src/event/ngx_event_openssl.c'
2599--- src/event/ngx_event_openssl.c 2010-03-03 23:50:36 +0000
2600+++ src/event/ngx_event_openssl.c 2010-07-21 11:15:58 +0000
2601@@ -106,6 +106,8 @@
2602
2603 ENGINE_load_builtin_engines();
2604
2605+ OpenSSL_add_all_algorithms();
2606+
2607 ngx_ssl_connection_index = SSL_get_ex_new_index(0, NULL, NULL, NULL, NULL);
2608
2609 if (ngx_ssl_connection_index == -1) {
2610@@ -559,6 +561,9 @@
2611 #if (NGX_DEBUG)
2612 {
2613 char buf[129], *s, *d;
2614+#if OPENSSL_VERSION_NUMBER >= 0x1000000fL
2615+ const
2616+#endif
2617 SSL_CIPHER *cipher;
2618
2619 cipher = SSL_get_current_cipher(c->ssl->connection);
2620@@ -1308,10 +1313,14 @@
2621
2622 /* handshake failures */
2623 if (n == SSL_R_DIGEST_CHECK_FAILED /* 149 */
2624+ || n == SSL_R_LENGTH_MISMATCH /* 159 */
2625 || n == SSL_R_NO_CIPHERS_PASSED /* 182 */
2626+ || n == SSL_R_NO_CIPHERS_SPECIFIED /* 183 */
2627 || n == SSL_R_NO_SHARED_CIPHER /* 193 */
2628+ || n == SSL_R_RECORD_LENGTH_MISMATCH /* 213 */
2629 || n == SSL_R_UNEXPECTED_MESSAGE /* 244 */
2630 || n == SSL_R_UNEXPECTED_RECORD /* 245 */
2631+ || n == SSL_R_UNKNOWN_ALERT_TYPE /* 246 */
2632 || n == SSL_R_UNKNOWN_PROTOCOL /* 252 */
2633 || n == SSL_R_WRONG_VERSION_NUMBER /* 267 */
2634 || n == SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC /* 281 */
2635@@ -1424,6 +1433,8 @@
2636 return NGX_OK;
2637 }
2638
2639+ SSL_CTX_set_session_id_context(ssl->ctx, sess_ctx->data, sess_ctx->len);
2640+
2641 if (builtin_session_cache == NGX_SSL_NONE_SCACHE) {
2642
2643 /*
2644@@ -1455,8 +1466,6 @@
2645
2646 SSL_CTX_set_session_cache_mode(ssl->ctx, cache_mode);
2647
2648- SSL_CTX_set_session_id_context(ssl->ctx, sess_ctx->data, sess_ctx->len);
2649-
2650 if (builtin_session_cache != NGX_SSL_NO_BUILTIN_SCACHE) {
2651
2652 if (builtin_session_cache != NGX_SSL_DFLT_BUILTIN_SCACHE) {
2653@@ -2311,5 +2320,6 @@
2654 static void
2655 ngx_openssl_exit(ngx_cycle_t *cycle)
2656 {
2657+ EVP_cleanup();
2658 ENGINE_cleanup();
2659 }
2660
2661=== modified file 'src/event/ngx_event_openssl.h'
2662--- src/event/ngx_event_openssl.h 2010-03-03 23:50:36 +0000
2663+++ src/event/ngx_event_openssl.h 2010-07-21 11:15:58 +0000
2664@@ -15,6 +15,7 @@
2665 #include <openssl/err.h>
2666 #include <openssl/conf.h>
2667 #include <openssl/engine.h>
2668+#include <openssl/evp.h>
2669
2670 #define NGX_SSL_NAME "OpenSSL"
2671
2672
2673=== modified file 'src/http/modules/ngx_http_autoindex_module.c'
2674--- src/http/modules/ngx_http_autoindex_module.c 2009-11-30 13:34:00 +0000
2675+++ src/http/modules/ngx_http_autoindex_module.c 2010-07-21 11:15:58 +0000
2676@@ -160,10 +160,6 @@
2677 return NGX_DECLINED;
2678 }
2679
2680- if (r->zero_in_uri) {
2681- return NGX_DECLINED;
2682- }
2683-
2684 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD))) {
2685 return NGX_DECLINED;
2686 }
2687
2688=== modified file 'src/http/modules/ngx_http_chunked_filter_module.c'
2689--- src/http/modules/ngx_http_chunked_filter_module.c 2009-10-19 23:22:06 +0000
2690+++ src/http/modules/ngx_http_chunked_filter_module.c 2010-07-21 11:15:58 +0000
2691@@ -50,9 +50,10 @@
2692 static ngx_int_t
2693 ngx_http_chunked_header_filter(ngx_http_request_t *r)
2694 {
2695+ ngx_http_core_loc_conf_t *clcf;
2696+
2697 if (r->headers_out.status == NGX_HTTP_NOT_MODIFIED
2698 || r->headers_out.status == NGX_HTTP_NO_CONTENT
2699- || r->headers_out.status == NGX_HTTP_CREATED
2700 || r != r->main
2701 || (r->method & NGX_HTTP_HEAD))
2702 {
2703@@ -64,7 +65,14 @@
2704 r->keepalive = 0;
2705
2706 } else {
2707- r->chunked = 1;
2708+ clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
2709+
2710+ if (clcf->chunked_transfer_encoding) {
2711+ r->chunked = 1;
2712+
2713+ } else {
2714+ r->keepalive = 0;
2715+ }
2716 }
2717 }
2718
2719
2720=== modified file 'src/http/modules/ngx_http_dav_module.c'
2721--- src/http/modules/ngx_http_dav_module.c 2009-11-30 13:34:00 +0000
2722+++ src/http/modules/ngx_http_dav_module.c 2010-07-21 11:15:58 +0000
2723@@ -146,10 +146,6 @@
2724 ngx_int_t rc;
2725 ngx_http_dav_loc_conf_t *dlcf;
2726
2727- if (r->zero_in_uri) {
2728- return NGX_DECLINED;
2729- }
2730-
2731 dlcf = ngx_http_get_module_loc_conf(r, ngx_http_dav_module);
2732
2733 if (!(r->method & dlcf->methods)) {
2734@@ -325,13 +321,13 @@
2735 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2736 "http delete filename: \"%s\"", path.data);
2737
2738- if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
2739+ if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
2740 err = ngx_errno;
2741
2742 rc = (err == NGX_ENOTDIR) ? NGX_HTTP_CONFLICT : NGX_HTTP_NOT_FOUND;
2743
2744 return ngx_http_dav_error(r->connection->log, err,
2745- rc, ngx_file_info_n, path.data);
2746+ rc, ngx_link_info_n, path.data);
2747 }
2748
2749 if (ngx_is_dir(&fi)) {
2750@@ -358,7 +354,7 @@
2751
2752 /*
2753 * we do not need to test (r->uri.data[r->uri.len - 1] == '/')
2754- * because ngx_file_info("/file/") returned NGX_ENOTDIR above
2755+ * because ngx_link_info("/file/") returned NGX_ENOTDIR above
2756 */
2757
2758 depth = ngx_http_dav_depth(r, 0);
2759@@ -685,12 +681,12 @@
2760 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
2761 "http copy to: \"%s\"", copy.path.data);
2762
2763- if (ngx_file_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
2764+ if (ngx_link_info(copy.path.data, &fi) == NGX_FILE_ERROR) {
2765 err = ngx_errno;
2766
2767 if (err != NGX_ENOENT) {
2768 return ngx_http_dav_error(r->connection->log, err,
2769- NGX_HTTP_NOT_FOUND, ngx_file_info_n,
2770+ NGX_HTTP_NOT_FOUND, ngx_link_info_n,
2771 copy.path.data);
2772 }
2773
2774@@ -719,9 +715,9 @@
2775 dir = ngx_is_dir(&fi);
2776 }
2777
2778- if (ngx_file_info(path.data, &fi) == NGX_FILE_ERROR) {
2779+ if (ngx_link_info(path.data, &fi) == NGX_FILE_ERROR) {
2780 return ngx_http_dav_error(r->connection->log, ngx_errno,
2781- NGX_HTTP_NOT_FOUND, ngx_file_info_n,
2782+ NGX_HTTP_NOT_FOUND, ngx_link_info_n,
2783 path.data);
2784 }
2785
2786
2787=== modified file 'src/http/modules/ngx_http_fastcgi_module.c'
2788--- src/http/modules/ngx_http_fastcgi_module.c 2010-03-03 23:50:36 +0000
2789+++ src/http/modules/ngx_http_fastcgi_module.c 2010-07-21 11:15:58 +0000
2790@@ -333,6 +333,13 @@
2791 0,
2792 &ngx_http_fastcgi_module },
2793
2794+ { ngx_string("fastcgi_no_cache"),
2795+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
2796+ ngx_http_no_cache_set_slot,
2797+ NGX_HTTP_LOC_CONF_OFFSET,
2798+ offsetof(ngx_http_fastcgi_loc_conf_t, upstream.no_cache),
2799+ NULL },
2800+
2801 { ngx_string("fastcgi_cache_valid"),
2802 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
2803 ngx_http_file_cache_valid_set_slot,
2804@@ -1890,6 +1897,7 @@
2805 #if (NGX_HTTP_CACHE)
2806 conf->upstream.cache = NGX_CONF_UNSET_PTR;
2807 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
2808+ conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
2809 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
2810 #endif
2811
2812@@ -2111,6 +2119,9 @@
2813
2814 conf->upstream.cache_methods |= NGX_HTTP_GET|NGX_HTTP_HEAD;
2815
2816+ ngx_conf_merge_ptr_value(conf->upstream.no_cache,
2817+ prev->upstream.no_cache, NULL);
2818+
2819 ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
2820 prev->upstream.cache_valid, NULL);
2821
2822
2823=== modified file 'src/http/modules/ngx_http_flv_module.c'
2824--- src/http/modules/ngx_http_flv_module.c 2009-10-19 23:22:06 +0000
2825+++ src/http/modules/ngx_http_flv_module.c 2010-07-21 11:15:58 +0000
2826@@ -80,10 +80,6 @@
2827 return NGX_DECLINED;
2828 }
2829
2830- if (r->zero_in_uri) {
2831- return NGX_DECLINED;
2832- }
2833-
2834 rc = ngx_http_discard_request_body(r);
2835
2836 if (rc != NGX_OK) {
2837
2838=== modified file 'src/http/modules/ngx_http_geo_module.c'
2839--- src/http/modules/ngx_http_geo_module.c 2009-11-30 13:34:00 +0000
2840+++ src/http/modules/ngx_http_geo_module.c 2010-07-21 11:15:58 +0000
2841@@ -589,7 +589,7 @@
2842 ngx_array_t *a;
2843 ngx_http_geo_range_t *range;
2844
2845- for (n = start; n <= end; n += 0x10000) {
2846+ for (n = start; n <= end; n = (n + 0x10000) & 0xffff0000) {
2847
2848 h = n >> 16;
2849
2850
2851=== modified file 'src/http/modules/ngx_http_geoip_module.c'
2852--- src/http/modules/ngx_http_geoip_module.c 2009-11-08 09:53:46 +0000
2853+++ src/http/modules/ngx_http_geoip_module.c 2010-07-21 11:15:58 +0000
2854@@ -30,6 +30,9 @@
2855 ngx_http_variable_value_t *v, uintptr_t data);
2856 static ngx_int_t ngx_http_geoip_city_variable(ngx_http_request_t *r,
2857 ngx_http_variable_value_t *v, uintptr_t data);
2858+static ngx_int_t ngx_http_geoip_city_float_variable(ngx_http_request_t *r,
2859+ ngx_http_variable_value_t *v, uintptr_t data);
2860+static GeoIPRecord *ngx_http_geoip_get_city_record(ngx_http_request_t *r);
2861
2862 static ngx_int_t ngx_http_geoip_add_variables(ngx_conf_t *cf);
2863 static void *ngx_http_geoip_create_conf(ngx_conf_t *cf);
2864@@ -93,23 +96,32 @@
2865
2866 static ngx_http_variable_t ngx_http_geoip_vars[] = {
2867
2868- { ngx_string("geoip_country_code"), NULL, ngx_http_geoip_country_variable,
2869+ { ngx_string("geoip_country_code"), NULL,
2870+ ngx_http_geoip_country_variable,
2871 (uintptr_t) GeoIP_country_code_by_ipnum, 0, 0 },
2872
2873- { ngx_string("geoip_country_code3"), NULL, ngx_http_geoip_country_variable,
2874+ { ngx_string("geoip_country_code3"), NULL,
2875+ ngx_http_geoip_country_variable,
2876 (uintptr_t) GeoIP_country_code3_by_ipnum, 0, 0 },
2877
2878- { ngx_string("geoip_country_name"), NULL, ngx_http_geoip_country_variable,
2879+ { ngx_string("geoip_country_name"), NULL,
2880+ ngx_http_geoip_country_variable,
2881 (uintptr_t) GeoIP_country_name_by_ipnum, 0, 0 },
2882
2883- { ngx_string("geoip_city_country_code"), NULL, ngx_http_geoip_city_variable,
2884+ { ngx_string("geoip_city_continent_code"), NULL,
2885+ ngx_http_geoip_city_variable,
2886+ offsetof(GeoIPRecord, continent_code), 0, 0 },
2887+
2888+ { ngx_string("geoip_city_country_code"), NULL,
2889+ ngx_http_geoip_city_variable,
2890 offsetof(GeoIPRecord, country_code), 0, 0 },
2891
2892 { ngx_string("geoip_city_country_code3"), NULL,
2893 ngx_http_geoip_city_variable,
2894 offsetof(GeoIPRecord, country_code3), 0, 0 },
2895
2896- { ngx_string("geoip_city_country_name"), NULL, ngx_http_geoip_city_variable,
2897+ { ngx_string("geoip_city_country_name"), NULL,
2898+ ngx_http_geoip_city_variable,
2899 offsetof(GeoIPRecord, country_name), 0, 0 },
2900
2901 { ngx_string("geoip_region"), NULL,
2902@@ -124,6 +136,14 @@
2903 ngx_http_geoip_city_variable,
2904 offsetof(GeoIPRecord, postal_code), 0, 0 },
2905
2906+ { ngx_string("geoip_latitude"), NULL,
2907+ ngx_http_geoip_city_float_variable,
2908+ offsetof(GeoIPRecord, latitude), 0, 0 },
2909+
2910+ { ngx_string("geoip_longitude"), NULL,
2911+ ngx_http_geoip_city_float_variable,
2912+ offsetof(GeoIPRecord, longitude), 0, 0 },
2913+
2914 { ngx_null_string, NULL, NULL, 0, 0, 0 }
2915 };
2916
2917@@ -179,34 +199,16 @@
2918 ngx_http_geoip_city_variable(ngx_http_request_t *r,
2919 ngx_http_variable_value_t *v, uintptr_t data)
2920 {
2921- u_long addr;
2922- char *val;
2923- size_t len;
2924- GeoIPRecord *gr;
2925- struct sockaddr_in *sin;
2926- ngx_http_geoip_conf_t *gcf;
2927-
2928- gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module);
2929-
2930- if (gcf->city == NULL) {
2931- goto not_found;
2932- }
2933-
2934- if (r->connection->sockaddr->sa_family != AF_INET) {
2935- goto not_found;
2936- }
2937-
2938- sin = (struct sockaddr_in *) r->connection->sockaddr;
2939- addr = ntohl(sin->sin_addr.s_addr);
2940-
2941- gr = GeoIP_record_by_ipnum(gcf->city, addr);
2942-
2943+ char *val;
2944+ size_t len;
2945+ GeoIPRecord *gr;
2946+
2947+ gr = ngx_http_geoip_get_city_record(r);
2948 if (gr == NULL) {
2949 goto not_found;
2950 }
2951
2952 val = *(char **) ((char *) gr + data);
2953-
2954 if (val == NULL) {
2955 goto no_value;
2956 }
2957@@ -243,6 +245,56 @@
2958
2959
2960 static ngx_int_t
2961+ngx_http_geoip_city_float_variable(ngx_http_request_t *r,
2962+ ngx_http_variable_value_t *v, uintptr_t data)
2963+{
2964+ float val;
2965+ GeoIPRecord *gr;
2966+
2967+ gr = ngx_http_geoip_get_city_record(r);
2968+ if (gr == NULL) {
2969+ v->not_found = 1;
2970+ return NGX_OK;
2971+ }
2972+
2973+ v->data = ngx_pnalloc(r->pool, NGX_INT64_LEN + 5);
2974+ if (v->data == NULL) {
2975+ GeoIPRecord_delete(gr);
2976+ return NGX_ERROR;
2977+ }
2978+
2979+ val = *(float *) ((char *) gr + data);
2980+
2981+ v->len = ngx_sprintf(v->data, "%.4f", val) - v->data;
2982+
2983+ GeoIPRecord_delete(gr);
2984+
2985+ return NGX_OK;
2986+}
2987+
2988+
2989+static GeoIPRecord *
2990+ngx_http_geoip_get_city_record(ngx_http_request_t *r)
2991+{
2992+ u_long addr;
2993+ struct sockaddr_in *sin;
2994+ ngx_http_geoip_conf_t *gcf;
2995+
2996+ gcf = ngx_http_get_module_main_conf(r, ngx_http_geoip_module);
2997+
2998+ if (gcf->city && r->connection->sockaddr->sa_family == AF_INET) {
2999+
3000+ sin = (struct sockaddr_in *) r->connection->sockaddr;
3001+ addr = ntohl(sin->sin_addr.s_addr);
3002+
3003+ return GeoIP_record_by_ipnum(gcf->city, addr);
3004+ }
3005+
3006+ return NULL;
3007+}
3008+
3009+
3010+static ngx_int_t
3011 ngx_http_geoip_add_variables(ngx_conf_t *cf)
3012 {
3013 ngx_http_variable_t *var, *v;
3014
3015=== modified file 'src/http/modules/ngx_http_gzip_static_module.c'
3016--- src/http/modules/ngx_http_gzip_static_module.c 2010-03-03 23:50:36 +0000
3017+++ src/http/modules/ngx_http_gzip_static_module.c 2010-07-21 11:15:58 +0000
3018@@ -89,10 +89,6 @@
3019 return NGX_DECLINED;
3020 }
3021
3022- if (r->zero_in_uri) {
3023- return NGX_DECLINED;
3024- }
3025-
3026 gzcf = ngx_http_get_module_loc_conf(r, ngx_http_gzip_static_module);
3027
3028 if (!gzcf->enable) {
3029@@ -179,7 +175,7 @@
3030 #if !(NGX_WIN32) /* the not regular files are probably Unix specific */
3031
3032 if (!of.is_file) {
3033- ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
3034+ ngx_log_error(NGX_LOG_CRIT, log, 0,
3035 "\"%s\" is not a regular file", path.data);
3036
3037 return NGX_HTTP_NOT_FOUND;
3038
3039=== modified file 'src/http/modules/ngx_http_image_filter_module.c'
3040--- src/http/modules/ngx_http_image_filter_module.c 2009-11-30 13:34:00 +0000
3041+++ src/http/modules/ngx_http_image_filter_module.c 2010-07-21 11:15:58 +0000
3042@@ -63,6 +63,7 @@
3043
3044 ngx_uint_t phase;
3045 ngx_uint_t type;
3046+ ngx_uint_t force;
3047 } ngx_http_image_filter_ctx_t;
3048
3049
3050@@ -501,7 +502,8 @@
3051
3052 if (rc == NGX_OK
3053 && ctx->width <= ctx->max_width
3054- && ctx->height <= ctx->max_height)
3055+ && ctx->height <= ctx->max_height
3056+ && !ctx->force)
3057 {
3058 return ngx_http_image_asis(r, ctx);
3059 }
3060@@ -601,6 +603,7 @@
3061 ngx_http_image_size(ngx_http_request_t *r, ngx_http_image_filter_ctx_t *ctx)
3062 {
3063 u_char *p, *last;
3064+ size_t len, app;
3065 ngx_uint_t width, height;
3066
3067 p = ctx->image;
3068@@ -611,26 +614,38 @@
3069
3070 p += 2;
3071 last = ctx->image + ctx->length - 10;
3072+ width = 0;
3073+ height = 0;
3074+ app = 0;
3075
3076 while (p < last) {
3077
3078 if (p[0] == 0xff && p[1] != 0xff) {
3079
3080 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3081- "JPEG: %02xd %02xd", *p, *(p + 1));
3082+ "JPEG: %02xd %02xd", p[0], p[1]);
3083
3084 p++;
3085
3086- if (*p == 0xc0 || *p == 0xc1 || *p == 0xc2 || *p == 0xc3
3087- || *p == 0xc9 || *p == 0xca || *p == 0xcb)
3088+ if ((*p == 0xc0 || *p == 0xc1 || *p == 0xc2 || *p == 0xc3
3089+ || *p == 0xc9 || *p == 0xca || *p == 0xcb)
3090+ && (width == 0 || height == 0))
3091 {
3092- goto found;
3093+ width = p[6] * 256 + p[7];
3094+ height = p[4] * 256 + p[5];
3095 }
3096
3097 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3098 "JPEG: %02xd %02xd", p[1], p[2]);
3099
3100- p += p[1] * 256 + p[2];
3101+ len = p[1] * 256 + p[2];
3102+
3103+ if (*p >= 0xe1 && *p <= 0xef) {
3104+ /* application data, e.g., EXIF, Adobe XMP, etc. */
3105+ app += len;
3106+ }
3107+
3108+ p += len;
3109
3110 continue;
3111 }
3112@@ -638,12 +653,16 @@
3113 p++;
3114 }
3115
3116- return NGX_DECLINED;
3117-
3118- found:
3119-
3120- width = p[6] * 256 + p[7];
3121- height = p[4] * 256 + p[5];
3122+ if (width == 0 || height == 0) {
3123+ return NGX_DECLINED;
3124+ }
3125+
3126+ if (ctx->length / 20 < app) {
3127+ /* force conversion if application data consume more than 5% */
3128+ ctx->force = 1;
3129+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3130+ "app data size: %uz", app);
3131+ }
3132
3133 break;
3134
3135@@ -708,7 +727,8 @@
3136
3137 conf = ngx_http_get_module_loc_conf(r, ngx_http_image_filter_module);
3138
3139- if ((ngx_uint_t) sx <= ctx->max_width
3140+ if (!ctx->force
3141+ && (ngx_uint_t) sx <= ctx->max_width
3142 && (ngx_uint_t) sy <= ctx->max_height)
3143 {
3144 gdImageDestroy(src);
3145
3146=== modified file 'src/http/modules/ngx_http_index_module.c'
3147--- src/http/modules/ngx_http_index_module.c 2010-03-03 23:50:36 +0000
3148+++ src/http/modules/ngx_http_index_module.c 2010-07-21 11:15:58 +0000
3149@@ -116,10 +116,6 @@
3150 return NGX_DECLINED;
3151 }
3152
3153- if (r->zero_in_uri) {
3154- return NGX_DECLINED;
3155- }
3156-
3157 ilcf = ngx_http_get_module_loc_conf(r, ngx_http_index_module);
3158 clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
3159
3160
3161=== modified file 'src/http/modules/ngx_http_memcached_module.c'
3162--- src/http/modules/ngx_http_memcached_module.c 2009-11-30 13:34:00 +0000
3163+++ src/http/modules/ngx_http_memcached_module.c 2010-07-21 11:15:58 +0000
3164@@ -423,15 +423,20 @@
3165
3166 if (ngx_strncmp(b->last,
3167 ngx_http_memcached_end + NGX_HTTP_MEMCACHED_END - ctx->rest,
3168- ctx->rest)
3169+ bytes)
3170 != 0)
3171 {
3172 ngx_log_error(NGX_LOG_ERR, ctx->request->connection->log, 0,
3173 "memcached sent invalid trailer");
3174+
3175+ u->length = 0;
3176+ ctx->rest = 0;
3177+
3178+ return NGX_OK;
3179 }
3180
3181- u->length = 0;
3182- ctx->rest = 0;
3183+ u->length -= bytes;
3184+ ctx->rest -= bytes;
3185
3186 return NGX_OK;
3187 }
3188
3189=== modified file 'src/http/modules/ngx_http_proxy_module.c'
3190--- src/http/modules/ngx_http_proxy_module.c 2010-03-03 23:50:36 +0000
3191+++ src/http/modules/ngx_http_proxy_module.c 2010-07-21 11:15:58 +0000
3192@@ -357,6 +357,13 @@
3193 0,
3194 &ngx_http_proxy_module },
3195
3196+ { ngx_string("proxy_no_cache"),
3197+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
3198+ ngx_http_no_cache_set_slot,
3199+ NGX_HTTP_LOC_CONF_OFFSET,
3200+ offsetof(ngx_http_proxy_loc_conf_t, upstream.no_cache),
3201+ NULL },
3202+
3203 { ngx_string("proxy_cache_valid"),
3204 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
3205 ngx_http_file_cache_valid_set_slot,
3206@@ -630,6 +637,7 @@
3207 u->process_header = ngx_http_proxy_process_status_line;
3208 u->abort_request = ngx_http_proxy_abort_request;
3209 u->finalize_request = ngx_http_proxy_finalize_request;
3210+ r->state = 0;
3211
3212 if (plcf->redirects) {
3213 u->rewrite_redirect = ngx_http_proxy_rewrite_redirect;
3214@@ -1191,6 +1199,7 @@
3215 ctx->status_end = NULL;
3216
3217 r->upstream->process_header = ngx_http_proxy_process_status_line;
3218+ r->state = 0;
3219
3220 return NGX_OK;
3221 }
3222@@ -1906,7 +1915,7 @@
3223 * conf->body_set_len = NULL;
3224 * conf->body_set = NULL;
3225 * conf->body_source = { 0, NULL };
3226- * conf->rewrite_locations = NULL;
3227+ * conf->redirects = NULL;
3228 */
3229
3230 conf->upstream.store = NGX_CONF_UNSET;
3231@@ -1931,6 +1940,7 @@
3232 #if (NGX_HTTP_CACHE)
3233 conf->upstream.cache = NGX_CONF_UNSET_PTR;
3234 conf->upstream.cache_min_uses = NGX_CONF_UNSET_UINT;
3235+ conf->upstream.no_cache = NGX_CONF_UNSET_PTR;
3236 conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
3237 #endif
3238
3239@@ -2155,6 +2165,9 @@
3240 |NGX_HTTP_UPSTREAM_FT_OFF;
3241 }
3242
3243+ ngx_conf_merge_ptr_value(conf->upstream.no_cache,
3244+ prev->upstream.no_cache, NULL);
3245+
3246 ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
3247 prev->upstream.cache_valid, NULL);
3248
3249@@ -2747,9 +2760,16 @@
3250 }
3251
3252 if (ngx_strcmp(value[1].data, "default") == 0) {
3253+ if (plcf->proxy_lengths) {
3254+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3255+ "\"proxy_redirect default\" may not be used "
3256+ "with \"proxy_pass\" directive with variables");
3257+ return NGX_CONF_ERROR;
3258+ }
3259+
3260 if (plcf->url.data == NULL) {
3261 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
3262- "\"proxy_rewrite_location default\" must go "
3263+ "\"proxy_redirect default\" must go "
3264 "after the \"proxy_pass\" directive");
3265 return NGX_CONF_ERROR;
3266 }
3267
3268=== modified file 'src/http/modules/ngx_http_random_index_module.c'
3269--- src/http/modules/ngx_http_random_index_module.c 2010-03-03 23:50:36 +0000
3270+++ src/http/modules/ngx_http_random_index_module.c 2010-07-21 11:15:58 +0000
3271@@ -86,10 +86,6 @@
3272 return NGX_DECLINED;
3273 }
3274
3275- if (r->zero_in_uri) {
3276- return NGX_DECLINED;
3277- }
3278-
3279 if (!(r->method & (NGX_HTTP_GET|NGX_HTTP_HEAD|NGX_HTTP_POST))) {
3280 return NGX_DECLINED;
3281 }
3282
3283=== modified file 'src/http/modules/ngx_http_referer_module.c'
3284--- src/http/modules/ngx_http_referer_module.c 2009-11-27 11:10:18 +0000
3285+++ src/http/modules/ngx_http_referer_module.c 2010-07-21 11:15:58 +0000
3286@@ -124,18 +124,27 @@
3287 len = r->headers_in.referer->value.len;
3288 ref = r->headers_in.referer->value.data;
3289
3290- if (len < sizeof("http://i.ru") - 1
3291- || (ngx_strncasecmp(ref, (u_char *) "http://", 7) != 0))
3292- {
3293- if (rlcf->blocked_referer) {
3294- goto valid;
3295+ if (len >= sizeof("http://i.ru") - 1) {
3296+ last = ref + len;
3297+
3298+ if (ngx_strncasecmp(ref, (u_char *) "http://", 7) == 0) {
3299+ ref += 7;
3300+ goto valid_scheme;
3301+
3302+ } else if (ngx_strncasecmp(ref, (u_char *) "https://", 8) == 0) {
3303+ ref += 8;
3304+ goto valid_scheme;
3305 }
3306-
3307- goto invalid;
3308- }
3309-
3310- last = ref + len;
3311- ref += 7;
3312+ }
3313+
3314+ if (rlcf->blocked_referer) {
3315+ goto valid;
3316+ }
3317+
3318+ goto invalid;
3319+
3320+valid_scheme:
3321+
3322 i = 0;
3323 key = 0;
3324
3325
3326=== modified file 'src/http/modules/ngx_http_rewrite_module.c'
3327--- src/http/modules/ngx_http_rewrite_module.c 2009-11-30 13:34:00 +0000
3328+++ src/http/modules/ngx_http_rewrite_module.c 2010-07-21 11:15:58 +0000
3329@@ -340,13 +340,10 @@
3330
3331 last = 0;
3332
3333- if (ngx_strncmp(value[2].data, "http://", sizeof("http://") - 1) == 0) {
3334- regex->status = NGX_HTTP_MOVED_TEMPORARILY;
3335- regex->redirect = 1;
3336- last = 1;
3337- }
3338-
3339- if (ngx_strncmp(value[2].data, "https://", sizeof("https://") - 1) == 0) {
3340+ if (ngx_strncmp(value[2].data, "http://", sizeof("http://") - 1) == 0
3341+ || ngx_strncmp(value[2].data, "https://", sizeof("https://") - 1) == 0
3342+ || ngx_strncmp(value[2].data, "$scheme", sizeof("$scheme") - 1) == 0)
3343+ {
3344 regex->status = NGX_HTTP_MOVED_TEMPORARILY;
3345 regex->redirect = 1;
3346 last = 1;
3347
3348=== modified file 'src/http/modules/ngx_http_ssi_filter_module.c'
3349--- src/http/modules/ngx_http_ssi_filter_module.c 2009-11-30 13:34:00 +0000
3350+++ src/http/modules/ngx_http_ssi_filter_module.c 2010-07-21 11:15:58 +0000
3351@@ -14,7 +14,6 @@
3352
3353 #define NGX_HTTP_SSI_ADD_PREFIX 1
3354 #define NGX_HTTP_SSI_ADD_ZERO 2
3355-#define NGX_HTTP_SSI_EXPR_TEST 4
3356
3357
3358 typedef struct {
3359@@ -1701,8 +1700,7 @@
3360 val = ngx_http_ssi_get_variable(r, &var, key);
3361
3362 if (val == NULL) {
3363- vv = ngx_http_get_variable(r, &var, key,
3364- flags & NGX_HTTP_SSI_EXPR_TEST);
3365+ vv = ngx_http_get_variable(r, &var, key);
3366 if (vv == NULL) {
3367 return NGX_ERROR;
3368 }
3369@@ -2061,9 +2059,9 @@
3370 out = data;
3371
3372 if (!r->header_sent) {
3373- if (ngx_http_set_content_type(r) != NGX_OK) {
3374- return NGX_ERROR;
3375- }
3376+ r->headers_out.content_type_len =
3377+ r->parent->headers_out.content_type_len;
3378+ r->headers_out.content_type = r->parent->headers_out.content_type;
3379
3380 if (ngx_http_send_header(r) == NGX_ERROR) {
3381 return NGX_ERROR;
3382@@ -2110,7 +2108,7 @@
3383 value = ngx_http_ssi_get_variable(r, var, key);
3384
3385 if (value == NULL) {
3386- vv = ngx_http_get_variable(r, var, key, 1);
3387+ vv = ngx_http_get_variable(r, var, key);
3388
3389 if (vv == NULL) {
3390 return NGX_HTTP_SSI_ERROR;
3391@@ -2161,11 +2159,10 @@
3392 }
3393 }
3394
3395+ p = value->data;
3396+
3397 switch (ctx->encoding) {
3398
3399- case NGX_HTTP_SSI_NO_ENCODING:
3400- break;
3401-
3402 case NGX_HTTP_SSI_URL_ENCODING:
3403 len = 2 * ngx_escape_uri(NULL, value->data, value->len,
3404 NGX_ESCAPE_HTML);
3405@@ -2177,11 +2174,9 @@
3406 }
3407
3408 (void) ngx_escape_uri(p, value->data, value->len, NGX_ESCAPE_HTML);
3409-
3410- value->len += len;
3411- value->data = p;
3412 }
3413
3414+ len += value->len;
3415 break;
3416
3417 case NGX_HTTP_SSI_ENTITY_ENCODING:
3418@@ -2194,11 +2189,13 @@
3419 }
3420
3421 (void) ngx_escape_html(p, value->data, value->len);
3422-
3423- value->len += len;
3424- value->data = p;
3425 }
3426
3427+ len += value->len;
3428+ break;
3429+
3430+ default: /* NGX_HTTP_SSI_NO_ENCODING */
3431+ len = value->len;
3432 break;
3433 }
3434
3435@@ -2213,8 +2210,8 @@
3436 }
3437
3438 b->memory = 1;
3439- b->pos = value->data;
3440- b->last = value->data + value->len;
3441+ b->pos = p;
3442+ b->last = p + len;
3443
3444 cl->buf = b;
3445 cl->next = NULL;
3446@@ -2362,7 +2359,7 @@
3447 p++;
3448 }
3449
3450- flags = (p == last) ? NGX_HTTP_SSI_EXPR_TEST : 0;
3451+ flags = 0;
3452
3453 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3454 "left: \"%V\"", &left);
3455@@ -2614,8 +2611,7 @@
3456 return NGX_ERROR;
3457 }
3458
3459- v->len = ngx_sprintf(v->data, "%T", tp->sec + (gmt ? 0 : tp->gmtoff))
3460- - v->data;
3461+ v->len = ngx_sprintf(v->data, "%T", tp->sec) - v->data;
3462
3463 return NGX_OK;
3464 }
3465
3466=== modified file 'src/http/modules/ngx_http_static_module.c'
3467--- src/http/modules/ngx_http_static_module.c 2009-10-19 23:22:06 +0000
3468+++ src/http/modules/ngx_http_static_module.c 2010-07-21 11:15:58 +0000
3469@@ -66,10 +66,6 @@
3470 return NGX_DECLINED;
3471 }
3472
3473- if (r->zero_in_uri) {
3474- return NGX_DECLINED;
3475- }
3476-
3477 log = r->connection->log;
3478
3479 /*
3480@@ -188,7 +184,7 @@
3481 #if !(NGX_WIN32) /* the not regular files are probably Unix specific */
3482
3483 if (!of.is_file) {
3484- ngx_log_error(NGX_LOG_CRIT, log, ngx_errno,
3485+ ngx_log_error(NGX_LOG_CRIT, log, 0,
3486 "\"%s\" is not a regular file", path.data);
3487
3488 return NGX_HTTP_NOT_FOUND;
3489
3490=== modified file 'src/http/modules/ngx_http_userid_filter_module.c'
3491--- src/http/modules/ngx_http_userid_filter_module.c 2009-11-30 13:34:00 +0000
3492+++ src/http/modules/ngx_http_userid_filter_module.c 2010-07-21 11:15:58 +0000
3493@@ -545,7 +545,7 @@
3494 {
3495 ngx_http_variable_t *var;
3496
3497- var = ngx_http_add_variable(cf, &ngx_http_userid_got, NGX_HTTP_VAR_NOHASH);
3498+ var = ngx_http_add_variable(cf, &ngx_http_userid_got, 0);
3499 if (var == NULL) {
3500 return NGX_ERROR;
3501 }
3502
3503=== modified file 'src/http/modules/perl/nginx.pm'
3504--- src/http/modules/perl/nginx.pm 2010-03-03 23:50:36 +0000
3505+++ src/http/modules/perl/nginx.pm 2010-07-21 11:15:58 +0000
3506@@ -47,7 +47,7 @@
3507 HTTP_INSUFFICIENT_STORAGE
3508 );
3509
3510-our $VERSION = '0.7.65';
3511+our $VERSION = '0.7.67';
3512
3513 require XSLoader;
3514 XSLoader::load('nginx', $VERSION);
3515
3516=== modified file 'src/http/modules/perl/nginx.xs'
3517--- src/http/modules/perl/nginx.xs 2009-10-19 23:22:06 +0000
3518+++ src/http/modules/perl/nginx.xs 2010-07-21 11:15:58 +0000
3519@@ -847,7 +847,7 @@
3520
3521 #endif
3522
3523- vv = ngx_http_get_variable(r, &var, hash, 1);
3524+ vv = ngx_http_get_variable(r, &var, hash);
3525 if (vv == NULL) {
3526 XSRETURN_UNDEF;
3527 }
3528@@ -901,9 +901,6 @@
3529 XSRETURN_UNDEF;
3530 }
3531
3532- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
3533- "variable \"%V\" not found", &var);
3534-
3535 XSRETURN_UNDEF;
3536 }
3537
3538
3539=== modified file 'src/http/modules/perl/ngx_http_perl_module.c'
3540--- src/http/modules/perl/ngx_http_perl_module.c 2010-03-03 23:50:36 +0000
3541+++ src/http/modules/perl/ngx_http_perl_module.c 2010-07-21 11:15:58 +0000
3542@@ -30,12 +30,6 @@
3543 } ngx_http_perl_variable_t;
3544
3545
3546-typedef struct {
3547- SV *sv;
3548- PerlInterpreter *perl;
3549-} ngx_http_perl_cleanup_t;
3550-
3551-
3552 #if (NGX_HTTP_SSI)
3553 static ngx_int_t ngx_http_perl_ssi(ngx_http_request_t *r,
3554 ngx_http_ssi_ctx_t *ssi_ctx, ngx_str_t **params);
3555@@ -174,10 +168,6 @@
3556 static ngx_int_t
3557 ngx_http_perl_handler(ngx_http_request_t *r)
3558 {
3559- if (r->zero_in_uri) {
3560- return NGX_HTTP_NOT_FOUND;
3561- }
3562-
3563 ngx_http_perl_handle_request(r);
3564
3565 return NGX_DONE;
3566
3567=== modified file 'src/http/ngx_http_cache.h'
3568--- src/http/ngx_http_cache.h 2009-11-30 13:34:00 +0000
3569+++ src/http/ngx_http_cache.h 2010-07-21 11:15:58 +0000
3570@@ -133,6 +133,11 @@
3571 char *ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
3572 void *conf);
3573
3574+ngx_int_t ngx_http_cache(ngx_http_request_t *r, ngx_array_t *no_cache);
3575+char *ngx_http_no_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
3576+ void *conf);
3577+
3578+
3579 extern ngx_str_t ngx_http_cache_status[];
3580
3581
3582
3583=== modified file 'src/http/ngx_http_copy_filter_module.c'
3584--- src/http/ngx_http_copy_filter_module.c 2009-10-19 23:22:06 +0000
3585+++ src/http/ngx_http_copy_filter_module.c 2010-07-21 11:15:58 +0000
3586@@ -104,7 +104,9 @@
3587 ctx->output_filter = (ngx_output_chain_filter_pt) ngx_http_next_filter;
3588 ctx->filter_ctx = r;
3589
3590- r->request_output = 1;
3591+ if (in && in->buf && ngx_buf_size(in->buf)) {
3592+ r->request_output = 1;
3593+ }
3594 }
3595
3596 rc = ngx_output_chain(ctx, in);
3597
3598=== modified file 'src/http/ngx_http_core_module.c'
3599--- src/http/ngx_http_core_module.c 2010-03-03 23:50:36 +0000
3600+++ src/http/ngx_http_core_module.c 2010-07-21 11:15:58 +0000
3601@@ -560,6 +560,13 @@
3602 offsetof(ngx_http_core_loc_conf_t, if_modified_since),
3603 &ngx_http_core_if_modified_since },
3604
3605+ { ngx_string("chunked_transfer_encoding"),
3606+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
3607+ ngx_conf_set_flag_slot,
3608+ NGX_HTTP_LOC_CONF_OFFSET,
3609+ offsetof(ngx_http_core_loc_conf_t, chunked_transfer_encoding),
3610+ NULL },
3611+
3612 { ngx_string("error_page"),
3613 NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_HTTP_LIF_CONF
3614 |NGX_CONF_2MORE,
3615@@ -744,14 +751,24 @@
3616 break;
3617 }
3618
3619- if (r->keepalive && r->headers_in.msie && r->method == NGX_HTTP_POST) {
3620-
3621- /*
3622- * MSIE may wait for some time if an response for
3623- * a POST request was sent over a keepalive connection
3624- */
3625-
3626- r->keepalive = 0;
3627+ if (r->keepalive) {
3628+
3629+ if (r->headers_in.msie6) {
3630+ if (r->method == NGX_HTTP_POST) {
3631+ /*
3632+ * MSIE may wait for some time if an response for
3633+ * a POST request was sent over a keepalive connection
3634+ */
3635+ r->keepalive = 0;
3636+ }
3637+
3638+ } else if (r->headers_in.safari) {
3639+ /*
3640+ * Safari may send a POST request to a closed keepalive
3641+ * connection and stalls for some time
3642+ */
3643+ r->keepalive = 0;
3644+ }
3645 }
3646
3647 if (r->headers_in.content_length_n > 0) {
3648@@ -1288,7 +1305,7 @@
3649
3650 /* no content handler was found */
3651
3652- if (r->uri.data[r->uri.len - 1] == '/' && !r->zero_in_uri) {
3653+ if (r->uri.data[r->uri.len - 1] == '/') {
3654
3655 if (ngx_http_map_uri_to_path(r, &path, &root, 0) != NULL) {
3656 ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
3657@@ -2076,7 +2093,6 @@
3658 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
3659 "http subrequest \"%V?%V\"", uri, &sr->args);
3660
3661- sr->zero_in_uri = (flags & NGX_HTTP_ZERO_IN_URI) != 0;
3662 sr->subrequest_in_memory = (flags & NGX_HTTP_SUBREQUEST_IN_MEMORY) != 0;
3663 sr->waited = (flags & NGX_HTTP_SUBREQUEST_WAITED) != 0;
3664
3665@@ -2944,6 +2960,7 @@
3666 lcf->log_subrequest = NGX_CONF_UNSET;
3667 lcf->recursive_error_pages = NGX_CONF_UNSET;
3668 lcf->server_tokens = NGX_CONF_UNSET;
3669+ lcf->chunked_transfer_encoding = NGX_CONF_UNSET;
3670 lcf->types_hash_max_size = NGX_CONF_UNSET_UINT;
3671 lcf->types_hash_bucket_size = NGX_CONF_UNSET_UINT;
3672
3673@@ -3181,6 +3198,8 @@
3674 ngx_conf_merge_value(conf->recursive_error_pages,
3675 prev->recursive_error_pages, 0);
3676 ngx_conf_merge_value(conf->server_tokens, prev->server_tokens, 1);
3677+ ngx_conf_merge_value(conf->chunked_transfer_encoding,
3678+ prev->chunked_transfer_encoding, 1);
3679
3680 ngx_conf_merge_ptr_value(conf->open_file_cache,
3681 prev->open_file_cache, NULL);
3682
3683=== modified file 'src/http/ngx_http_core_module.h'
3684--- src/http/ngx_http_core_module.h 2009-11-30 13:34:00 +0000
3685+++ src/http/ngx_http_core_module.h 2010-07-21 11:15:58 +0000
3686@@ -358,6 +358,7 @@
3687 ngx_flag_t log_subrequest; /* log_subrequest */
3688 ngx_flag_t recursive_error_pages; /* recursive_error_pages */
3689 ngx_flag_t server_tokens; /* server_tokens */
3690+ ngx_flag_t chunked_transfer_encoding; /* chunked_transfer_encoding */
3691
3692 #if (NGX_HTTP_GZIP)
3693 ngx_flag_t gzip_vary; /* gzip_vary */
3694
3695=== modified file 'src/http/ngx_http_file_cache.c'
3696--- src/http/ngx_http_file_cache.c 2010-03-03 23:50:36 +0000
3697+++ src/http/ngx_http_file_cache.c 2010-07-21 11:15:58 +0000
3698@@ -1128,7 +1128,7 @@
3699
3700 if (cache->files++ > 100) {
3701
3702- ngx_time_update(0, 0);
3703+ ngx_time_update();
3704
3705 elapsed = ngx_abs((ngx_msec_int_t) (ngx_current_msec - cache->last));
3706
3707@@ -1145,7 +1145,7 @@
3708
3709 ngx_msleep(200);
3710
3711- ngx_time_update(0, 0);
3712+ ngx_time_update();
3713 }
3714
3715 cache->last = ngx_current_msec;
3716@@ -1604,3 +1604,69 @@
3717
3718 return NGX_CONF_OK;
3719 }
3720+
3721+
3722+ngx_int_t
3723+ngx_http_cache(ngx_http_request_t *r, ngx_array_t *no_cache)
3724+{
3725+ ngx_str_t val;
3726+ ngx_uint_t i;
3727+ ngx_http_complex_value_t *cv;
3728+
3729+ cv = no_cache->elts;
3730+
3731+ for (i = 0; i < no_cache->nelts; i++) {
3732+ if (ngx_http_complex_value(r, &cv[i], &val) != NGX_OK) {
3733+ return NGX_ERROR;
3734+ }
3735+
3736+ if (val.len && val.data[0] != '0') {
3737+ return NGX_DECLINED;
3738+ }
3739+ }
3740+
3741+ return NGX_OK;
3742+}
3743+
3744+
3745+char *
3746+ngx_http_no_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
3747+{
3748+ char *p = conf;
3749+
3750+ ngx_str_t *value;
3751+ ngx_uint_t i;
3752+ ngx_array_t **a;
3753+ ngx_http_complex_value_t *cv;
3754+ ngx_http_compile_complex_value_t ccv;
3755+
3756+ a = (ngx_array_t **) (p + cmd->offset);
3757+
3758+ if (*a == NGX_CONF_UNSET_PTR) {
3759+ *a = ngx_array_create(cf->pool, 1, sizeof(ngx_http_complex_value_t));
3760+ if (*a == NULL) {
3761+ return NGX_CONF_ERROR;
3762+ }
3763+ }
3764+
3765+ value = cf->args->elts;
3766+
3767+ for (i = 1; i < cf->args->nelts; i++) {
3768+ cv = ngx_array_push(*a);
3769+ if (cv == NULL) {
3770+ return NGX_CONF_ERROR;
3771+ }
3772+
3773+ ngx_memzero(&ccv, sizeof(ngx_http_compile_complex_value_t));
3774+
3775+ ccv.cf = cf;
3776+ ccv.value = &value[i];
3777+ ccv.complex_value = cv;
3778+
3779+ if (ngx_http_compile_complex_value(&ccv) != NGX_OK) {
3780+ return NGX_CONF_ERROR;
3781+ }
3782+ }
3783+
3784+ return NGX_CONF_OK;
3785+}
3786
3787=== modified file 'src/http/ngx_http_header_filter_module.c'
3788--- src/http/ngx_http_header_filter_module.c 2010-03-03 23:50:36 +0000
3789+++ src/http/ngx_http_header_filter_module.c 2010-07-21 11:15:58 +0000
3790@@ -538,8 +538,8 @@
3791
3792 r->headers_out.location->value.len = b->last - p;
3793 r->headers_out.location->value.data = p;
3794- r->headers_out.location->key.len = sizeof("Location: ") - 1;
3795- r->headers_out.location->key.data = (u_char *) "Location: ";
3796+ r->headers_out.location->key.len = sizeof("Location") - 1;
3797+ r->headers_out.location->key.data = (u_char *) "Location";
3798
3799 *b->last++ = CR; *b->last++ = LF;
3800 }
3801
3802=== modified file 'src/http/ngx_http_parse.c'
3803--- src/http/ngx_http_parse.c 2009-11-30 13:34:00 +0000
3804+++ src/http/ngx_http_parse.c 2010-07-21 11:15:58 +0000
3805@@ -438,8 +438,7 @@
3806 r->plus_in_uri = 1;
3807 break;
3808 case '\0':
3809- r->zero_in_uri = 1;
3810- break;
3811+ return NGX_HTTP_PARSE_INVALID_REQUEST;
3812 default:
3813 state = sw_check_uri;
3814 break;
3815@@ -496,8 +495,7 @@
3816 r->plus_in_uri = 1;
3817 break;
3818 case '\0':
3819- r->zero_in_uri = 1;
3820- break;
3821+ return NGX_HTTP_PARSE_INVALID_REQUEST;
3822 }
3823 break;
3824
3825@@ -526,8 +524,7 @@
3826 r->complex_uri = 1;
3827 break;
3828 case '\0':
3829- r->zero_in_uri = 1;
3830- break;
3831+ return NGX_HTTP_PARSE_INVALID_REQUEST;
3832 }
3833 break;
3834
3835@@ -1202,7 +1199,7 @@
3836 ch = *p++;
3837
3838 } else if (ch == '\0') {
3839- r->zero_in_uri = 1;
3840+ return NGX_HTTP_PARSE_INVALID_REQUEST;
3841 }
3842
3843 state = quoted_state;
3844@@ -1304,8 +1301,7 @@
3845 }
3846
3847 if (ch == '\0') {
3848- *flags |= NGX_HTTP_ZERO_IN_URI;
3849- continue;
3850+ goto unsafe;
3851 }
3852
3853 if (ngx_path_separator(ch) && len > 2) {
3854@@ -1449,34 +1445,19 @@
3855 void
3856 ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri, ngx_str_t *args)
3857 {
3858- u_char ch, *p, *last;
3859-
3860- p = uri->data;
3861-
3862- last = p + uri->len;
3863-
3864- args->len = 0;
3865-
3866- while (p < last) {
3867-
3868- ch = *p++;
3869-
3870- if (ch == '?') {
3871- args->len = last - p;
3872- args->data = p;
3873-
3874- uri->len = p - 1 - uri->data;
3875-
3876- if (ngx_strlchr(p, last, '\0') != NULL) {
3877- r->zero_in_uri = 1;
3878- }
3879-
3880- return;
3881- }
3882-
3883- if (ch == '\0') {
3884- r->zero_in_uri = 1;
3885- continue;
3886- }
3887+ u_char *p, *last;
3888+
3889+ last = uri->data + uri->len;
3890+
3891+ p = ngx_strlchr(uri->data, last, '?');
3892+
3893+ if (p) {
3894+ uri->len = p - uri->data;
3895+ p++;
3896+ args->len = last - p;
3897+ args->data = p;
3898+
3899+ } else {
3900+ args->len = 0;
3901 }
3902 }
3903
3904=== modified file 'src/http/ngx_http_request.c'
3905--- src/http/ngx_http_request.c 2010-03-03 23:50:36 +0000
3906+++ src/http/ngx_http_request.c 2010-07-21 11:15:58 +0000
3907@@ -784,16 +784,31 @@
3908
3909 p = r->uri.data + r->uri.len - 1;
3910
3911- if (*p == '.' || *p == ' ') {
3912-
3913- while (--p > r->uri.data && (*p == '.' || *p == ' ')) {
3914- /* void */
3915- }
3916-
3917+ while (p > r->uri.data) {
3918+
3919+ if (*p == ' ') {
3920+ p--;
3921+ continue;
3922+ }
3923+
3924+ if (*p == '.') {
3925+ p--;
3926+ continue;
3927+ }
3928+
3929+ if (ngx_strncasecmp(p - 6, (u_char *) "::$data", 7) == 0) {
3930+ p -= 7;
3931+ continue;
3932+ }
3933+
3934+ break;
3935+ }
3936+
3937+ if (p != r->uri.data + r->uri.len - 1) {
3938 r->uri.len = p + 1 - r->uri.data;
3939-
3940 ngx_http_set_exten(r);
3941 }
3942+
3943 }
3944 #endif
3945
3946@@ -1443,6 +1458,12 @@
3947 if (ngx_strstrn(user_agent, "Gecko/", 6 - 1)) {
3948 r->headers_in.gecko = 1;
3949
3950+ } else if (ngx_strstrn(user_agent, "Chrome/", 7 - 1)) {
3951+ r->headers_in.chrome = 1;
3952+
3953+ } else if (ngx_strstrn(user_agent, "Safari/", 7 - 1)) {
3954+ r->headers_in.safari = 1;
3955+
3956 } else if (ngx_strstrn(user_agent, "Konqueror", 9 - 1)) {
3957 r->headers_in.konqueror = 1;
3958 }
3959
3960=== modified file 'src/http/ngx_http_request.h'
3961--- src/http/ngx_http_request.h 2010-03-03 23:50:36 +0000
3962+++ src/http/ngx_http_request.h 2010-07-21 11:15:58 +0000
3963@@ -57,7 +57,7 @@
3964 #define NGX_HTTP_PARSE_INVALID_HEADER 13
3965
3966
3967-#define NGX_HTTP_ZERO_IN_URI 1
3968+/* unused 1 */
3969 #define NGX_HTTP_SUBREQUEST_IN_MEMORY 2
3970 #define NGX_HTTP_SUBREQUEST_WAITED 4
3971 #define NGX_HTTP_LOG_UNSAFE 8
3972@@ -220,6 +220,8 @@
3973 unsigned msie6:1;
3974 unsigned opera:1;
3975 unsigned gecko:1;
3976+ unsigned chrome:1;
3977+ unsigned safari:1;
3978 unsigned konqueror:1;
3979 } ngx_http_headers_in_t;
3980
3981@@ -428,9 +430,6 @@
3982 /* URI with "+" */
3983 unsigned plus_in_uri:1;
3984
3985- /* URI with "\0" or "%00" */
3986- unsigned zero_in_uri:1;
3987-
3988 unsigned invalid_header:1;
3989
3990 unsigned valid_location:1;
3991
3992=== modified file 'src/http/ngx_http_special_response.c'
3993--- src/http/ngx_http_special_response.c 2009-10-19 23:22:06 +0000
3994+++ src/http/ngx_http_special_response.c 2010-07-21 11:15:58 +0000
3995@@ -31,13 +31,13 @@
3996 ;
3997
3998
3999-static u_char ngx_http_msie_stub[] =
4000-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
4001-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
4002-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
4003-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
4004-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
4005-"<!-- The padding to disable MSIE's friendly error page -->" CRLF
4006+static u_char ngx_http_msie_padding[] =
4007+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
4008+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
4009+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
4010+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
4011+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
4012+"<!-- a padding to disable MSIE and Chrome friendly error page -->" CRLF
4013 ;
4014
4015
4016@@ -517,8 +517,6 @@
4017
4018 r->err_status = overwrite;
4019
4020- r->zero_in_uri = 0;
4021-
4022 if (ngx_http_complex_value(r, &err_page->value, &uri) != NGX_OK) {
4023 return NGX_ERROR;
4024 }
4025@@ -598,12 +596,12 @@
4026 r->headers_out.content_length_n = ngx_http_error_pages[err].len
4027 + len;
4028 if (clcf->msie_padding
4029- && r->headers_in.msie
4030+ && (r->headers_in.msie || r->headers_in.chrome)
4031 && r->http_version >= NGX_HTTP_VERSION_10
4032 && err >= NGX_HTTP_LEVEL_300)
4033 {
4034 r->headers_out.content_length_n +=
4035- sizeof(ngx_http_msie_stub) - 1;
4036+ sizeof(ngx_http_msie_padding) - 1;
4037 msie_padding = 1;
4038 }
4039
4040@@ -671,8 +669,8 @@
4041 }
4042
4043 b->memory = 1;
4044- b->pos = ngx_http_msie_stub;
4045- b->last = ngx_http_msie_stub + sizeof(ngx_http_msie_stub) - 1;
4046+ b->pos = ngx_http_msie_padding;
4047+ b->last = ngx_http_msie_padding + sizeof(ngx_http_msie_padding) - 1;
4048
4049 out[1].next = &out[2];
4050 out[2].buf = b;
4051
4052=== modified file 'src/http/ngx_http_upstream.c'
4053--- src/http/ngx_http_upstream.c 2010-03-03 23:50:36 +0000
4054+++ src/http/ngx_http_upstream.c 2010-07-21 11:15:58 +0000
4055@@ -363,8 +363,6 @@
4056
4057 if (u && u->cleanup) {
4058 ngx_http_upstream_cleanup(r);
4059- *u->cleanup = NULL;
4060- u->cleanup = NULL;
4061 }
4062
4063 u = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_t));
4064@@ -587,6 +585,13 @@
4065 ngx_int_t rc;
4066 ngx_http_cache_t *c;
4067
4068+ if (u->conf->no_cache) {
4069+ rc = ngx_http_cache(r, u->conf->no_cache);
4070+ if (rc != NGX_OK) {
4071+ return rc;
4072+ }
4073+ }
4074+
4075 if (!(r->method & u->conf->cache_methods)) {
4076 return NGX_DECLINED;
4077 }
4078@@ -1775,10 +1780,6 @@
4079 return NGX_DONE;
4080 }
4081
4082- if (flags & NGX_HTTP_ZERO_IN_URI) {
4083- r->zero_in_uri = 1;
4084- }
4085-
4086 if (r->method != NGX_HTTP_HEAD) {
4087 r->method = NGX_HTTP_GET;
4088 }
4089@@ -3004,16 +3005,18 @@
4090 return NGX_OK;
4091 }
4092
4093- last = h->value.data + h->value.len;
4094+ p = h->value.data;
4095+ last = p + h->value.len;
4096
4097- if (ngx_strlcasestrn(h->value.data, last, (u_char *) "no-cache", 8 - 1)
4098- != NULL)
4099+ if (ngx_strlcasestrn(p, last, (u_char *) "no-cache", 8 - 1) != NULL
4100+ || ngx_strlcasestrn(p, last, (u_char *) "no-store", 8 - 1) != NULL
4101+ || ngx_strlcasestrn(p, last, (u_char *) "private", 7 - 1) != NULL)
4102 {
4103 u->cacheable = 0;
4104 return NGX_OK;
4105 }
4106
4107- p = ngx_strlcasestrn(h->value.data, last, (u_char *) "max-age=", 8 - 1);
4108+ p = ngx_strlcasestrn(p, last, (u_char *) "max-age=", 8 - 1);
4109
4110 if (p == NULL) {
4111 return NGX_OK;
4112
4113=== modified file 'src/http/ngx_http_upstream.h'
4114--- src/http/ngx_http_upstream.h 2009-11-30 13:34:00 +0000
4115+++ src/http/ngx_http_upstream.h 2010-07-21 11:15:58 +0000
4116@@ -160,6 +160,7 @@
4117 ngx_uint_t cache_methods;
4118
4119 ngx_array_t *cache_valid;
4120+ ngx_array_t *no_cache; /* ngx_http_complex_value_t */
4121 #endif
4122
4123 ngx_array_t *store_lengths;
4124
4125=== modified file 'src/http/ngx_http_variables.c'
4126--- src/http/ngx_http_variables.c 2010-03-03 23:50:36 +0000
4127+++ src/http/ngx_http_variables.c 2010-07-21 11:15:58 +0000
4128@@ -196,7 +196,8 @@
4129 { ngx_string("server_name"), NULL, ngx_http_variable_server_name, 0, 0, 0 },
4130
4131 { ngx_string("request_method"), NULL,
4132- ngx_http_variable_request_method, 0, 0, 0 },
4133+ ngx_http_variable_request_method, 0,
4134+ NGX_HTTP_VAR_NOCACHEABLE, 0 },
4135
4136 { ngx_string("remote_user"), NULL, ngx_http_variable_remote_user, 0, 0, 0 },
4137
4138@@ -440,8 +441,7 @@
4139
4140
4141 ngx_http_variable_value_t *
4142-ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key,
4143- ngx_uint_t nowarn)
4144+ngx_http_get_variable(ngx_http_request_t *r, ngx_str_t *name, ngx_uint_t key)
4145 {
4146 ngx_http_variable_t *v;
4147 ngx_http_variable_value_t *vv;
4148@@ -453,7 +453,7 @@
4149
4150 if (v) {
4151 if (v->flags & NGX_HTTP_VAR_INDEXED) {
4152- return ngx_http_get_indexed_variable(r, v->index);
4153+ return ngx_http_get_flushed_variable(r, v->index);
4154
4155 } else {
4156
4157@@ -494,7 +494,7 @@
4158 return NULL;
4159 }
4160
4161- if (ngx_strncmp(name->data, "upstream_http_", 10) == 0) {
4162+ if (ngx_strncmp(name->data, "upstream_http_", 14) == 0) {
4163
4164 if (ngx_http_upstream_header_variable(r, vv, (uintptr_t) name)
4165 == NGX_OK)
4166@@ -525,11 +525,6 @@
4167
4168 vv->not_found = 1;
4169
4170- if (nowarn == 0) {
4171- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
4172- "unknown \"%V\" variable", name);
4173- }
4174-
4175 return vv;
4176 }
4177
4178@@ -1781,6 +1776,7 @@
4179 if (ngx_strncmp(v[i].name.data, "arg_", 4) == 0) {
4180 v[i].get_handler = ngx_http_variable_argument;
4181 v[i].data = (uintptr_t) &v[i].name;
4182+ v[i].flags = NGX_HTTP_VAR_NOCACHEABLE;
4183
4184 continue;
4185 }
4186
4187=== modified file 'src/http/ngx_http_variables.h'
4188--- src/http/ngx_http_variables.h 2009-10-19 23:22:06 +0000
4189+++ src/http/ngx_http_variables.h 2010-07-21 11:15:58 +0000
4190@@ -50,7 +50,7 @@
4191 ngx_uint_t index);
4192
4193 ngx_http_variable_value_t *ngx_http_get_variable(ngx_http_request_t *r,
4194- ngx_str_t *name, ngx_uint_t key, ngx_uint_t nowarn);
4195+ ngx_str_t *name, ngx_uint_t key);
4196
4197 ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v,
4198 ngx_str_t *var, ngx_list_part_t *part, size_t prefix);
4199
4200=== modified file 'src/mail/ngx_mail_pop3_handler.c'
4201--- src/mail/ngx_mail_pop3_handler.c 2009-10-19 23:22:06 +0000
4202+++ src/mail/ngx_mail_pop3_handler.c 2010-07-21 11:15:58 +0000
4203@@ -188,7 +188,6 @@
4204
4205 default:
4206 rc = NGX_MAIL_PARSE_INVALID_COMMAND;
4207- s->mail_state = ngx_pop3_start;
4208 break;
4209 }
4210
4211@@ -215,7 +214,6 @@
4212
4213 default:
4214 rc = NGX_MAIL_PARSE_INVALID_COMMAND;
4215- s->mail_state = ngx_pop3_start;
4216 break;
4217 }
4218
4219
4220=== modified file 'src/mail/ngx_mail_proxy_module.c'
4221--- src/mail/ngx_mail_proxy_module.c 2009-11-30 13:34:00 +0000
4222+++ src/mail/ngx_mail_proxy_module.c 2010-07-21 11:15:58 +0000
4223@@ -726,7 +726,7 @@
4224
4225 b->last += n;
4226
4227- if (b->last - b->pos < 5) {
4228+ if (b->last - b->pos < 4) {
4229 return NGX_AGAIN;
4230 }
4231
4232
4233=== modified file 'src/os/unix/ngx_errno.h'
4234--- src/os/unix/ngx_errno.h 2009-11-30 13:34:00 +0000
4235+++ src/os/unix/ngx_errno.h 2010-07-21 11:15:58 +0000
4236@@ -64,10 +64,22 @@
4237
4238 /* Solaris and Tru64 UNIX have thread-safe strerror() */
4239
4240-#define ngx_strerror_r(err, errstr, size) \
4241+#define ngx_strerror_r(err, errstr, size) \
4242 ngx_cpystrn(errstr, (u_char *) strerror(err), size)
4243
4244 #endif
4245
4246
4247+#if (NGX_HAVE_SYS_ERRLIST)
4248+
4249+#define ngx_sigsafe_strerror(err) \
4250+ (err > 0 && err < sys_nerr) ? sys_errlist[err] : "Unknown error"
4251+
4252+#else
4253+
4254+#define ngx_sigsafe_strerror(err) ""
4255+
4256+#endif
4257+
4258+
4259 #endif /* _NGX_ERRNO_H_INCLUDED_ */
4260
4261=== modified file 'src/os/unix/ngx_files.h'
4262--- src/os/unix/ngx_files.h 2010-03-03 23:50:36 +0000
4263+++ src/os/unix/ngx_files.h 2010-07-21 11:15:58 +0000
4264@@ -64,6 +64,7 @@
4265 #define NGX_FILE_OPEN 0
4266 #define NGX_FILE_TRUNCATE O_CREAT|O_TRUNC
4267 #define NGX_FILE_APPEND O_WRONLY|O_APPEND
4268+#define NGX_FILE_NONBLOCK O_NONBLOCK
4269
4270 #define NGX_FILE_DEFAULT_ACCESS 0644
4271 #define NGX_FILE_OWNER_ACCESS 0600
4272@@ -138,6 +139,9 @@
4273 #define ngx_fd_info(fd, sb) fstat(fd, sb)
4274 #define ngx_fd_info_n "fstat()"
4275
4276+#define ngx_link_info(file, sb) lstat((const char *) file, sb)
4277+#define ngx_link_info_n "lstat()"
4278+
4279 #define ngx_is_dir(sb) (S_ISDIR((sb)->st_mode))
4280 #define ngx_is_file(sb) (S_ISREG((sb)->st_mode))
4281 #define ngx_is_link(sb) (S_ISLNK((sb)->st_mode))
4282
4283=== modified file 'src/os/unix/ngx_process.c'
4284--- src/os/unix/ngx_process.c 2009-11-30 13:34:00 +0000
4285+++ src/os/unix/ngx_process.c 2010-07-21 11:15:58 +0000
4286@@ -315,7 +315,7 @@
4287 }
4288 }
4289
4290- ngx_time_update(0, 0);
4291+ ngx_time_sigsafe_update();
4292
4293 action = "";
4294
4295@@ -476,16 +476,17 @@
4296 */
4297
4298 if (err == NGX_ECHILD) {
4299- ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, errno,
4300- "waitpid() failed");
4301+ ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0,
4302+ "waitpid() failed (%d: %s)",
4303+ err, ngx_sigsafe_strerror(err));
4304 return;
4305 }
4306
4307 #endif
4308
4309- ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, errno,
4310- "waitpid() failed");
4311-
4312+ ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
4313+ "waitpid() failed (%d: %s)",
4314+ err, ngx_sigsafe_strerror(err));
4315 return;
4316 }
4317
4318
4319=== modified file 'src/os/unix/ngx_process_cycle.c'
4320--- src/os/unix/ngx_process_cycle.c 2010-03-03 23:50:36 +0000
4321+++ src/os/unix/ngx_process_cycle.c 2010-07-21 11:15:58 +0000
4322@@ -168,7 +168,7 @@
4323
4324 sigsuspend(&set);
4325
4326- ngx_time_update(0, 0);
4327+ ngx_time_update();
4328
4329 ngx_log_debug1(NGX_LOG_DEBUG_EVENT, cycle->log, 0,
4330 "wake up, sigio %i", sigio);
4331@@ -1337,7 +1337,7 @@
4332
4333 next = (n <= next) ? n : next;
4334
4335- ngx_time_update(0, 0);
4336+ ngx_time_update();
4337 }
4338 }
4339
4340@@ -1367,7 +1367,7 @@
4341
4342 if (path[i]->loader) {
4343 path[i]->loader(path[i]->data);
4344- ngx_time_update(0, 0);
4345+ ngx_time_update();
4346 }
4347 }
4348

Subscribers

People subscribed via source and target branches