nginxtra 1.6.3.9 → 1.8.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/nginxtra +1 -1
- data/bin/nginxtra_rails +1 -1
- data/lib/nginxtra/version.rb +1 -1
- data/vendor/nginx/CHANGES +358 -14
- data/vendor/nginx/CHANGES.ru +372 -18
- data/vendor/nginx/LICENSE +2 -2
- data/vendor/nginx/auto/cc/clang +5 -0
- data/vendor/nginx/auto/cc/gcc +5 -0
- data/vendor/nginx/auto/lib/google-perftools/conf +1 -1
- data/vendor/nginx/auto/lib/openssl/make +0 -5
- data/vendor/nginx/auto/lib/perl/conf +9 -1
- data/vendor/nginx/auto/make +1 -1
- data/vendor/nginx/auto/modules +11 -0
- data/vendor/nginx/auto/options +10 -2
- data/vendor/nginx/auto/os/darwin +0 -1
- data/vendor/nginx/auto/os/freebsd +6 -23
- data/vendor/nginx/auto/sources +16 -14
- data/vendor/nginx/auto/summary +3 -24
- data/vendor/nginx/auto/threads +20 -0
- data/vendor/nginx/auto/types/sizeof +2 -12
- data/vendor/nginx/auto/unix +50 -6
- data/vendor/nginx/configure +5 -0
- data/vendor/nginx/contrib/vim/syntax/nginx.vim +183 -50
- data/vendor/nginx/src/core/nginx.c +21 -9
- data/vendor/nginx/src/core/nginx.h +8 -2
- data/vendor/nginx/src/core/ngx_buf.c +88 -0
- data/vendor/nginx/src/core/ngx_buf.h +15 -1
- data/vendor/nginx/src/core/ngx_conf_file.c +4 -1
- data/vendor/nginx/src/core/ngx_connection.c +25 -66
- data/vendor/nginx/src/core/ngx_connection.h +1 -3
- data/vendor/nginx/src/core/ngx_core.h +11 -3
- data/vendor/nginx/src/core/ngx_crypt.c +1 -1
- data/vendor/nginx/src/core/ngx_cycle.c +7 -1
- data/vendor/nginx/src/core/ngx_cycle.h +6 -2
- data/vendor/nginx/src/core/ngx_file.c +13 -5
- data/vendor/nginx/src/core/ngx_file.h +6 -0
- data/vendor/nginx/src/core/ngx_log.c +215 -21
- data/vendor/nginx/src/core/ngx_log.h +9 -1
- data/vendor/nginx/src/core/ngx_output_chain.c +104 -15
- data/vendor/nginx/src/core/ngx_palloc.c +3 -7
- data/vendor/nginx/src/core/ngx_rbtree.c +2 -4
- data/vendor/nginx/src/core/ngx_rbtree.h +2 -4
- data/vendor/nginx/src/core/ngx_regex.c +14 -6
- data/vendor/nginx/src/core/ngx_resolver.c +16 -23
- data/vendor/nginx/src/core/ngx_resolver.h +8 -7
- data/vendor/nginx/src/core/ngx_shmtx.c +1 -1
- data/vendor/nginx/src/core/ngx_slab.c +89 -2
- data/vendor/nginx/src/core/ngx_slab.h +3 -0
- data/vendor/nginx/src/core/ngx_string.c +58 -2
- data/vendor/nginx/src/core/ngx_string.h +1 -0
- data/vendor/nginx/src/core/ngx_syslog.c +374 -0
- data/vendor/nginx/src/core/ngx_syslog.h +30 -0
- data/vendor/nginx/src/core/ngx_thread_pool.c +630 -0
- data/vendor/nginx/src/core/ngx_thread_pool.h +36 -0
- data/vendor/nginx/src/core/ngx_times.c +19 -2
- data/vendor/nginx/src/core/ngx_times.h +1 -0
- data/vendor/nginx/src/event/modules/ngx_aio_module.c +1 -1
- data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +9 -24
- data/vendor/nginx/src/event/modules/ngx_epoll_module.c +152 -28
- data/vendor/nginx/src/event/modules/ngx_eventport_module.c +43 -25
- data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +86 -156
- data/vendor/nginx/src/event/modules/ngx_poll_module.c +21 -37
- data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +15 -27
- data/vendor/nginx/src/event/modules/ngx_select_module.c +10 -12
- data/vendor/nginx/src/event/modules/ngx_win32_select_module.c +7 -9
- data/vendor/nginx/src/event/ngx_event.c +5 -33
- data/vendor/nginx/src/event/ngx_event.h +15 -50
- data/vendor/nginx/src/event/ngx_event_accept.c +11 -10
- data/vendor/nginx/src/event/ngx_event_connect.c +0 -11
- data/vendor/nginx/src/event/ngx_event_connect.h +1 -4
- data/vendor/nginx/src/event/ngx_event_openssl.c +622 -38
- data/vendor/nginx/src/event/ngx_event_openssl.h +20 -2
- data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +5 -1
- data/vendor/nginx/src/event/ngx_event_pipe.c +45 -19
- data/vendor/nginx/src/event/ngx_event_pipe.h +3 -0
- data/vendor/nginx/src/event/ngx_event_posted.c +7 -145
- data/vendor/nginx/src/event/ngx_event_posted.h +12 -39
- data/vendor/nginx/src/event/ngx_event_timer.c +50 -70
- data/vendor/nginx/src/event/ngx_event_timer.h +2 -14
- data/vendor/nginx/src/http/modules/ngx_http_addition_filter_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_autoindex_module.c +416 -71
- data/vendor/nginx/src/http/modules/ngx_http_charset_filter_module.c +19 -15
- data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +16 -4
- data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +601 -134
- data/vendor/nginx/src/http/modules/ngx_http_geo_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_geoip_module.c +9 -3
- data/vendor/nginx/src/http/modules/ngx_http_gunzip_filter_module.c +9 -3
- data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +9 -3
- data/vendor/nginx/src/http/modules/ngx_http_gzip_static_module.c +0 -2
- data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +197 -91
- data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +1 -0
- data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +65 -162
- data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +53 -67
- data/vendor/nginx/src/http/modules/ngx_http_log_module.c +128 -23
- data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +25 -6
- data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +39 -13
- data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +697 -141
- data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +5 -1
- data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +282 -125
- data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +4 -1
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +44 -1
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.h +2 -0
- data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +10 -8
- data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +18 -3
- data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +641 -0
- data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +3 -21
- data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +0 -5
- data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +449 -125
- data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +4 -2
- data/vendor/nginx/src/http/modules/perl/ngx_http_perl_module.c +2 -1
- data/vendor/nginx/src/http/ngx_http.c +10 -5
- data/vendor/nginx/src/http/ngx_http.h +4 -4
- data/vendor/nginx/src/http/ngx_http_cache.h +26 -1
- data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +109 -68
- data/vendor/nginx/src/http/ngx_http_core_module.c +191 -46
- data/vendor/nginx/src/http/ngx_http_core_module.h +16 -4
- data/vendor/nginx/src/http/ngx_http_file_cache.c +584 -67
- data/vendor/nginx/src/http/ngx_http_parse.c +55 -4
- data/vendor/nginx/src/http/ngx_http_request.c +14 -6
- data/vendor/nginx/src/http/ngx_http_request.h +12 -4
- data/vendor/nginx/src/http/ngx_http_request_body.c +114 -28
- data/vendor/nginx/src/http/ngx_http_spdy.c +383 -229
- data/vendor/nginx/src/http/ngx_http_spdy.h +8 -5
- data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +12 -4
- data/vendor/nginx/src/http/ngx_http_special_response.c +2 -2
- data/vendor/nginx/src/http/ngx_http_upstream.c +808 -132
- data/vendor/nginx/src/http/ngx_http_upstream.h +33 -3
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +72 -65
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +1 -2
- data/vendor/nginx/src/http/ngx_http_variables.c +47 -3
- data/vendor/nginx/src/http/ngx_http_write_filter_module.c +15 -6
- data/vendor/nginx/src/mail/ngx_mail.c +2 -3
- data/vendor/nginx/src/mail/ngx_mail.h +2 -0
- data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +140 -11
- data/vendor/nginx/src/mail/ngx_mail_core_module.c +3 -3
- data/vendor/nginx/src/mail/ngx_mail_handler.c +79 -2
- data/vendor/nginx/src/mail/ngx_mail_imap_module.c +3 -1
- data/vendor/nginx/src/mail/ngx_mail_pop3_module.c +3 -1
- data/vendor/nginx/src/mail/ngx_mail_smtp_module.c +3 -1
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +125 -1
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.h +8 -0
- data/vendor/nginx/src/misc/ngx_cpp_test_module.cpp +1 -1
- data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_channel.c +0 -7
- data/vendor/nginx/src/os/unix/ngx_darwin_config.h +0 -3
- data/vendor/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +44 -208
- data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +25 -17
- data/vendor/nginx/src/os/unix/ngx_files.c +109 -0
- data/vendor/nginx/src/os/unix/ngx_files.h +6 -0
- data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +0 -6
- data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +78 -206
- data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +25 -14
- data/vendor/nginx/src/os/unix/ngx_linux_config.h +4 -1
- data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +235 -194
- data/vendor/nginx/src/os/unix/ngx_os.h +25 -3
- data/vendor/nginx/src/os/unix/ngx_posix_init.c +4 -2
- data/vendor/nginx/src/os/unix/ngx_process_cycle.c +13 -195
- data/vendor/nginx/src/os/unix/ngx_process_cycle.h +0 -1
- data/vendor/nginx/src/os/unix/ngx_readv_chain.c +27 -108
- data/vendor/nginx/src/os/unix/ngx_setproctitle.h +2 -2
- data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +12 -67
- data/vendor/nginx/src/os/unix/ngx_thread.h +26 -83
- data/vendor/nginx/src/os/unix/ngx_thread_cond.c +87 -0
- data/vendor/nginx/src/os/unix/ngx_thread_id.c +70 -0
- data/vendor/nginx/src/os/unix/ngx_thread_mutex.c +174 -0
- data/vendor/nginx/src/os/unix/ngx_user.c +2 -20
- data/vendor/nginx/src/os/unix/ngx_writev_chain.c +129 -98
- metadata +16 -17
- data/vendor/nginx/auto/lib/zlib/patch.zlib.h +0 -10
- data/vendor/nginx/src/event/ngx_event_busy_lock.c +0 -286
- data/vendor/nginx/src/event/ngx_event_busy_lock.h +0 -65
- data/vendor/nginx/src/event/ngx_event_mutex.c +0 -70
- data/vendor/nginx/src/http/ngx_http_busy_lock.c +0 -307
- data/vendor/nginx/src/http/ngx_http_busy_lock.h +0 -54
- data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +0 -756
- data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +0 -122
- data/vendor/nginx/src/os/unix/ngx_pthread_thread.c +0 -278
- data/vendor/nginx/src/os/unix/rfork_thread.S +0 -73
@@ -43,6 +43,8 @@
|
|
43
43
|
|
44
44
|
|
45
45
|
typedef u_char *(*ngx_log_handler_pt) (ngx_log_t *log, u_char *buf, size_t len);
|
46
|
+
typedef void (*ngx_log_writer_pt) (ngx_log_t *log, ngx_uint_t level,
|
47
|
+
u_char *buf, size_t len);
|
46
48
|
|
47
49
|
|
48
50
|
struct ngx_log_s {
|
@@ -51,9 +53,14 @@ struct ngx_log_s {
|
|
51
53
|
|
52
54
|
ngx_atomic_uint_t connection;
|
53
55
|
|
56
|
+
time_t disk_full_time;
|
57
|
+
|
54
58
|
ngx_log_handler_pt handler;
|
55
59
|
void *data;
|
56
60
|
|
61
|
+
ngx_log_writer_pt writer;
|
62
|
+
void *wdata;
|
63
|
+
|
57
64
|
/*
|
58
65
|
* we declare "action" as "char *" because the actions are usually
|
59
66
|
* the static strings and in the "u_char *" case we have to override
|
@@ -227,6 +234,7 @@ void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...);
|
|
227
234
|
u_char *ngx_log_errno(u_char *buf, u_char *last, ngx_err_t err);
|
228
235
|
ngx_int_t ngx_log_open_default(ngx_cycle_t *cycle);
|
229
236
|
ngx_int_t ngx_log_redirect_stderr(ngx_cycle_t *cycle);
|
237
|
+
ngx_log_t *ngx_log_get_file_log(ngx_log_t *head);
|
230
238
|
char *ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head);
|
231
239
|
|
232
240
|
|
@@ -242,7 +250,7 @@ char *ngx_log_set_log(ngx_conf_t *cf, ngx_log_t **head);
|
|
242
250
|
static ngx_inline void
|
243
251
|
ngx_write_stderr(char *text)
|
244
252
|
{
|
245
|
-
(void) ngx_write_fd(ngx_stderr, text,
|
253
|
+
(void) ngx_write_fd(ngx_stderr, text, ngx_strlen(text));
|
246
254
|
}
|
247
255
|
|
248
256
|
|
@@ -29,6 +29,10 @@
|
|
29
29
|
|
30
30
|
static ngx_inline ngx_int_t
|
31
31
|
ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf);
|
32
|
+
#if (NGX_HAVE_AIO_SENDFILE)
|
33
|
+
static ngx_int_t ngx_output_chain_aio_setup(ngx_output_chain_ctx_t *ctx,
|
34
|
+
ngx_file_t *file);
|
35
|
+
#endif
|
32
36
|
static ngx_int_t ngx_output_chain_add_copy(ngx_pool_t *pool,
|
33
37
|
ngx_chain_t **chain, ngx_chain_t *in);
|
34
38
|
static ngx_int_t ngx_output_chain_align_file_buf(ngx_output_chain_ctx_t *ctx,
|
@@ -45,8 +49,12 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
|
|
45
49
|
ngx_int_t rc, last;
|
46
50
|
ngx_chain_t *cl, *out, **last_out;
|
47
51
|
|
48
|
-
if (ctx->in == NULL && ctx->busy == NULL
|
49
|
-
|
52
|
+
if (ctx->in == NULL && ctx->busy == NULL
|
53
|
+
#if (NGX_HAVE_FILE_AIO || NGX_THREADS)
|
54
|
+
&& !ctx->aio
|
55
|
+
#endif
|
56
|
+
)
|
57
|
+
{
|
50
58
|
/*
|
51
59
|
* the short path for the case when the ctx->in and ctx->busy chains
|
52
60
|
* are empty, the incoming chain is empty too or has the single buf
|
@@ -81,7 +89,7 @@ ngx_output_chain(ngx_output_chain_ctx_t *ctx, ngx_chain_t *in)
|
|
81
89
|
|
82
90
|
for ( ;; ) {
|
83
91
|
|
84
|
-
#if (NGX_HAVE_FILE_AIO)
|
92
|
+
#if (NGX_HAVE_FILE_AIO || NGX_THREADS)
|
85
93
|
if (ctx->aio) {
|
86
94
|
return NGX_AGAIN;
|
87
95
|
}
|
@@ -225,6 +233,13 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
|
|
225
233
|
return 1;
|
226
234
|
}
|
227
235
|
|
236
|
+
#if (NGX_THREADS)
|
237
|
+
if (buf->in_file) {
|
238
|
+
buf->file->thread_handler = ctx->thread_handler;
|
239
|
+
buf->file->thread_ctx = ctx->filter_ctx;
|
240
|
+
}
|
241
|
+
#endif
|
242
|
+
|
228
243
|
if (buf->in_file && buf->file->directio) {
|
229
244
|
return 0;
|
230
245
|
}
|
@@ -248,6 +263,12 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
|
|
248
263
|
buf->in_file = 0;
|
249
264
|
}
|
250
265
|
|
266
|
+
#if (NGX_HAVE_AIO_SENDFILE)
|
267
|
+
if (ctx->aio_preload && buf->in_file) {
|
268
|
+
(void) ngx_output_chain_aio_setup(ctx, buf->file);
|
269
|
+
}
|
270
|
+
#endif
|
271
|
+
|
251
272
|
if (ctx->need_in_memory && !ngx_buf_in_memory(buf)) {
|
252
273
|
return 0;
|
253
274
|
}
|
@@ -260,6 +281,28 @@ ngx_output_chain_as_is(ngx_output_chain_ctx_t *ctx, ngx_buf_t *buf)
|
|
260
281
|
}
|
261
282
|
|
262
283
|
|
284
|
+
#if (NGX_HAVE_AIO_SENDFILE)
|
285
|
+
|
286
|
+
static ngx_int_t
|
287
|
+
ngx_output_chain_aio_setup(ngx_output_chain_ctx_t *ctx, ngx_file_t *file)
|
288
|
+
{
|
289
|
+
ngx_event_aio_t *aio;
|
290
|
+
|
291
|
+
if (file->aio == NULL && ngx_file_aio_init(file, ctx->pool) != NGX_OK) {
|
292
|
+
return NGX_ERROR;
|
293
|
+
}
|
294
|
+
|
295
|
+
aio = file->aio;
|
296
|
+
|
297
|
+
aio->data = ctx->filter_ctx;
|
298
|
+
aio->preload_handler = ctx->aio_preload;
|
299
|
+
|
300
|
+
return NGX_OK;
|
301
|
+
}
|
302
|
+
|
303
|
+
#endif
|
304
|
+
|
305
|
+
|
263
306
|
static ngx_int_t
|
264
307
|
ngx_output_chain_add_copy(ngx_pool_t *pool, ngx_chain_t **chain,
|
265
308
|
ngx_chain_t *in)
|
@@ -523,7 +566,6 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx)
|
|
523
566
|
#endif
|
524
567
|
|
525
568
|
#if (NGX_HAVE_FILE_AIO)
|
526
|
-
|
527
569
|
if (ctx->aio_handler) {
|
528
570
|
n = ngx_file_aio_read(src->file, dst->pos, (size_t) size,
|
529
571
|
src->file_pos, ctx->pool);
|
@@ -532,15 +574,23 @@ ngx_output_chain_copy_buf(ngx_output_chain_ctx_t *ctx)
|
|
532
574
|
return NGX_AGAIN;
|
533
575
|
}
|
534
576
|
|
535
|
-
} else
|
577
|
+
} else
|
578
|
+
#endif
|
579
|
+
#if (NGX_THREADS)
|
580
|
+
if (src->file->thread_handler) {
|
581
|
+
n = ngx_thread_read(&ctx->thread_task, src->file, dst->pos,
|
582
|
+
(size_t) size, src->file_pos, ctx->pool);
|
583
|
+
if (n == NGX_AGAIN) {
|
584
|
+
ctx->aio = 1;
|
585
|
+
return NGX_AGAIN;
|
586
|
+
}
|
587
|
+
|
588
|
+
} else
|
589
|
+
#endif
|
590
|
+
{
|
536
591
|
n = ngx_read_file(src->file, dst->pos, (size_t) size,
|
537
592
|
src->file_pos);
|
538
593
|
}
|
539
|
-
#else
|
540
|
-
|
541
|
-
n = ngx_read_file(src->file, dst->pos, (size_t) size, src->file_pos);
|
542
|
-
|
543
|
-
#endif
|
544
594
|
|
545
595
|
#if (NGX_HAVE_ALIGNED_DIRECTIO)
|
546
596
|
|
@@ -604,7 +654,7 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
|
|
604
654
|
ngx_chain_writer_ctx_t *ctx = data;
|
605
655
|
|
606
656
|
off_t size;
|
607
|
-
ngx_chain_t *cl;
|
657
|
+
ngx_chain_t *cl, *ln, *chain;
|
608
658
|
ngx_connection_t *c;
|
609
659
|
|
610
660
|
c = ctx->connection;
|
@@ -613,7 +663,23 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
|
|
613
663
|
|
614
664
|
#if 1
|
615
665
|
if (ngx_buf_size(in->buf) == 0 && !ngx_buf_special(in->buf)) {
|
666
|
+
|
667
|
+
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
|
668
|
+
"zero size buf in chain writer "
|
669
|
+
"t:%d r:%d f:%d %p %p-%p %p %O-%O",
|
670
|
+
in->buf->temporary,
|
671
|
+
in->buf->recycled,
|
672
|
+
in->buf->in_file,
|
673
|
+
in->buf->start,
|
674
|
+
in->buf->pos,
|
675
|
+
in->buf->last,
|
676
|
+
in->buf->file,
|
677
|
+
in->buf->file_pos,
|
678
|
+
in->buf->file_last);
|
679
|
+
|
616
680
|
ngx_debug_point();
|
681
|
+
|
682
|
+
continue;
|
617
683
|
}
|
618
684
|
#endif
|
619
685
|
|
@@ -641,9 +707,24 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
|
|
641
707
|
|
642
708
|
#if 1
|
643
709
|
if (ngx_buf_size(cl->buf) == 0 && !ngx_buf_special(cl->buf)) {
|
710
|
+
|
711
|
+
ngx_log_error(NGX_LOG_ALERT, ctx->pool->log, 0,
|
712
|
+
"zero size buf in chain writer "
|
713
|
+
"t:%d r:%d f:%d %p %p-%p %p %O-%O",
|
714
|
+
cl->buf->temporary,
|
715
|
+
cl->buf->recycled,
|
716
|
+
cl->buf->in_file,
|
717
|
+
cl->buf->start,
|
718
|
+
cl->buf->pos,
|
719
|
+
cl->buf->last,
|
720
|
+
cl->buf->file,
|
721
|
+
cl->buf->file_pos,
|
722
|
+
cl->buf->file_last);
|
723
|
+
|
644
724
|
ngx_debug_point();
|
645
|
-
}
|
646
725
|
|
726
|
+
continue;
|
727
|
+
}
|
647
728
|
#endif
|
648
729
|
|
649
730
|
size += ngx_buf_size(cl->buf);
|
@@ -653,15 +734,23 @@ ngx_chain_writer(void *data, ngx_chain_t *in)
|
|
653
734
|
return NGX_OK;
|
654
735
|
}
|
655
736
|
|
656
|
-
|
737
|
+
chain = c->send_chain(c, ctx->out, ctx->limit);
|
657
738
|
|
658
739
|
ngx_log_debug1(NGX_LOG_DEBUG_CORE, c->log, 0,
|
659
|
-
"chain writer out: %p",
|
740
|
+
"chain writer out: %p", chain);
|
660
741
|
|
661
|
-
if (
|
742
|
+
if (chain == NGX_CHAIN_ERROR) {
|
662
743
|
return NGX_ERROR;
|
663
744
|
}
|
664
745
|
|
746
|
+
for (cl = ctx->out; cl && cl != chain; /* void */) {
|
747
|
+
ln = cl;
|
748
|
+
cl = cl->next;
|
749
|
+
ngx_free_chain(ctx->pool, ln);
|
750
|
+
}
|
751
|
+
|
752
|
+
ctx->out = chain;
|
753
|
+
|
665
754
|
if (ctx->out == NULL) {
|
666
755
|
ctx->last = &ctx->out;
|
667
756
|
|
@@ -181,7 +181,7 @@ ngx_palloc_block(ngx_pool_t *pool, size_t size)
|
|
181
181
|
{
|
182
182
|
u_char *m;
|
183
183
|
size_t psize;
|
184
|
-
ngx_pool_t *p, *new
|
184
|
+
ngx_pool_t *p, *new;
|
185
185
|
|
186
186
|
psize = (size_t) (pool->d.end - (u_char *) pool);
|
187
187
|
|
@@ -200,18 +200,14 @@ ngx_palloc_block(ngx_pool_t *pool, size_t size)
|
|
200
200
|
m = ngx_align_ptr(m, NGX_ALIGNMENT);
|
201
201
|
new->d.last = m + size;
|
202
202
|
|
203
|
-
|
204
|
-
|
205
|
-
for (p = current; p->d.next; p = p->d.next) {
|
203
|
+
for (p = pool->current; p->d.next; p = p->d.next) {
|
206
204
|
if (p->d.failed++ > 4) {
|
207
|
-
current = p->d.next;
|
205
|
+
pool->current = p->d.next;
|
208
206
|
}
|
209
207
|
}
|
210
208
|
|
211
209
|
p->d.next = new;
|
212
210
|
|
213
|
-
pool->current = current ? current : new;
|
214
|
-
|
215
211
|
return m;
|
216
212
|
}
|
217
213
|
|
@@ -22,8 +22,7 @@ static ngx_inline void ngx_rbtree_right_rotate(ngx_rbtree_node_t **root,
|
|
22
22
|
|
23
23
|
|
24
24
|
void
|
25
|
-
ngx_rbtree_insert(
|
26
|
-
ngx_rbtree_node_t *node)
|
25
|
+
ngx_rbtree_insert(ngx_rbtree_t *tree, ngx_rbtree_node_t *node)
|
27
26
|
{
|
28
27
|
ngx_rbtree_node_t **root, *temp, *sentinel;
|
29
28
|
|
@@ -155,8 +154,7 @@ ngx_rbtree_insert_timer_value(ngx_rbtree_node_t *temp, ngx_rbtree_node_t *node,
|
|
155
154
|
|
156
155
|
|
157
156
|
void
|
158
|
-
ngx_rbtree_delete(
|
159
|
-
ngx_rbtree_node_t *node)
|
157
|
+
ngx_rbtree_delete(ngx_rbtree_t *tree, ngx_rbtree_node_t *node)
|
160
158
|
{
|
161
159
|
ngx_uint_t red;
|
162
160
|
ngx_rbtree_node_t **root, *sentinel, *subst, *temp, *w;
|
@@ -48,10 +48,8 @@ struct ngx_rbtree_s {
|
|
48
48
|
(tree)->insert = i
|
49
49
|
|
50
50
|
|
51
|
-
void ngx_rbtree_insert(
|
52
|
-
|
53
|
-
void ngx_rbtree_delete(ngx_thread_volatile ngx_rbtree_t *tree,
|
54
|
-
ngx_rbtree_node_t *node);
|
51
|
+
void ngx_rbtree_insert(ngx_rbtree_t *tree, ngx_rbtree_node_t *node);
|
52
|
+
void ngx_rbtree_delete(ngx_rbtree_t *tree, ngx_rbtree_node_t *node);
|
55
53
|
void ngx_rbtree_insert_value(ngx_rbtree_node_t *root, ngx_rbtree_node_t *node,
|
56
54
|
ngx_rbtree_node_t *sentinel);
|
57
55
|
void ngx_rbtree_insert_timer_value(ngx_rbtree_node_t *root,
|
@@ -80,7 +80,7 @@ ngx_regex_init(void)
|
|
80
80
|
static ngx_inline void
|
81
81
|
ngx_regex_malloc_init(ngx_pool_t *pool)
|
82
82
|
{
|
83
|
-
#if (
|
83
|
+
#if (NGX_OLD_THREADS)
|
84
84
|
ngx_core_tls_t *tls;
|
85
85
|
|
86
86
|
if (ngx_threaded) {
|
@@ -98,7 +98,7 @@ ngx_regex_malloc_init(ngx_pool_t *pool)
|
|
98
98
|
static ngx_inline void
|
99
99
|
ngx_regex_malloc_done(void)
|
100
100
|
{
|
101
|
-
#if (
|
101
|
+
#if (NGX_OLD_THREADS)
|
102
102
|
ngx_core_tls_t *tls;
|
103
103
|
|
104
104
|
if (ngx_threaded) {
|
@@ -149,7 +149,7 @@ ngx_regex_compile(ngx_regex_compile_t *rc)
|
|
149
149
|
|
150
150
|
rc->regex = ngx_pcalloc(rc->pool, sizeof(ngx_regex_t));
|
151
151
|
if (rc->regex == NULL) {
|
152
|
-
|
152
|
+
goto nomem;
|
153
153
|
}
|
154
154
|
|
155
155
|
rc->regex->code = re;
|
@@ -159,7 +159,7 @@ ngx_regex_compile(ngx_regex_compile_t *rc)
|
|
159
159
|
if (ngx_pcre_studies != NULL) {
|
160
160
|
elt = ngx_list_push(ngx_pcre_studies);
|
161
161
|
if (elt == NULL) {
|
162
|
-
|
162
|
+
goto nomem;
|
163
163
|
}
|
164
164
|
|
165
165
|
elt->regex = rc->regex;
|
@@ -204,7 +204,15 @@ failed:
|
|
204
204
|
|
205
205
|
rc->err.len = ngx_snprintf(rc->err.data, rc->err.len, p, &rc->pattern, n)
|
206
206
|
- rc->err.data;
|
207
|
-
return
|
207
|
+
return NGX_ERROR;
|
208
|
+
|
209
|
+
nomem:
|
210
|
+
|
211
|
+
rc->err.len = ngx_snprintf(rc->err.data, rc->err.len,
|
212
|
+
"regex \"%V\" compilation failed: no memory",
|
213
|
+
&rc->pattern)
|
214
|
+
- rc->err.data;
|
215
|
+
return NGX_ERROR;
|
208
216
|
}
|
209
217
|
|
210
218
|
|
@@ -245,7 +253,7 @@ static void * ngx_libc_cdecl
|
|
245
253
|
ngx_regex_malloc(size_t size)
|
246
254
|
{
|
247
255
|
ngx_pool_t *pool;
|
248
|
-
#if (
|
256
|
+
#if (NGX_OLD_THREADS)
|
249
257
|
ngx_core_tls_t *tls;
|
250
258
|
|
251
259
|
if (ngx_threaded) {
|
@@ -48,6 +48,11 @@ typedef struct {
|
|
48
48
|
} ngx_resolver_an_t;
|
49
49
|
|
50
50
|
|
51
|
+
#define ngx_resolver_node(n) \
|
52
|
+
(ngx_resolver_node_t *) \
|
53
|
+
((u_char *) (n) - offsetof(ngx_resolver_node_t, node))
|
54
|
+
|
55
|
+
|
51
56
|
ngx_int_t ngx_udp_connect(ngx_udp_connection_t *uc);
|
52
57
|
|
53
58
|
|
@@ -288,7 +293,7 @@ ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
|
|
288
293
|
|
289
294
|
while (tree->root != tree->sentinel) {
|
290
295
|
|
291
|
-
rn = (
|
296
|
+
rn = ngx_resolver_node(ngx_rbtree_min(tree->root, tree->sentinel));
|
292
297
|
|
293
298
|
ngx_queue_remove(&rn->queue);
|
294
299
|
|
@@ -666,7 +671,7 @@ ngx_resolve_name_locked(ngx_resolver_t *r, ngx_resolver_ctx_t *ctx)
|
|
666
671
|
ctx->event->handler = ngx_resolver_timeout_handler;
|
667
672
|
ctx->event->data = rn;
|
668
673
|
ctx->event->log = r->log;
|
669
|
-
|
674
|
+
rn->ident = -1;
|
670
675
|
|
671
676
|
ngx_add_timer(ctx->event, ctx->timeout);
|
672
677
|
}
|
@@ -859,7 +864,7 @@ ngx_resolve_addr(ngx_resolver_ctx_t *ctx)
|
|
859
864
|
ctx->event->handler = ngx_resolver_timeout_handler;
|
860
865
|
ctx->event->data = rn;
|
861
866
|
ctx->event->log = r->log;
|
862
|
-
|
867
|
+
rn->ident = -1;
|
863
868
|
|
864
869
|
ngx_add_timer(ctx->event, ctx->timeout);
|
865
870
|
|
@@ -2290,7 +2295,7 @@ ngx_resolver_lookup_name(ngx_resolver_t *r, ngx_str_t *name, uint32_t hash)
|
|
2290
2295
|
|
2291
2296
|
/* hash == node->key */
|
2292
2297
|
|
2293
|
-
rn = (
|
2298
|
+
rn = ngx_resolver_node(node);
|
2294
2299
|
|
2295
2300
|
rc = ngx_memn2cmp(name->data, rn->name, name->len, rn->nlen);
|
2296
2301
|
|
@@ -2329,7 +2334,7 @@ ngx_resolver_lookup_addr(ngx_resolver_t *r, in_addr_t addr)
|
|
2329
2334
|
|
2330
2335
|
/* addr == node->key */
|
2331
2336
|
|
2332
|
-
return (
|
2337
|
+
return ngx_resolver_node(node);
|
2333
2338
|
}
|
2334
2339
|
|
2335
2340
|
/* not found */
|
@@ -2365,7 +2370,7 @@ ngx_resolver_lookup_addr6(ngx_resolver_t *r, struct in6_addr *addr,
|
|
2365
2370
|
|
2366
2371
|
/* hash == node->key */
|
2367
2372
|
|
2368
|
-
rn = (
|
2373
|
+
rn = ngx_resolver_node(node);
|
2369
2374
|
|
2370
2375
|
rc = ngx_memcmp(addr, &rn->addr6, 16);
|
2371
2376
|
|
@@ -2403,8 +2408,8 @@ ngx_resolver_rbtree_insert_value(ngx_rbtree_node_t *temp,
|
|
2403
2408
|
|
2404
2409
|
} else { /* node->key == temp->key */
|
2405
2410
|
|
2406
|
-
rn = (
|
2407
|
-
rn_temp = (
|
2411
|
+
rn = ngx_resolver_node(node);
|
2412
|
+
rn_temp = ngx_resolver_node(temp);
|
2408
2413
|
|
2409
2414
|
p = (ngx_memn2cmp(rn->name, rn_temp->name, rn->nlen, rn_temp->nlen)
|
2410
2415
|
< 0) ? &temp->left : &temp->right;
|
@@ -2446,8 +2451,8 @@ ngx_resolver_rbtree_insert_addr6_value(ngx_rbtree_node_t *temp,
|
|
2446
2451
|
|
2447
2452
|
} else { /* node->key == temp->key */
|
2448
2453
|
|
2449
|
-
rn = (
|
2450
|
-
rn_temp = (
|
2454
|
+
rn = ngx_resolver_node(node);
|
2455
|
+
rn_temp = ngx_resolver_node(temp);
|
2451
2456
|
|
2452
2457
|
p = (ngx_memcmp(&rn->addr6, &rn_temp->addr6, 16)
|
2453
2458
|
< 0) ? &temp->left : &temp->right;
|
@@ -2747,8 +2752,7 @@ done:
|
|
2747
2752
|
}
|
2748
2753
|
|
2749
2754
|
if (len == -1) {
|
2750
|
-
name
|
2751
|
-
name->data = NULL;
|
2755
|
+
ngx_str_null(name);
|
2752
2756
|
return NGX_OK;
|
2753
2757
|
}
|
2754
2758
|
|
@@ -3083,17 +3087,6 @@ ngx_udp_connect(ngx_udp_connection_t *uc)
|
|
3083
3087
|
|
3084
3088
|
c->number = ngx_atomic_fetch_add(ngx_connection_counter, 1);
|
3085
3089
|
|
3086
|
-
#if (NGX_THREADS)
|
3087
|
-
|
3088
|
-
/* TODO: lock event when call completion handler */
|
3089
|
-
|
3090
|
-
rev->lock = &c->lock;
|
3091
|
-
wev->lock = &c->lock;
|
3092
|
-
rev->own_lock = &c->lock;
|
3093
|
-
wev->own_lock = &c->lock;
|
3094
|
-
|
3095
|
-
#endif
|
3096
|
-
|
3097
3090
|
ngx_log_debug3(NGX_LOG_DEBUG_EVENT, &uc->log, 0,
|
3098
3091
|
"connect to %V, fd:%d #%uA", &uc->server, s, c->number);
|
3099
3092
|
|