nginxtra 1.8.1.12 → 1.10.1.12
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 +363 -25
- data/vendor/nginx/CHANGES.ru +365 -21
- data/vendor/nginx/LICENSE +2 -2
- data/vendor/nginx/auto/cc/conf +32 -0
- data/vendor/nginx/auto/cc/gcc +1 -1
- data/vendor/nginx/auto/cc/icc +2 -2
- data/vendor/nginx/auto/cc/msvc +29 -8
- data/vendor/nginx/auto/cc/name +2 -25
- data/vendor/nginx/auto/cc/sunc +3 -0
- data/vendor/nginx/auto/endianness +7 -2
- data/vendor/nginx/auto/install +60 -26
- data/vendor/nginx/auto/lib/conf +4 -4
- data/vendor/nginx/auto/lib/geoip/conf +6 -1
- data/vendor/nginx/auto/lib/libgd/conf +6 -1
- data/vendor/nginx/auto/lib/libxslt/conf +11 -2
- data/vendor/nginx/auto/lib/make +1 -1
- data/vendor/nginx/auto/lib/md5/conf +2 -2
- data/vendor/nginx/auto/lib/md5/make +2 -2
- data/vendor/nginx/auto/lib/openssl/conf +52 -3
- data/vendor/nginx/auto/lib/openssl/make +1 -1
- data/vendor/nginx/auto/lib/pcre/conf +2 -2
- data/vendor/nginx/auto/lib/pcre/make +2 -2
- data/vendor/nginx/auto/lib/perl/conf +6 -3
- data/vendor/nginx/auto/lib/perl/make +4 -1
- data/vendor/nginx/auto/lib/sha1/conf +2 -2
- data/vendor/nginx/auto/lib/sha1/make +2 -2
- data/vendor/nginx/auto/lib/zlib/conf +2 -2
- data/vendor/nginx/auto/lib/zlib/make +2 -2
- data/vendor/nginx/auto/make +281 -16
- data/vendor/nginx/auto/module +122 -0
- data/vendor/nginx/auto/modules +909 -178
- data/vendor/nginx/auto/options +81 -19
- data/vendor/nginx/auto/os/conf +9 -0
- data/vendor/nginx/auto/os/darwin +3 -0
- data/vendor/nginx/auto/os/freebsd +0 -20
- data/vendor/nginx/auto/os/linux +0 -12
- data/vendor/nginx/auto/os/win32 +5 -1
- data/vendor/nginx/auto/sources +11 -311
- data/vendor/nginx/auto/summary +1 -0
- data/vendor/nginx/auto/types/sizeof +5 -3
- data/vendor/nginx/auto/types/typedef +9 -4
- data/vendor/nginx/auto/types/uintptr_t +7 -2
- data/vendor/nginx/auto/unix +72 -12
- data/vendor/nginx/conf/fastcgi.conf +1 -0
- data/vendor/nginx/conf/fastcgi_params +1 -0
- data/vendor/nginx/conf/scgi_params +1 -0
- data/vendor/nginx/conf/uwsgi_params +1 -0
- data/vendor/nginx/configure +1 -1
- data/vendor/nginx/contrib/vim/syntax/nginx.vim +2 -2
- data/vendor/nginx/man/nginx.8 +6 -2
- data/vendor/nginx/src/core/nginx.c +281 -114
- data/vendor/nginx/src/core/nginx.h +2 -2
- data/vendor/nginx/src/core/ngx_conf_file.c +54 -13
- data/vendor/nginx/src/core/ngx_conf_file.h +8 -52
- data/vendor/nginx/src/core/ngx_config.h +0 -5
- data/vendor/nginx/src/core/ngx_connection.c +270 -37
- data/vendor/nginx/src/core/ngx_connection.h +35 -12
- data/vendor/nginx/src/core/ngx_core.h +4 -0
- data/vendor/nginx/src/core/ngx_crypt.c +2 -2
- data/vendor/nginx/src/core/ngx_cycle.c +72 -25
- data/vendor/nginx/src/core/ngx_cycle.h +28 -39
- data/vendor/nginx/src/core/ngx_file.c +14 -5
- data/vendor/nginx/src/core/ngx_file.h +2 -0
- data/vendor/nginx/src/core/ngx_hash.c +13 -1
- data/vendor/nginx/src/core/ngx_inet.c +20 -18
- data/vendor/nginx/src/core/ngx_log.c +12 -12
- data/vendor/nginx/src/core/ngx_log.h +13 -6
- data/vendor/nginx/src/core/ngx_module.c +360 -0
- data/vendor/nginx/src/core/ngx_module.h +307 -0
- data/vendor/nginx/src/core/ngx_open_file_cache.c +2 -2
- data/vendor/nginx/src/core/ngx_output_chain.c +8 -4
- data/vendor/nginx/src/core/ngx_palloc.c +42 -44
- data/vendor/nginx/src/{http/ngx_http_parse_time.c → core/ngx_parse_time.c} +2 -3
- data/vendor/nginx/src/core/ngx_parse_time.h +22 -0
- data/vendor/nginx/src/core/ngx_proxy_protocol.c +50 -1
- data/vendor/nginx/src/core/ngx_proxy_protocol.h +3 -1
- data/vendor/nginx/src/core/ngx_regex.c +1 -38
- data/vendor/nginx/src/core/ngx_resolver.c +1814 -320
- data/vendor/nginx/src/core/ngx_resolver.h +67 -10
- data/vendor/nginx/src/core/ngx_rwlock.c +120 -0
- data/vendor/nginx/src/core/ngx_rwlock.h +21 -0
- data/vendor/nginx/src/core/ngx_slab.c +6 -5
- data/vendor/nginx/src/core/ngx_string.c +1 -1
- data/vendor/nginx/src/core/ngx_syslog.c +11 -3
- data/vendor/nginx/src/core/ngx_syslog.h +2 -1
- data/vendor/nginx/src/core/ngx_thread_pool.c +4 -0
- data/vendor/nginx/src/core/ngx_times.c +2 -2
- data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +3 -1
- data/vendor/nginx/src/event/modules/ngx_epoll_module.c +5 -2
- data/vendor/nginx/src/event/modules/ngx_eventport_module.c +5 -5
- data/vendor/nginx/src/event/modules/ngx_kqueue_module.c +15 -8
- data/vendor/nginx/src/event/modules/ngx_poll_module.c +0 -10
- data/vendor/nginx/src/event/modules/ngx_select_module.c +0 -10
- data/vendor/nginx/src/event/ngx_event.c +60 -103
- data/vendor/nginx/src/event/ngx_event.h +22 -26
- data/vendor/nginx/src/event/ngx_event_accept.c +414 -88
- data/vendor/nginx/src/event/ngx_event_connect.c +27 -18
- data/vendor/nginx/src/event/ngx_event_connect.h +1 -0
- data/vendor/nginx/src/event/ngx_event_openssl.c +65 -25
- data/vendor/nginx/src/event/ngx_event_openssl.h +17 -0
- data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +73 -7
- data/vendor/nginx/src/event/ngx_event_pipe.c +85 -27
- data/vendor/nginx/src/event/ngx_event_pipe.h +10 -0
- data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_auth_request_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_chunked_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +17 -11
- data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +9 -9
- data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_limit_conn_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +0 -7
- data/vendor/nginx/src/http/modules/ngx_http_map_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +2 -1
- data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +13 -13
- data/vendor/nginx/src/http/modules/ngx_http_not_modified_filter_module.c +2 -2
- data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +26 -21
- data/vendor/nginx/src/http/modules/ngx_http_random_index_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +26 -8
- data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +73 -3
- data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_rewrite_module.c +6 -6
- data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +5 -3
- data/vendor/nginx/src/http/modules/ngx_http_slice_filter_module.c +526 -0
- data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +7 -7
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +19 -16
- data/vendor/nginx/src/http/modules/ngx_http_static_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +373 -173
- data/vendor/nginx/src/http/modules/ngx_http_upstream_hash_module.c +72 -46
- data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +18 -30
- data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +50 -39
- data/vendor/nginx/src/http/modules/ngx_http_upstream_least_conn_module.c +38 -129
- data/vendor/nginx/src/http/modules/ngx_http_upstream_zone_module.c +246 -0
- data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +6 -5
- data/vendor/nginx/src/http/modules/perl/nginx.xs +9 -9
- data/vendor/nginx/src/http/ngx_http.c +46 -43
- data/vendor/nginx/src/http/ngx_http.h +4 -9
- data/vendor/nginx/src/http/ngx_http_cache.h +4 -0
- data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +13 -5
- data/vendor/nginx/src/http/ngx_http_core_module.c +92 -91
- data/vendor/nginx/src/http/ngx_http_core_module.h +12 -8
- data/vendor/nginx/src/http/ngx_http_file_cache.c +61 -10
- data/vendor/nginx/src/http/ngx_http_request.c +37 -50
- data/vendor/nginx/src/http/ngx_http_request.h +10 -15
- data/vendor/nginx/src/http/ngx_http_request_body.c +64 -88
- data/vendor/nginx/src/http/ngx_http_script.c +3 -3
- data/vendor/nginx/src/http/ngx_http_special_response.c +1 -4
- data/vendor/nginx/src/http/ngx_http_upstream.c +245 -109
- data/vendor/nginx/src/http/ngx_http_upstream.h +11 -5
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +212 -65
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.h +66 -5
- data/vendor/nginx/src/http/ngx_http_variables.c +28 -15
- data/vendor/nginx/src/http/ngx_http_write_filter_module.c +1 -1
- data/vendor/nginx/src/http/v2/ngx_http_v2.c +4349 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2.h +337 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_filter_module.c +1391 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_huff_decode.c +2714 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_huff_encode.c +254 -0
- data/vendor/nginx/src/http/v2/ngx_http_v2_module.c +469 -0
- data/vendor/nginx/src/http/{ngx_http_spdy_module.h → v2/ngx_http_v2_module.h} +10 -9
- data/vendor/nginx/src/http/v2/ngx_http_v2_table.c +349 -0
- data/vendor/nginx/src/mail/ngx_mail.c +49 -82
- data/vendor/nginx/src/mail/ngx_mail.h +16 -23
- data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +1 -1
- data/vendor/nginx/src/mail/ngx_mail_core_module.c +60 -34
- data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -12
- data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +1 -14
- data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +1 -1
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +5 -5
- data/vendor/nginx/src/os/unix/ngx_atomic.h +10 -10
- data/vendor/nginx/src/os/unix/ngx_channel.h +4 -4
- data/vendor/nginx/src/os/unix/ngx_darwin_config.h +2 -0
- data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_dlopen.c +28 -0
- data/vendor/nginx/src/os/unix/ngx_dlopen.h +31 -0
- data/vendor/nginx/src/os/unix/ngx_errno.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_file_aio_read.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_files.c +313 -80
- data/vendor/nginx/src/os/unix/ngx_files.h +5 -2
- data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +3 -1
- data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +13 -0
- data/vendor/nginx/src/os/unix/ngx_linux.h +0 -2
- data/vendor/nginx/src/os/unix/ngx_linux_aio_read.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_linux_config.h +2 -6
- data/vendor/nginx/src/os/unix/ngx_linux_init.c +1 -33
- data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +55 -12
- data/vendor/nginx/src/os/unix/ngx_os.h +3 -9
- data/vendor/nginx/src/os/unix/ngx_posix_config.h +14 -1
- data/vendor/nginx/src/os/unix/ngx_posix_init.c +2 -1
- data/vendor/nginx/src/os/unix/ngx_process.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_process_cycle.c +25 -51
- data/vendor/nginx/src/os/unix/ngx_process_cycle.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_readv_chain.c +24 -28
- data/vendor/nginx/src/os/unix/ngx_recv.c +30 -79
- data/vendor/nginx/src/os/unix/ngx_send.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_setaffinity.c +14 -30
- data/vendor/nginx/src/os/unix/ngx_setaffinity.h +15 -1
- data/vendor/nginx/src/os/unix/ngx_solaris_config.h +2 -0
- data/vendor/nginx/src/os/unix/ngx_solaris_init.c +1 -0
- data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +23 -0
- data/vendor/nginx/src/os/unix/ngx_sunpro_amd64.il +3 -3
- data/vendor/nginx/src/os/unix/ngx_sunpro_x86.il +3 -3
- data/vendor/nginx/src/os/unix/ngx_udp_recv.c +5 -48
- data/vendor/nginx/src/os/unix/ngx_udp_send.c +56 -0
- data/vendor/nginx/src/stream/ngx_stream.c +564 -0
- data/vendor/nginx/src/stream/ngx_stream.h +212 -0
- data/vendor/nginx/src/stream/ngx_stream_access_module.c +451 -0
- data/vendor/nginx/src/stream/ngx_stream_core_module.c +562 -0
- data/vendor/nginx/src/stream/ngx_stream_handler.c +344 -0
- data/vendor/nginx/src/stream/ngx_stream_limit_conn_module.c +632 -0
- data/vendor/nginx/src/stream/ngx_stream_proxy_module.c +1674 -0
- data/vendor/nginx/src/stream/ngx_stream_ssl_module.c +460 -0
- data/vendor/nginx/src/stream/ngx_stream_ssl_module.h +49 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream.c +464 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream.h +107 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_hash_module.c +656 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_least_conn_module.c +307 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.c +702 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_round_robin.h +139 -0
- data/vendor/nginx/src/stream/ngx_stream_upstream_zone_module.c +242 -0
- metadata +39 -15
- data/vendor/nginx/src/event/modules/ngx_aio_module.c +0 -171
- data/vendor/nginx/src/event/modules/ngx_rtsig_module.c +0 -735
- data/vendor/nginx/src/http/ngx_http_spdy.c +0 -3701
- data/vendor/nginx/src/http/ngx_http_spdy.h +0 -261
- data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +0 -1222
- data/vendor/nginx/src/http/ngx_http_spdy_module.c +0 -408
- data/vendor/nginx/src/os/unix/ngx_aio_read.c +0 -109
- data/vendor/nginx/src/os/unix/ngx_aio_read_chain.c +0 -78
- data/vendor/nginx/src/os/unix/ngx_aio_write.c +0 -109
- data/vendor/nginx/src/os/unix/ngx_aio_write_chain.c +0 -100
@@ -79,11 +79,14 @@ typedef struct {
|
|
79
79
|
#if (NGX_HTTP_SSL)
|
80
80
|
unsigned ssl:1;
|
81
81
|
#endif
|
82
|
-
#if (
|
83
|
-
unsigned
|
82
|
+
#if (NGX_HTTP_V2)
|
83
|
+
unsigned http2:1;
|
84
84
|
#endif
|
85
85
|
#if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
|
86
86
|
unsigned ipv6only:1;
|
87
|
+
#endif
|
88
|
+
#if (NGX_HAVE_REUSEPORT)
|
89
|
+
unsigned reuseport:1;
|
87
90
|
#endif
|
88
91
|
unsigned so_keepalive:2;
|
89
92
|
unsigned proxy_protocol:1;
|
@@ -229,10 +232,10 @@ typedef struct {
|
|
229
232
|
|
230
233
|
|
231
234
|
typedef struct {
|
232
|
-
|
235
|
+
ngx_hash_combined_t names;
|
233
236
|
|
234
|
-
|
235
|
-
|
237
|
+
ngx_uint_t nregex;
|
238
|
+
ngx_http_server_name_t *regex;
|
236
239
|
} ngx_http_virtual_names_t;
|
237
240
|
|
238
241
|
|
@@ -245,8 +248,8 @@ struct ngx_http_addr_conf_s {
|
|
245
248
|
#if (NGX_HTTP_SSL)
|
246
249
|
unsigned ssl:1;
|
247
250
|
#endif
|
248
|
-
#if (
|
249
|
-
unsigned
|
251
|
+
#if (NGX_HTTP_V2)
|
252
|
+
unsigned http2:1;
|
250
253
|
#endif
|
251
254
|
unsigned proxy_protocol:1;
|
252
255
|
};
|
@@ -401,6 +404,7 @@ struct ngx_http_core_loc_conf_s {
|
|
401
404
|
ngx_flag_t internal; /* internal */
|
402
405
|
ngx_flag_t sendfile; /* sendfile */
|
403
406
|
ngx_flag_t aio; /* aio */
|
407
|
+
ngx_flag_t aio_write; /* aio_write */
|
404
408
|
ngx_flag_t tcp_nopush; /* tcp_nopush */
|
405
409
|
ngx_flag_t tcp_nodelay; /* tcp_nodelay */
|
406
410
|
ngx_flag_t reset_timedout_connection; /* reset_timedout_connection */
|
@@ -540,7 +544,7 @@ typedef ngx_int_t (*ngx_http_request_body_filter_pt)
|
|
540
544
|
ngx_int_t ngx_http_output_filter(ngx_http_request_t *r, ngx_chain_t *chain);
|
541
545
|
ngx_int_t ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *chain);
|
542
546
|
ngx_int_t ngx_http_request_body_save_filter(ngx_http_request_t *r,
|
543
|
-
|
547
|
+
ngx_chain_t *chain);
|
544
548
|
|
545
549
|
|
546
550
|
ngx_int_t ngx_http_set_disable_symlinks(ngx_http_request_t *r,
|
@@ -62,6 +62,7 @@ static ngx_int_t ngx_http_file_cache_add(ngx_http_file_cache_t *cache,
|
|
62
62
|
ngx_http_cache_t *c);
|
63
63
|
static ngx_int_t ngx_http_file_cache_delete_file(ngx_tree_ctx_t *ctx,
|
64
64
|
ngx_str_t *path);
|
65
|
+
static void ngx_http_file_cache_set_watermark(ngx_http_file_cache_t *cache);
|
65
66
|
|
66
67
|
|
67
68
|
ngx_str_t ngx_http_cache_status[] = {
|
@@ -147,6 +148,8 @@ ngx_http_file_cache_init(ngx_shm_zone_t *shm_zone, void *data)
|
|
147
148
|
cache->sh->cold = 1;
|
148
149
|
cache->sh->loading = 0;
|
149
150
|
cache->sh->size = 0;
|
151
|
+
cache->sh->count = 0;
|
152
|
+
cache->sh->watermark = (ngx_uint_t) -1;
|
150
153
|
|
151
154
|
cache->bsize = ngx_fs_bsize(cache->path->name.data);
|
152
155
|
|
@@ -521,9 +524,12 @@ wakeup:
|
|
521
524
|
static ngx_int_t
|
522
525
|
ngx_http_file_cache_read(ngx_http_request_t *r, ngx_http_cache_t *c)
|
523
526
|
{
|
527
|
+
u_char *p;
|
524
528
|
time_t now;
|
525
529
|
ssize_t n;
|
530
|
+
ngx_str_t *key;
|
526
531
|
ngx_int_t rc;
|
532
|
+
ngx_uint_t i;
|
527
533
|
ngx_http_file_cache_t *cache;
|
528
534
|
ngx_http_file_cache_header_t *h;
|
529
535
|
|
@@ -547,12 +553,27 @@ ngx_http_file_cache_read(ngx_http_request_t *r, ngx_http_cache_t *c)
|
|
547
553
|
return NGX_DECLINED;
|
548
554
|
}
|
549
555
|
|
550
|
-
if (h->crc32 != c->crc32) {
|
556
|
+
if (h->crc32 != c->crc32 || h->header_start != c->header_start) {
|
551
557
|
ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
|
552
558
|
"cache file \"%s\" has md5 collision", c->file.name.data);
|
553
559
|
return NGX_DECLINED;
|
554
560
|
}
|
555
561
|
|
562
|
+
p = c->buf->pos + sizeof(ngx_http_file_cache_header_t)
|
563
|
+
+ sizeof(ngx_http_file_cache_key);
|
564
|
+
|
565
|
+
key = c->keys.elts;
|
566
|
+
for (i = 0; i < c->keys.nelts; i++) {
|
567
|
+
if (ngx_memcmp(p, key[i].data, key[i].len) != 0) {
|
568
|
+
ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
|
569
|
+
"cache file \"%s\" has md5 collision",
|
570
|
+
c->file.name.data);
|
571
|
+
return NGX_DECLINED;
|
572
|
+
}
|
573
|
+
|
574
|
+
p += key[i].len;
|
575
|
+
}
|
576
|
+
|
556
577
|
if ((size_t) h->body_start > c->body_start) {
|
557
578
|
ngx_log_error(NGX_LOG_CRIT, r->connection->log, 0,
|
558
579
|
"cache file \"%s\" has too long header",
|
@@ -583,7 +604,6 @@ ngx_http_file_cache_read(ngx_http_request_t *r, ngx_http_cache_t *c)
|
|
583
604
|
c->last_modified = h->last_modified;
|
584
605
|
c->date = h->date;
|
585
606
|
c->valid_msec = h->valid_msec;
|
586
|
-
c->header_start = h->header_start;
|
587
607
|
c->body_start = h->body_start;
|
588
608
|
c->etag.len = h->etag_len;
|
589
609
|
c->etag.data = h->etag;
|
@@ -674,12 +694,13 @@ ngx_http_file_cache_aio_read(ngx_http_request_t *r, ngx_http_cache_t *c)
|
|
674
694
|
#if (NGX_THREADS)
|
675
695
|
|
676
696
|
if (clcf->aio == NGX_HTTP_AIO_THREADS) {
|
697
|
+
c->file.thread_task = c->thread_task;
|
677
698
|
c->file.thread_handler = ngx_http_cache_thread_handler;
|
678
699
|
c->file.thread_ctx = r;
|
679
700
|
|
680
|
-
n = ngx_thread_read(&c->
|
681
|
-
c->body_start, 0, r->pool);
|
701
|
+
n = ngx_thread_read(&c->file, c->buf->pos, c->body_start, 0, r->pool);
|
682
702
|
|
703
|
+
c->thread_task = c->file.thread_task;
|
683
704
|
c->reading = (n == NGX_AGAIN);
|
684
705
|
|
685
706
|
return n;
|
@@ -843,6 +864,8 @@ ngx_http_file_cache_exists(ngx_http_file_cache_t *cache, ngx_http_cache_t *c)
|
|
843
864
|
fcn = ngx_slab_calloc_locked(cache->shpool,
|
844
865
|
sizeof(ngx_http_file_cache_node_t));
|
845
866
|
if (fcn == NULL) {
|
867
|
+
ngx_http_file_cache_set_watermark(cache);
|
868
|
+
|
846
869
|
ngx_shmtx_unlock(&cache->shpool->mutex);
|
847
870
|
|
848
871
|
(void) ngx_http_file_cache_forced_expire(cache);
|
@@ -859,6 +882,8 @@ ngx_http_file_cache_exists(ngx_http_file_cache_t *cache, ngx_http_cache_t *c)
|
|
859
882
|
}
|
860
883
|
}
|
861
884
|
|
885
|
+
cache->sh->count++;
|
886
|
+
|
862
887
|
ngx_memcpy((u_char *) &fcn->node.key, c->key, sizeof(ngx_rbtree_key_t));
|
863
888
|
|
864
889
|
ngx_memcpy(fcn->key, &c->key[sizeof(ngx_rbtree_key_t)],
|
@@ -1613,6 +1638,7 @@ ngx_http_file_cache_free(ngx_http_cache_t *c, ngx_temp_file_t *tf)
|
|
1613
1638
|
ngx_queue_remove(&fcn->queue);
|
1614
1639
|
ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
|
1615
1640
|
ngx_slab_free_locked(cache->shpool, fcn);
|
1641
|
+
cache->sh->count--;
|
1616
1642
|
c->node = NULL;
|
1617
1643
|
}
|
1618
1644
|
|
@@ -1808,7 +1834,7 @@ ngx_http_file_cache_expire(ngx_http_file_cache_t *cache)
|
|
1808
1834
|
|
1809
1835
|
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
|
1810
1836
|
"ignore long locked inactive cache entry %*s, count:%d",
|
1811
|
-
2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count);
|
1837
|
+
(size_t) 2 * NGX_HTTP_CACHE_KEY_LEN, key, fcn->count);
|
1812
1838
|
}
|
1813
1839
|
|
1814
1840
|
ngx_shmtx_unlock(&cache->shpool->mutex);
|
@@ -1865,6 +1891,7 @@ ngx_http_file_cache_delete(ngx_http_file_cache_t *cache, ngx_queue_t *q,
|
|
1865
1891
|
ngx_queue_remove(q);
|
1866
1892
|
ngx_rbtree_delete(&cache->sh->rbtree, &fcn->node);
|
1867
1893
|
ngx_slab_free_locked(cache->shpool, fcn);
|
1894
|
+
cache->sh->count--;
|
1868
1895
|
}
|
1869
1896
|
}
|
1870
1897
|
|
@@ -1874,8 +1901,9 @@ ngx_http_file_cache_manager(void *data)
|
|
1874
1901
|
{
|
1875
1902
|
ngx_http_file_cache_t *cache = data;
|
1876
1903
|
|
1877
|
-
off_t
|
1878
|
-
time_t
|
1904
|
+
off_t size;
|
1905
|
+
time_t next, wait;
|
1906
|
+
ngx_uint_t count, watermark;
|
1879
1907
|
|
1880
1908
|
next = ngx_http_file_cache_expire(cache);
|
1881
1909
|
|
@@ -1886,13 +1914,16 @@ ngx_http_file_cache_manager(void *data)
|
|
1886
1914
|
ngx_shmtx_lock(&cache->shpool->mutex);
|
1887
1915
|
|
1888
1916
|
size = cache->sh->size;
|
1917
|
+
count = cache->sh->count;
|
1918
|
+
watermark = cache->sh->watermark;
|
1889
1919
|
|
1890
1920
|
ngx_shmtx_unlock(&cache->shpool->mutex);
|
1891
1921
|
|
1892
|
-
|
1893
|
-
"http file cache size: %O",
|
1922
|
+
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
|
1923
|
+
"http file cache size: %O c:%ui w:%i",
|
1924
|
+
size, count, (ngx_int_t) watermark);
|
1894
1925
|
|
1895
|
-
if (size < cache->max_size) {
|
1926
|
+
if (size < cache->max_size && count < watermark) {
|
1896
1927
|
return next;
|
1897
1928
|
}
|
1898
1929
|
|
@@ -2076,10 +2107,20 @@ ngx_http_file_cache_add(ngx_http_file_cache_t *cache, ngx_http_cache_t *c)
|
|
2076
2107
|
fcn = ngx_slab_calloc_locked(cache->shpool,
|
2077
2108
|
sizeof(ngx_http_file_cache_node_t));
|
2078
2109
|
if (fcn == NULL) {
|
2110
|
+
ngx_http_file_cache_set_watermark(cache);
|
2111
|
+
|
2112
|
+
if (cache->fail_time != ngx_time()) {
|
2113
|
+
cache->fail_time = ngx_time();
|
2114
|
+
ngx_log_error(NGX_LOG_ALERT, ngx_cycle->log, 0,
|
2115
|
+
"could not allocate node%s", cache->shpool->log_ctx);
|
2116
|
+
}
|
2117
|
+
|
2079
2118
|
ngx_shmtx_unlock(&cache->shpool->mutex);
|
2080
2119
|
return NGX_ERROR;
|
2081
2120
|
}
|
2082
2121
|
|
2122
|
+
cache->sh->count++;
|
2123
|
+
|
2083
2124
|
ngx_memcpy((u_char *) &fcn->node.key, c->key, sizeof(ngx_rbtree_key_t));
|
2084
2125
|
|
2085
2126
|
ngx_memcpy(fcn->key, &c->key[sizeof(ngx_rbtree_key_t)],
|
@@ -2122,6 +2163,16 @@ ngx_http_file_cache_delete_file(ngx_tree_ctx_t *ctx, ngx_str_t *path)
|
|
2122
2163
|
}
|
2123
2164
|
|
2124
2165
|
|
2166
|
+
static void
|
2167
|
+
ngx_http_file_cache_set_watermark(ngx_http_file_cache_t *cache)
|
2168
|
+
{
|
2169
|
+
cache->sh->watermark = cache->sh->count - cache->sh->count / 8;
|
2170
|
+
|
2171
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
|
2172
|
+
"http file cache watermark: %ui", cache->sh->watermark);
|
2173
|
+
}
|
2174
|
+
|
2175
|
+
|
2125
2176
|
time_t
|
2126
2177
|
ngx_http_file_cache_valid(ngx_array_t *cache_valid, ngx_uint_t status)
|
2127
2178
|
{
|
@@ -312,9 +312,9 @@ ngx_http_init_connection(ngx_connection_t *c)
|
|
312
312
|
rev->handler = ngx_http_wait_request_handler;
|
313
313
|
c->write->handler = ngx_http_empty_handler;
|
314
314
|
|
315
|
-
#if (
|
316
|
-
if (hc->addr_conf->
|
317
|
-
rev->handler =
|
315
|
+
#if (NGX_HTTP_V2)
|
316
|
+
if (hc->addr_conf->http2) {
|
317
|
+
rev->handler = ngx_http_v2_init;
|
318
318
|
}
|
319
319
|
#endif
|
320
320
|
|
@@ -349,7 +349,7 @@ ngx_http_init_connection(ngx_connection_t *c)
|
|
349
349
|
}
|
350
350
|
|
351
351
|
if (rev->ready) {
|
352
|
-
/* the deferred accept(),
|
352
|
+
/* the deferred accept(), iocp */
|
353
353
|
|
354
354
|
if (ngx_use_accept_mutex) {
|
355
355
|
ngx_post_event(rev, &ngx_posted_events);
|
@@ -467,7 +467,7 @@ ngx_http_wait_request_handler(ngx_event_t *rev)
|
|
467
467
|
if (hc->proxy_protocol) {
|
468
468
|
hc->proxy_protocol = 0;
|
469
469
|
|
470
|
-
p =
|
470
|
+
p = ngx_proxy_protocol_read(c, b->pos, b->last);
|
471
471
|
|
472
472
|
if (p == NULL) {
|
473
473
|
ngx_http_close_connection(c);
|
@@ -543,7 +543,7 @@ ngx_http_create_request(ngx_connection_t *c)
|
|
543
543
|
|
544
544
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
545
545
|
|
546
|
-
|
546
|
+
ngx_set_connection_log(r->connection, clcf->error_log);
|
547
547
|
|
548
548
|
r->header_in = hc->nbusy ? hc->busy[0] : c->buffer;
|
549
549
|
|
@@ -648,7 +648,7 @@ ngx_http_ssl_handshake(ngx_event_t *rev)
|
|
648
648
|
|
649
649
|
err = ngx_socket_errno;
|
650
650
|
|
651
|
-
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %
|
651
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, rev->log, 0, "http recv(): %z", n);
|
652
652
|
|
653
653
|
if (n == -1) {
|
654
654
|
if (err == NGX_EAGAIN) {
|
@@ -675,7 +675,7 @@ ngx_http_ssl_handshake(ngx_event_t *rev)
|
|
675
675
|
if (hc->proxy_protocol) {
|
676
676
|
hc->proxy_protocol = 0;
|
677
677
|
|
678
|
-
p =
|
678
|
+
p = ngx_proxy_protocol_read(c, buf, buf + n);
|
679
679
|
|
680
680
|
if (p == NULL) {
|
681
681
|
ngx_http_close_connection(c);
|
@@ -764,18 +764,17 @@ ngx_http_ssl_handshake_handler(ngx_connection_t *c)
|
|
764
764
|
|
765
765
|
c->ssl->no_wait_shutdown = 1;
|
766
766
|
|
767
|
-
#if (
|
767
|
+
#if (NGX_HTTP_V2 \
|
768
768
|
&& (defined TLSEXT_TYPE_application_layer_protocol_negotiation \
|
769
769
|
|| defined TLSEXT_TYPE_next_proto_neg))
|
770
770
|
{
|
771
|
-
unsigned int
|
772
|
-
const unsigned char
|
773
|
-
ngx_http_connection_t
|
774
|
-
static const ngx_str_t spdy = ngx_string(NGX_SPDY_NPN_NEGOTIATED);
|
771
|
+
unsigned int len;
|
772
|
+
const unsigned char *data;
|
773
|
+
ngx_http_connection_t *hc;
|
775
774
|
|
776
775
|
hc = c->data;
|
777
776
|
|
778
|
-
if (hc->addr_conf->
|
777
|
+
if (hc->addr_conf->http2) {
|
779
778
|
|
780
779
|
#ifdef TLSEXT_TYPE_application_layer_protocol_negotiation
|
781
780
|
SSL_get0_alpn_selected(c->ssl->connection, &data, &len);
|
@@ -790,10 +789,8 @@ ngx_http_ssl_handshake_handler(ngx_connection_t *c)
|
|
790
789
|
SSL_get0_next_proto_negotiated(c->ssl->connection, &data, &len);
|
791
790
|
#endif
|
792
791
|
|
793
|
-
if (len ==
|
794
|
-
|
795
|
-
{
|
796
|
-
ngx_http_spdy_init(c->read);
|
792
|
+
if (len == 2 && data[0] == 'h' && data[1] == '2') {
|
793
|
+
ngx_http_v2_init(c->read);
|
797
794
|
return;
|
798
795
|
}
|
799
796
|
}
|
@@ -840,6 +837,10 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
|
|
840
837
|
|
841
838
|
c = ngx_ssl_get_connection(ssl_conn);
|
842
839
|
|
840
|
+
if (c->ssl->renegotiation) {
|
841
|
+
return SSL_TLSEXT_ERR_NOACK;
|
842
|
+
}
|
843
|
+
|
843
844
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
844
845
|
"SSL server name: \"%s\"", servername);
|
845
846
|
|
@@ -875,7 +876,7 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *ssl_conn, int *ad, void *arg)
|
|
875
876
|
|
876
877
|
clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module);
|
877
878
|
|
878
|
-
|
879
|
+
ngx_set_connection_log(c, clcf->error_log);
|
879
880
|
|
880
881
|
sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
|
881
882
|
|
@@ -1350,12 +1351,11 @@ ngx_http_process_request_headers(ngx_event_t *rev)
|
|
1350
1351
|
continue;
|
1351
1352
|
}
|
1352
1353
|
|
1353
|
-
/* rc == NGX_HTTP_PARSE_INVALID_HEADER
|
1354
|
+
/* rc == NGX_HTTP_PARSE_INVALID_HEADER */
|
1354
1355
|
|
1355
1356
|
ngx_log_error(NGX_LOG_INFO, c->log, 0,
|
1356
|
-
"client sent invalid header line
|
1357
|
-
|
1358
|
-
r->header_name_start);
|
1357
|
+
"client sent invalid header line");
|
1358
|
+
|
1359
1359
|
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
|
1360
1360
|
return;
|
1361
1361
|
}
|
@@ -1500,7 +1500,7 @@ ngx_http_alloc_large_header_buffer(ngx_http_request_t *r,
|
|
1500
1500
|
}
|
1501
1501
|
|
1502
1502
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1503
|
-
"http large header copy: %
|
1503
|
+
"http large header copy: %uz", r->header_in->pos - old);
|
1504
1504
|
|
1505
1505
|
new = b->start;
|
1506
1506
|
|
@@ -1791,7 +1791,7 @@ ngx_http_process_request_header(ngx_http_request_t *r)
|
|
1791
1791
|
}
|
1792
1792
|
}
|
1793
1793
|
|
1794
|
-
if (r->method
|
1794
|
+
if (r->method == NGX_HTTP_TRACE) {
|
1795
1795
|
ngx_log_error(NGX_LOG_INFO, r->connection->log, 0,
|
1796
1796
|
"client sent TRACE method");
|
1797
1797
|
ngx_http_finalize_request(r, NGX_HTTP_NOT_ALLOWED);
|
@@ -2081,7 +2081,7 @@ ngx_http_set_virtual_server(ngx_http_request_t *r, ngx_str_t *host)
|
|
2081
2081
|
|
2082
2082
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
2083
2083
|
|
2084
|
-
|
2084
|
+
ngx_set_connection_log(r->connection, clcf->error_log);
|
2085
2085
|
|
2086
2086
|
return NGX_OK;
|
2087
2087
|
}
|
@@ -2264,7 +2264,7 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
|
2264
2264
|
c = r->connection;
|
2265
2265
|
|
2266
2266
|
ngx_log_debug5(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
2267
|
-
"http finalize request: %
|
2267
|
+
"http finalize request: %i, \"%V?%V\" a:%d, c:%d",
|
2268
2268
|
rc, &r->uri, &r->args, r == c->data, r->main->count);
|
2269
2269
|
|
2270
2270
|
if (rc == NGX_DONE) {
|
@@ -2346,7 +2346,6 @@ ngx_http_finalize_request(ngx_http_request_t *r, ngx_int_t rc)
|
|
2346
2346
|
if (r == c->data) {
|
2347
2347
|
|
2348
2348
|
r->main->count--;
|
2349
|
-
r->main->subrequests++;
|
2350
2349
|
|
2351
2350
|
if (!r->logged) {
|
2352
2351
|
|
@@ -2508,8 +2507,8 @@ ngx_http_finalize_connection(ngx_http_request_t *r)
|
|
2508
2507
|
{
|
2509
2508
|
ngx_http_core_loc_conf_t *clcf;
|
2510
2509
|
|
2511
|
-
#if (
|
2512
|
-
if (r->
|
2510
|
+
#if (NGX_HTTP_V2)
|
2511
|
+
if (r->stream) {
|
2513
2512
|
ngx_http_close_request(r, 0);
|
2514
2513
|
return;
|
2515
2514
|
}
|
@@ -2574,12 +2573,6 @@ ngx_http_set_write_handler(ngx_http_request_t *r)
|
|
2574
2573
|
ngx_http_test_reading;
|
2575
2574
|
r->write_event_handler = ngx_http_writer;
|
2576
2575
|
|
2577
|
-
#if (NGX_HTTP_SPDY)
|
2578
|
-
if (r->spdy_stream) {
|
2579
|
-
return NGX_OK;
|
2580
|
-
}
|
2581
|
-
#endif
|
2582
|
-
|
2583
2576
|
wev = r->connection->write;
|
2584
2577
|
|
2585
2578
|
if (wev->ready && wev->delayed) {
|
@@ -2665,12 +2658,6 @@ ngx_http_writer(ngx_http_request_t *r)
|
|
2665
2658
|
|
2666
2659
|
if (r->buffered || r->postponed || (r == r->main && c->buffered)) {
|
2667
2660
|
|
2668
|
-
#if (NGX_HTTP_SPDY)
|
2669
|
-
if (r->spdy_stream) {
|
2670
|
-
return;
|
2671
|
-
}
|
2672
|
-
#endif
|
2673
|
-
|
2674
2661
|
if (!wev->delayed) {
|
2675
2662
|
ngx_add_timer(wev, clcf->send_timeout);
|
2676
2663
|
}
|
@@ -2733,9 +2720,9 @@ ngx_http_test_reading(ngx_http_request_t *r)
|
|
2733
2720
|
|
2734
2721
|
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http test reading");
|
2735
2722
|
|
2736
|
-
#if (
|
2723
|
+
#if (NGX_HTTP_V2)
|
2737
2724
|
|
2738
|
-
if (r->
|
2725
|
+
if (r->stream) {
|
2739
2726
|
if (c->error) {
|
2740
2727
|
err = 0;
|
2741
2728
|
goto closed;
|
@@ -2969,7 +2956,7 @@ ngx_http_set_keepalive(ngx_http_request_t *r)
|
|
2969
2956
|
b->last = b->start;
|
2970
2957
|
}
|
2971
2958
|
|
2972
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc free: %p %
|
2959
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc free: %p %i",
|
2973
2960
|
hc->free, hc->nfree);
|
2974
2961
|
|
2975
2962
|
if (hc->free) {
|
@@ -2981,7 +2968,7 @@ ngx_http_set_keepalive(ngx_http_request_t *r)
|
|
2981
2968
|
hc->nfree = 0;
|
2982
2969
|
}
|
2983
2970
|
|
2984
|
-
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc busy: %p %
|
2971
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, "hc busy: %p %i",
|
2985
2972
|
hc->busy, hc->nbusy);
|
2986
2973
|
|
2987
2974
|
if (hc->busy) {
|
@@ -3272,7 +3259,7 @@ ngx_http_lingering_close_handler(ngx_event_t *rev)
|
|
3272
3259
|
do {
|
3273
3260
|
n = c->recv(c, buffer, NGX_HTTP_LINGERING_BUFFER_SIZE);
|
3274
3261
|
|
3275
|
-
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "lingering read: %
|
3262
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0, "lingering read: %z", n);
|
3276
3263
|
|
3277
3264
|
if (n == NGX_ERROR || n == 0) {
|
3278
3265
|
ngx_http_close_request(r, 0);
|
@@ -3408,9 +3395,9 @@ ngx_http_close_request(ngx_http_request_t *r, ngx_int_t rc)
|
|
3408
3395
|
return;
|
3409
3396
|
}
|
3410
3397
|
|
3411
|
-
#if (
|
3412
|
-
if (r->
|
3413
|
-
|
3398
|
+
#if (NGX_HTTP_V2)
|
3399
|
+
if (r->stream) {
|
3400
|
+
ngx_http_v2_close_stream(r->stream, rc);
|
3414
3401
|
return;
|
3415
3402
|
}
|
3416
3403
|
#endif
|