nginxtra 1.4.7.9 → 1.6.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 +286 -19
- data/vendor/nginx/CHANGES.ru +296 -22
- data/vendor/nginx/auto/cc/clang +4 -3
- data/vendor/nginx/auto/cc/conf +23 -0
- data/vendor/nginx/auto/cc/msvc +1 -0
- data/vendor/nginx/auto/cc/name +1 -1
- data/vendor/nginx/auto/cc/owc +4 -4
- data/vendor/nginx/auto/cc/sunc +1 -1
- data/vendor/nginx/auto/endianness +2 -2
- data/vendor/nginx/auto/feature +1 -1
- data/vendor/nginx/auto/include +1 -1
- data/vendor/nginx/auto/lib/libatomic/make +3 -1
- data/vendor/nginx/auto/lib/openssl/conf +4 -0
- data/vendor/nginx/auto/lib/openssl/make +1 -1
- data/vendor/nginx/auto/lib/pcre/conf +5 -0
- data/vendor/nginx/auto/lib/pcre/make +11 -11
- data/vendor/nginx/auto/lib/pcre/makefile.bcc +4 -3
- data/vendor/nginx/auto/lib/pcre/makefile.msvc +2 -1
- data/vendor/nginx/auto/lib/pcre/makefile.owc +2 -1
- data/vendor/nginx/auto/lib/perl/make +1 -0
- data/vendor/nginx/auto/lib/test +1 -1
- data/vendor/nginx/auto/lib/zlib/make +22 -1
- data/vendor/nginx/auto/modules +8 -0
- data/vendor/nginx/auto/options +3 -0
- data/vendor/nginx/auto/os/darwin +1 -1
- data/vendor/nginx/auto/os/linux +32 -0
- data/vendor/nginx/auto/os/win32 +12 -1
- data/vendor/nginx/auto/sources +8 -2
- data/vendor/nginx/auto/types/sizeof +1 -1
- data/vendor/nginx/auto/types/typedef +1 -1
- data/vendor/nginx/auto/types/uintptr_t +1 -1
- data/vendor/nginx/auto/unix +13 -1
- data/vendor/nginx/conf/mime.types +11 -2
- data/vendor/nginx/conf/nginx.conf +3 -4
- data/vendor/nginx/contrib/README +6 -0
- data/vendor/nginx/contrib/vim/ftdetect/nginx.vim +4 -0
- data/vendor/nginx/contrib/vim/indent/nginx.vim +11 -0
- data/vendor/nginx/contrib/vim/syntax/nginx.vim +703 -0
- data/vendor/nginx/src/core/nginx.c +2 -7
- data/vendor/nginx/src/core/nginx.h +2 -2
- data/vendor/nginx/src/core/ngx_conf_file.c +8 -88
- data/vendor/nginx/src/core/ngx_conf_file.h +3 -3
- data/vendor/nginx/src/core/ngx_config.h +2 -2
- data/vendor/nginx/src/core/ngx_connection.c +100 -29
- data/vendor/nginx/src/core/ngx_connection.h +11 -0
- data/vendor/nginx/src/core/ngx_core.h +1 -0
- data/vendor/nginx/src/core/ngx_cycle.c +23 -99
- data/vendor/nginx/src/core/ngx_cycle.h +2 -0
- data/vendor/nginx/src/core/ngx_file.c +100 -8
- data/vendor/nginx/src/core/ngx_file.h +3 -0
- data/vendor/nginx/src/core/ngx_hash.c +6 -9
- data/vendor/nginx/src/core/ngx_inet.c +93 -5
- data/vendor/nginx/src/core/ngx_inet.h +4 -2
- data/vendor/nginx/src/core/ngx_list.c +1 -9
- data/vendor/nginx/src/core/ngx_log.c +132 -30
- data/vendor/nginx/src/core/ngx_log.h +5 -2
- data/vendor/nginx/src/core/ngx_open_file_cache.c +67 -1
- data/vendor/nginx/src/core/ngx_palloc.c +5 -2
- data/vendor/nginx/src/core/ngx_proxy_protocol.c +91 -0
- data/vendor/nginx/src/core/ngx_proxy_protocol.h +23 -0
- data/vendor/nginx/src/core/ngx_resolver.c +1080 -285
- data/vendor/nginx/src/core/ngx_resolver.h +33 -3
- data/vendor/nginx/src/core/ngx_slab.c +7 -2
- data/vendor/nginx/src/core/ngx_slab.h +2 -0
- data/vendor/nginx/src/core/ngx_string.c +78 -13
- data/vendor/nginx/src/core/ngx_string.h +2 -0
- data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +2 -2
- data/vendor/nginx/src/event/modules/ngx_epoll_module.c +13 -5
- data/vendor/nginx/src/event/modules/ngx_select_module.c +1 -1
- data/vendor/nginx/src/event/modules/ngx_win32_select_module.c +2 -2
- data/vendor/nginx/src/event/ngx_event.c +0 -1
- data/vendor/nginx/src/event/ngx_event.h +7 -6
- data/vendor/nginx/src/event/ngx_event_accept.c +6 -4
- data/vendor/nginx/src/event/ngx_event_connect.c +2 -2
- data/vendor/nginx/src/event/ngx_event_openssl.c +304 -13
- data/vendor/nginx/src/event/ngx_event_openssl.h +20 -1
- data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +35 -23
- data/vendor/nginx/src/event/ngx_event_pipe.c +15 -30
- data/vendor/nginx/src/http/modules/ngx_http_access_module.c +115 -35
- 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 +444 -0
- data/vendor/nginx/src/http/modules/ngx_http_autoindex_module.c +2 -1
- data/vendor/nginx/src/http/modules/ngx_http_charset_filter_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +1 -3
- data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +251 -36
- data/vendor/nginx/src/http/modules/ngx_http_gunzip_filter_module.c +9 -5
- data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +5 -3
- data/vendor/nginx/src/http/modules/ngx_http_gzip_static_module.c +1 -1
- data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +4 -0
- data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +8 -2
- data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +5 -1
- data/vendor/nginx/src/http/modules/ngx_http_map_module.c +3 -3
- data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +21 -10
- data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +669 -197
- data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +93 -60
- data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +13 -6
- data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +20 -1
- data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +132 -74
- data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +18 -12
- data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +22 -20
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +121 -3
- data/vendor/nginx/src/http/modules/ngx_http_ssl_module.h +5 -0
- data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +3 -0
- data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +123 -91
- data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +29 -19
- data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +2 -5
- data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +215 -19
- data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +32 -6
- data/vendor/nginx/src/http/modules/perl/nginx.xs +4 -7
- data/vendor/nginx/src/http/modules/perl/ngx_http_perl_module.c +2 -2
- data/vendor/nginx/src/http/ngx_http.c +17 -7
- data/vendor/nginx/src/http/ngx_http_cache.h +4 -2
- data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +4 -2
- data/vendor/nginx/src/http/ngx_http_core_module.c +63 -50
- data/vendor/nginx/src/http/ngx_http_core_module.h +5 -0
- data/vendor/nginx/src/http/ngx_http_file_cache.c +115 -3
- data/vendor/nginx/src/http/ngx_http_header_filter_module.c +9 -6
- data/vendor/nginx/src/http/ngx_http_parse.c +88 -10
- data/vendor/nginx/src/http/ngx_http_postpone_filter_module.c +2 -4
- data/vendor/nginx/src/http/ngx_http_request.c +116 -8
- data/vendor/nginx/src/http/ngx_http_request.h +5 -1
- data/vendor/nginx/src/http/ngx_http_request_body.c +7 -7
- data/vendor/nginx/src/http/ngx_http_script.c +6 -5
- data/vendor/nginx/src/http/ngx_http_spdy.c +889 -271
- data/vendor/nginx/src/http/ngx_http_spdy.h +51 -28
- data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +382 -167
- data/vendor/nginx/src/http/ngx_http_spdy_module.c +65 -8
- data/vendor/nginx/src/http/ngx_http_spdy_module.h +5 -0
- data/vendor/nginx/src/http/ngx_http_special_response.c +1 -1
- data/vendor/nginx/src/http/ngx_http_upstream.c +290 -114
- data/vendor/nginx/src/http/ngx_http_upstream.h +9 -5
- data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +32 -24
- data/vendor/nginx/src/http/ngx_http_variables.c +40 -6
- data/vendor/nginx/src/http/ngx_http_write_filter_module.c +12 -5
- data/vendor/nginx/src/mail/ngx_mail.c +4 -2
- data/vendor/nginx/src/mail/ngx_mail.h +2 -0
- data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +0 -1
- data/vendor/nginx/src/mail/ngx_mail_core_module.c +2 -1
- data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -4
- data/vendor/nginx/src/mail/ngx_mail_parse.c +32 -2
- data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +54 -7
- data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +50 -78
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +48 -11
- data/vendor/nginx/src/mail/ngx_mail_ssl_module.h +3 -0
- data/vendor/nginx/src/os/unix/ngx_channel.c +3 -1
- data/vendor/nginx/src/os/unix/ngx_darwin_config.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +14 -16
- data/vendor/nginx/src/os/unix/ngx_errno.h +3 -0
- data/vendor/nginx/src/os/unix/ngx_files.h +10 -16
- data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +6 -0
- data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +1 -1
- data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +2 -2
- data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +17 -19
- data/vendor/nginx/src/os/unix/ngx_linux_config.h +8 -2
- data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +20 -22
- data/vendor/nginx/src/os/unix/ngx_posix_config.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_process.c +5 -0
- data/vendor/nginx/src/os/unix/ngx_process_cycle.c +15 -3
- data/vendor/nginx/src/os/unix/ngx_readv_chain.c +2 -1
- data/vendor/nginx/src/os/unix/ngx_recv.c +4 -1
- data/vendor/nginx/src/os/unix/ngx_solaris_config.h +1 -0
- data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +14 -16
- metadata +8 -2
@@ -233,6 +233,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
|
|
233
233
|
r->headers_out.status = NGX_HTTP_OK;
|
234
234
|
r->headers_out.content_type_len = sizeof("text/html") - 1;
|
235
235
|
ngx_str_set(&r->headers_out.content_type, "text/html");
|
236
|
+
r->headers_out.content_type_lowcase = NULL;
|
236
237
|
|
237
238
|
rc = ngx_http_send_header(r);
|
238
239
|
|
@@ -357,7 +358,7 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
|
|
357
358
|
|
358
359
|
if (ngx_close_dir(&dir) == NGX_ERROR) {
|
359
360
|
ngx_log_error(NGX_LOG_ALERT, r->connection->log, ngx_errno,
|
360
|
-
ngx_close_dir_n " \"%
|
361
|
+
ngx_close_dir_n " \"%V\" failed", &path);
|
361
362
|
}
|
362
363
|
|
363
364
|
escape_html = ngx_escape_html(NULL, r->uri.data, r->uri.len);
|
@@ -128,7 +128,7 @@ ngx_str_t ngx_http_charset_default_types[] = {
|
|
128
128
|
ngx_string("text/xml"),
|
129
129
|
ngx_string("text/plain"),
|
130
130
|
ngx_string("text/vnd.wap.wml"),
|
131
|
-
ngx_string("application/
|
131
|
+
ngx_string("application/javascript"),
|
132
132
|
ngx_string("application/rss+xml"),
|
133
133
|
ngx_null_string
|
134
134
|
};
|
@@ -10,8 +10,6 @@
|
|
10
10
|
#include <ngx_http.h>
|
11
11
|
|
12
12
|
|
13
|
-
#define NGX_HTTP_DAV_COPY_BLOCK 65536
|
14
|
-
|
15
13
|
#define NGX_HTTP_DAV_OFF 2
|
16
14
|
|
17
15
|
|
@@ -606,7 +604,7 @@ destination_done:
|
|
606
604
|
|
607
605
|
duri.len = last - p;
|
608
606
|
duri.data = p;
|
609
|
-
flags =
|
607
|
+
flags = NGX_HTTP_LOG_UNSAFE;
|
610
608
|
|
611
609
|
if (ngx_http_parse_unsafe_uri(r, &duri, &args, &flags) != NGX_OK) {
|
612
610
|
goto invalid_destination;
|
@@ -138,6 +138,8 @@ static ngx_int_t ngx_http_fastcgi_process_header(ngx_http_request_t *r);
|
|
138
138
|
static ngx_int_t ngx_http_fastcgi_input_filter_init(void *data);
|
139
139
|
static ngx_int_t ngx_http_fastcgi_input_filter(ngx_event_pipe_t *p,
|
140
140
|
ngx_buf_t *buf);
|
141
|
+
static ngx_int_t ngx_http_fastcgi_non_buffered_filter(void *data,
|
142
|
+
ssize_t bytes);
|
141
143
|
static ngx_int_t ngx_http_fastcgi_process_record(ngx_http_request_t *r,
|
142
144
|
ngx_http_fastcgi_ctx_t *f);
|
143
145
|
static void ngx_http_fastcgi_abort_request(ngx_http_request_t *r);
|
@@ -185,6 +187,7 @@ static ngx_conf_bitmask_t ngx_http_fastcgi_next_upstream_masks[] = {
|
|
185
187
|
{ ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
|
186
188
|
{ ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
|
187
189
|
{ ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
|
190
|
+
{ ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 },
|
188
191
|
{ ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 },
|
189
192
|
{ ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING },
|
190
193
|
{ ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF },
|
@@ -232,6 +235,13 @@ static ngx_command_t ngx_http_fastcgi_commands[] = {
|
|
232
235
|
offsetof(ngx_http_fastcgi_loc_conf_t, upstream.store_access),
|
233
236
|
NULL },
|
234
237
|
|
238
|
+
{ ngx_string("fastcgi_buffering"),
|
239
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
240
|
+
ngx_conf_set_flag_slot,
|
241
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
242
|
+
offsetof(ngx_http_fastcgi_loc_conf_t, upstream.buffering),
|
243
|
+
NULL },
|
244
|
+
|
235
245
|
{ ngx_string("fastcgi_ignore_client_abort"),
|
236
246
|
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
237
247
|
ngx_conf_set_flag_slot,
|
@@ -395,6 +405,13 @@ static ngx_command_t ngx_http_fastcgi_commands[] = {
|
|
395
405
|
offsetof(ngx_http_fastcgi_loc_conf_t, upstream.cache_lock_timeout),
|
396
406
|
NULL },
|
397
407
|
|
408
|
+
{ ngx_string("fastcgi_cache_revalidate"),
|
409
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
410
|
+
ngx_conf_set_flag_slot,
|
411
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
412
|
+
offsetof(ngx_http_fastcgi_loc_conf_t, upstream.cache_revalidate),
|
413
|
+
NULL },
|
414
|
+
|
398
415
|
#endif
|
399
416
|
|
400
417
|
{ ngx_string("fastcgi_temp_path"),
|
@@ -553,7 +570,8 @@ static ngx_str_t ngx_http_fastcgi_hide_headers[] = {
|
|
553
570
|
#if (NGX_HTTP_CACHE)
|
554
571
|
|
555
572
|
static ngx_keyval_t ngx_http_fastcgi_cache_headers[] = {
|
556
|
-
{ ngx_string("HTTP_IF_MODIFIED_SINCE"),
|
573
|
+
{ ngx_string("HTTP_IF_MODIFIED_SINCE"),
|
574
|
+
ngx_string("$upstream_cache_last_modified") },
|
557
575
|
{ ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
|
558
576
|
{ ngx_string("HTTP_IF_NONE_MATCH"), ngx_string("") },
|
559
577
|
{ ngx_string("HTTP_IF_MATCH"), ngx_string("") },
|
@@ -578,13 +596,6 @@ ngx_http_fastcgi_handler(ngx_http_request_t *r)
|
|
578
596
|
ngx_http_fastcgi_ctx_t *f;
|
579
597
|
ngx_http_fastcgi_loc_conf_t *flcf;
|
580
598
|
|
581
|
-
if (r->subrequest_in_memory) {
|
582
|
-
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
|
583
|
-
"ngx_http_fastcgi_module does not support "
|
584
|
-
"subrequest in memory");
|
585
|
-
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
586
|
-
}
|
587
|
-
|
588
599
|
if (ngx_http_upstream_create(r) != NGX_OK) {
|
589
600
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
590
601
|
}
|
@@ -621,7 +632,7 @@ ngx_http_fastcgi_handler(ngx_http_request_t *r)
|
|
621
632
|
u->finalize_request = ngx_http_fastcgi_finalize_request;
|
622
633
|
r->state = 0;
|
623
634
|
|
624
|
-
u->buffering =
|
635
|
+
u->buffering = flcf->upstream.buffering;
|
625
636
|
|
626
637
|
u->pipe = ngx_pcalloc(r->pool, sizeof(ngx_event_pipe_t));
|
627
638
|
if (u->pipe == NULL) {
|
@@ -632,6 +643,8 @@ ngx_http_fastcgi_handler(ngx_http_request_t *r)
|
|
632
643
|
u->pipe->input_ctx = r;
|
633
644
|
|
634
645
|
u->input_filter_init = ngx_http_fastcgi_input_filter_init;
|
646
|
+
u->input_filter = ngx_http_fastcgi_non_buffered_filter;
|
647
|
+
u->input_filter_ctx = r;
|
635
648
|
|
636
649
|
rc = ngx_http_read_client_request_body(r, ngx_http_upstream_init);
|
637
650
|
|
@@ -1582,7 +1595,7 @@ ngx_http_fastcgi_process_header(ngx_http_request_t *r)
|
|
1582
1595
|
ngx_str_set(&u->headers_in.status_line, "200 OK");
|
1583
1596
|
}
|
1584
1597
|
|
1585
|
-
if (u->state) {
|
1598
|
+
if (u->state && u->state->status == 0) {
|
1586
1599
|
u->state->status = u->headers_in.status_n;
|
1587
1600
|
}
|
1588
1601
|
|
@@ -1825,19 +1838,13 @@ ngx_http_fastcgi_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
|
|
1825
1838
|
break;
|
1826
1839
|
}
|
1827
1840
|
|
1828
|
-
|
1829
|
-
|
1830
|
-
|
1831
|
-
p->free = cl->next;
|
1832
|
-
ngx_free_chain(p->pool, cl);
|
1833
|
-
|
1834
|
-
} else {
|
1835
|
-
b = ngx_alloc_buf(p->pool);
|
1836
|
-
if (b == NULL) {
|
1837
|
-
return NGX_ERROR;
|
1838
|
-
}
|
1841
|
+
cl = ngx_chain_get_free_buf(p->pool, &p->free);
|
1842
|
+
if (cl == NULL) {
|
1843
|
+
return NGX_ERROR;
|
1839
1844
|
}
|
1840
1845
|
|
1846
|
+
b = cl->buf;
|
1847
|
+
|
1841
1848
|
ngx_memzero(b, sizeof(ngx_buf_t));
|
1842
1849
|
|
1843
1850
|
b->pos = f->pos;
|
@@ -1850,14 +1857,6 @@ ngx_http_fastcgi_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
|
|
1850
1857
|
*prev = b;
|
1851
1858
|
prev = &b->shadow;
|
1852
1859
|
|
1853
|
-
cl = ngx_alloc_chain_link(p->pool);
|
1854
|
-
if (cl == NULL) {
|
1855
|
-
return NGX_ERROR;
|
1856
|
-
}
|
1857
|
-
|
1858
|
-
cl->buf = b;
|
1859
|
-
cl->next = NULL;
|
1860
|
-
|
1861
1860
|
if (p->in) {
|
1862
1861
|
*p->last_in = cl;
|
1863
1862
|
} else {
|
@@ -1924,6 +1923,222 @@ ngx_http_fastcgi_input_filter(ngx_event_pipe_t *p, ngx_buf_t *buf)
|
|
1924
1923
|
}
|
1925
1924
|
|
1926
1925
|
|
1926
|
+
static ngx_int_t
|
1927
|
+
ngx_http_fastcgi_non_buffered_filter(void *data, ssize_t bytes)
|
1928
|
+
{
|
1929
|
+
u_char *m, *msg;
|
1930
|
+
ngx_int_t rc;
|
1931
|
+
ngx_buf_t *b, *buf;
|
1932
|
+
ngx_chain_t *cl, **ll;
|
1933
|
+
ngx_http_request_t *r;
|
1934
|
+
ngx_http_upstream_t *u;
|
1935
|
+
ngx_http_fastcgi_ctx_t *f;
|
1936
|
+
|
1937
|
+
r = data;
|
1938
|
+
f = ngx_http_get_module_ctx(r, ngx_http_fastcgi_module);
|
1939
|
+
|
1940
|
+
u = r->upstream;
|
1941
|
+
buf = &u->buffer;
|
1942
|
+
|
1943
|
+
buf->pos = buf->last;
|
1944
|
+
buf->last += bytes;
|
1945
|
+
|
1946
|
+
for (cl = u->out_bufs, ll = &u->out_bufs; cl; cl = cl->next) {
|
1947
|
+
ll = &cl->next;
|
1948
|
+
}
|
1949
|
+
|
1950
|
+
f->pos = buf->pos;
|
1951
|
+
f->last = buf->last;
|
1952
|
+
|
1953
|
+
for ( ;; ) {
|
1954
|
+
if (f->state < ngx_http_fastcgi_st_data) {
|
1955
|
+
|
1956
|
+
rc = ngx_http_fastcgi_process_record(r, f);
|
1957
|
+
|
1958
|
+
if (rc == NGX_AGAIN) {
|
1959
|
+
break;
|
1960
|
+
}
|
1961
|
+
|
1962
|
+
if (rc == NGX_ERROR) {
|
1963
|
+
return NGX_ERROR;
|
1964
|
+
}
|
1965
|
+
|
1966
|
+
if (f->type == NGX_HTTP_FASTCGI_STDOUT && f->length == 0) {
|
1967
|
+
f->state = ngx_http_fastcgi_st_padding;
|
1968
|
+
|
1969
|
+
ngx_log_debug0(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
1970
|
+
"http fastcgi closed stdout");
|
1971
|
+
|
1972
|
+
continue;
|
1973
|
+
}
|
1974
|
+
}
|
1975
|
+
|
1976
|
+
if (f->state == ngx_http_fastcgi_st_padding) {
|
1977
|
+
|
1978
|
+
if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) {
|
1979
|
+
|
1980
|
+
if (f->pos + f->padding < f->last) {
|
1981
|
+
u->length = 0;
|
1982
|
+
break;
|
1983
|
+
}
|
1984
|
+
|
1985
|
+
if (f->pos + f->padding == f->last) {
|
1986
|
+
u->length = 0;
|
1987
|
+
u->keepalive = 1;
|
1988
|
+
break;
|
1989
|
+
}
|
1990
|
+
|
1991
|
+
f->padding -= f->last - f->pos;
|
1992
|
+
|
1993
|
+
break;
|
1994
|
+
}
|
1995
|
+
|
1996
|
+
if (f->pos + f->padding < f->last) {
|
1997
|
+
f->state = ngx_http_fastcgi_st_version;
|
1998
|
+
f->pos += f->padding;
|
1999
|
+
|
2000
|
+
continue;
|
2001
|
+
}
|
2002
|
+
|
2003
|
+
if (f->pos + f->padding == f->last) {
|
2004
|
+
f->state = ngx_http_fastcgi_st_version;
|
2005
|
+
|
2006
|
+
break;
|
2007
|
+
}
|
2008
|
+
|
2009
|
+
f->padding -= f->last - f->pos;
|
2010
|
+
|
2011
|
+
break;
|
2012
|
+
}
|
2013
|
+
|
2014
|
+
|
2015
|
+
/* f->state == ngx_http_fastcgi_st_data */
|
2016
|
+
|
2017
|
+
if (f->type == NGX_HTTP_FASTCGI_STDERR) {
|
2018
|
+
|
2019
|
+
if (f->length) {
|
2020
|
+
|
2021
|
+
if (f->pos == f->last) {
|
2022
|
+
break;
|
2023
|
+
}
|
2024
|
+
|
2025
|
+
msg = f->pos;
|
2026
|
+
|
2027
|
+
if (f->pos + f->length <= f->last) {
|
2028
|
+
f->pos += f->length;
|
2029
|
+
f->length = 0;
|
2030
|
+
f->state = ngx_http_fastcgi_st_padding;
|
2031
|
+
|
2032
|
+
} else {
|
2033
|
+
f->length -= f->last - f->pos;
|
2034
|
+
f->pos = f->last;
|
2035
|
+
}
|
2036
|
+
|
2037
|
+
for (m = f->pos - 1; msg < m; m--) {
|
2038
|
+
if (*m != LF && *m != CR && *m != '.' && *m != ' ') {
|
2039
|
+
break;
|
2040
|
+
}
|
2041
|
+
}
|
2042
|
+
|
2043
|
+
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
2044
|
+
"FastCGI sent in stderr: \"%*s\"",
|
2045
|
+
m + 1 - msg, msg);
|
2046
|
+
|
2047
|
+
} else {
|
2048
|
+
f->state = ngx_http_fastcgi_st_padding;
|
2049
|
+
}
|
2050
|
+
|
2051
|
+
continue;
|
2052
|
+
}
|
2053
|
+
|
2054
|
+
if (f->type == NGX_HTTP_FASTCGI_END_REQUEST) {
|
2055
|
+
|
2056
|
+
if (f->pos + f->length <= f->last) {
|
2057
|
+
f->state = ngx_http_fastcgi_st_padding;
|
2058
|
+
f->pos += f->length;
|
2059
|
+
|
2060
|
+
continue;
|
2061
|
+
}
|
2062
|
+
|
2063
|
+
f->length -= f->last - f->pos;
|
2064
|
+
|
2065
|
+
break;
|
2066
|
+
}
|
2067
|
+
|
2068
|
+
|
2069
|
+
/* f->type == NGX_HTTP_FASTCGI_STDOUT */
|
2070
|
+
|
2071
|
+
if (f->pos == f->last) {
|
2072
|
+
break;
|
2073
|
+
}
|
2074
|
+
|
2075
|
+
cl = ngx_chain_get_free_buf(r->pool, &u->free_bufs);
|
2076
|
+
if (cl == NULL) {
|
2077
|
+
return NGX_ERROR;
|
2078
|
+
}
|
2079
|
+
|
2080
|
+
*ll = cl;
|
2081
|
+
ll = &cl->next;
|
2082
|
+
|
2083
|
+
b = cl->buf;
|
2084
|
+
|
2085
|
+
b->flush = 1;
|
2086
|
+
b->memory = 1;
|
2087
|
+
|
2088
|
+
b->pos = f->pos;
|
2089
|
+
b->tag = u->output.tag;
|
2090
|
+
|
2091
|
+
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2092
|
+
"http fastcgi output buf %p", b->pos);
|
2093
|
+
|
2094
|
+
if (f->pos + f->length <= f->last) {
|
2095
|
+
f->state = ngx_http_fastcgi_st_padding;
|
2096
|
+
f->pos += f->length;
|
2097
|
+
b->last = f->pos;
|
2098
|
+
|
2099
|
+
continue;
|
2100
|
+
}
|
2101
|
+
|
2102
|
+
f->length -= f->last - f->pos;
|
2103
|
+
b->last = f->last;
|
2104
|
+
|
2105
|
+
break;
|
2106
|
+
}
|
2107
|
+
|
2108
|
+
/* provide continuous buffer for subrequests in memory */
|
2109
|
+
|
2110
|
+
if (r->subrequest_in_memory) {
|
2111
|
+
|
2112
|
+
cl = u->out_bufs;
|
2113
|
+
|
2114
|
+
if (cl) {
|
2115
|
+
buf->pos = cl->buf->pos;
|
2116
|
+
}
|
2117
|
+
|
2118
|
+
buf->last = buf->pos;
|
2119
|
+
|
2120
|
+
for (cl = u->out_bufs; cl; cl = cl->next) {
|
2121
|
+
ngx_log_debug3(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
2122
|
+
"http fastcgi in memory %p-%p %uz",
|
2123
|
+
cl->buf->pos, cl->buf->last, ngx_buf_size(cl->buf));
|
2124
|
+
|
2125
|
+
if (buf->last == cl->buf->pos) {
|
2126
|
+
buf->last = cl->buf->last;
|
2127
|
+
continue;
|
2128
|
+
}
|
2129
|
+
|
2130
|
+
buf->last = ngx_movemem(buf->last, cl->buf->pos,
|
2131
|
+
cl->buf->last - cl->buf->pos);
|
2132
|
+
|
2133
|
+
cl->buf->pos = buf->last - (cl->buf->last - cl->buf->pos);
|
2134
|
+
cl->buf->last = buf->last;
|
2135
|
+
}
|
2136
|
+
}
|
2137
|
+
|
2138
|
+
return NGX_OK;
|
2139
|
+
}
|
2140
|
+
|
2141
|
+
|
1927
2142
|
static ngx_int_t
|
1928
2143
|
ngx_http_fastcgi_process_record(ngx_http_request_t *r,
|
1929
2144
|
ngx_http_fastcgi_ctx_t *f)
|
@@ -2126,6 +2341,7 @@ ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf)
|
|
2126
2341
|
conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
|
2127
2342
|
conf->upstream.cache_lock = NGX_CONF_UNSET;
|
2128
2343
|
conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
|
2344
|
+
conf->upstream.cache_revalidate = NGX_CONF_UNSET;
|
2129
2345
|
#endif
|
2130
2346
|
|
2131
2347
|
conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
|
@@ -2136,6 +2352,8 @@ ngx_http_fastcgi_create_loc_conf(ngx_conf_t *cf)
|
|
2136
2352
|
/* "fastcgi_cyclic_temp_file" is disabled */
|
2137
2353
|
conf->upstream.cyclic_temp_file = 0;
|
2138
2354
|
|
2355
|
+
conf->upstream.change_buffering = 1;
|
2356
|
+
|
2139
2357
|
conf->catch_stderr = NGX_CONF_UNSET_PTR;
|
2140
2358
|
|
2141
2359
|
conf->keep_conn = NGX_CONF_UNSET;
|
@@ -2357,12 +2575,6 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2357
2575
|
ngx_conf_merge_ptr_value(conf->upstream.no_cache,
|
2358
2576
|
prev->upstream.no_cache, NULL);
|
2359
2577
|
|
2360
|
-
if (conf->upstream.no_cache && conf->upstream.cache_bypass == NULL) {
|
2361
|
-
ngx_log_error(NGX_LOG_WARN, cf->log, 0,
|
2362
|
-
"\"fastcgi_no_cache\" functionality has been changed in 0.8.46, "
|
2363
|
-
"now it should be used together with \"fastcgi_cache_bypass\"");
|
2364
|
-
}
|
2365
|
-
|
2366
2578
|
ngx_conf_merge_ptr_value(conf->upstream.cache_valid,
|
2367
2579
|
prev->upstream.cache_valid, NULL);
|
2368
2580
|
|
@@ -2376,6 +2588,9 @@ ngx_http_fastcgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
2376
2588
|
ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
|
2377
2589
|
prev->upstream.cache_lock_timeout, 5000);
|
2378
2590
|
|
2591
|
+
ngx_conf_merge_value(conf->upstream.cache_revalidate,
|
2592
|
+
prev->upstream.cache_revalidate, 0);
|
2593
|
+
|
2379
2594
|
#endif
|
2380
2595
|
|
2381
2596
|
ngx_conf_merge_value(conf->upstream.pass_request_headers,
|
@@ -2551,7 +2766,7 @@ ngx_http_fastcgi_merge_params(ngx_conf_t *cf,
|
|
2551
2766
|
|
2552
2767
|
s->key = h->key;
|
2553
2768
|
s->value = h->value;
|
2554
|
-
s->skip_empty =
|
2769
|
+
s->skip_empty = 1;
|
2555
2770
|
|
2556
2771
|
next:
|
2557
2772
|
|
@@ -199,7 +199,7 @@ ngx_http_gunzip_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
199
199
|
}
|
200
200
|
}
|
201
201
|
|
202
|
-
if (ctx->nomem) {
|
202
|
+
if (ctx->nomem || in == NULL) {
|
203
203
|
|
204
204
|
/* flush busy buffers */
|
205
205
|
|
@@ -422,7 +422,7 @@ ngx_http_gunzip_filter_inflate(ngx_http_request_t *r,
|
|
422
422
|
rc = inflate(&ctx->zstream, ctx->flush);
|
423
423
|
|
424
424
|
if (rc != Z_OK && rc != Z_STREAM_END && rc != Z_BUF_ERROR) {
|
425
|
-
ngx_log_error(
|
425
|
+
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
426
426
|
"inflate() failed: %d, %d", ctx->flush, rc);
|
427
427
|
return NGX_ERROR;
|
428
428
|
}
|
@@ -500,9 +500,13 @@ ngx_http_gunzip_filter_inflate(ngx_http_request_t *r,
|
|
500
500
|
return NGX_OK;
|
501
501
|
}
|
502
502
|
|
503
|
-
if (
|
504
|
-
|
505
|
-
|
503
|
+
if (ctx->flush == Z_FINISH && ctx->zstream.avail_in == 0) {
|
504
|
+
|
505
|
+
if (rc != Z_STREAM_END) {
|
506
|
+
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
|
507
|
+
"inflate() returned %d on response end", rc);
|
508
|
+
return NGX_ERROR;
|
509
|
+
}
|
506
510
|
|
507
511
|
if (ngx_http_gunzip_filter_inflate_end(r, ctx) != NGX_OK) {
|
508
512
|
return NGX_ERROR;
|