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
@@ -1287,7 +1287,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
|
|
1287
1287
|
break;
|
1288
1288
|
}
|
1289
1289
|
|
1290
|
-
switch(ch) {
|
1290
|
+
switch (ch) {
|
1291
1291
|
#if (NGX_WIN32)
|
1292
1292
|
case '\\':
|
1293
1293
|
if (u - 2 >= r->uri.data
|
@@ -1357,7 +1357,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
|
|
1357
1357
|
break;
|
1358
1358
|
}
|
1359
1359
|
|
1360
|
-
switch(ch) {
|
1360
|
+
switch (ch) {
|
1361
1361
|
#if (NGX_WIN32)
|
1362
1362
|
case '\\':
|
1363
1363
|
break;
|
@@ -1400,7 +1400,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
|
|
1400
1400
|
break;
|
1401
1401
|
}
|
1402
1402
|
|
1403
|
-
switch(ch) {
|
1403
|
+
switch (ch) {
|
1404
1404
|
#if (NGX_WIN32)
|
1405
1405
|
case '\\':
|
1406
1406
|
#endif
|
@@ -1441,7 +1441,7 @@ ngx_http_parse_complex_uri(ngx_http_request_t *r, ngx_uint_t merge_slashes)
|
|
1441
1441
|
break;
|
1442
1442
|
}
|
1443
1443
|
|
1444
|
-
switch(ch) {
|
1444
|
+
switch (ch) {
|
1445
1445
|
#if (NGX_WIN32)
|
1446
1446
|
case '\\':
|
1447
1447
|
#endif
|
@@ -1984,6 +1984,57 @@ ngx_http_parse_multi_header_lines(ngx_array_t *headers, ngx_str_t *name,
|
|
1984
1984
|
}
|
1985
1985
|
|
1986
1986
|
|
1987
|
+
ngx_int_t
|
1988
|
+
ngx_http_parse_set_cookie_lines(ngx_array_t *headers, ngx_str_t *name,
|
1989
|
+
ngx_str_t *value)
|
1990
|
+
{
|
1991
|
+
ngx_uint_t i;
|
1992
|
+
u_char *start, *last, *end;
|
1993
|
+
ngx_table_elt_t **h;
|
1994
|
+
|
1995
|
+
h = headers->elts;
|
1996
|
+
|
1997
|
+
for (i = 0; i < headers->nelts; i++) {
|
1998
|
+
|
1999
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, headers->pool->log, 0,
|
2000
|
+
"parse header: \"%V: %V\"", &h[i]->key, &h[i]->value);
|
2001
|
+
|
2002
|
+
if (name->len >= h[i]->value.len) {
|
2003
|
+
continue;
|
2004
|
+
}
|
2005
|
+
|
2006
|
+
start = h[i]->value.data;
|
2007
|
+
end = h[i]->value.data + h[i]->value.len;
|
2008
|
+
|
2009
|
+
if (ngx_strncasecmp(start, name->data, name->len) != 0) {
|
2010
|
+
continue;
|
2011
|
+
}
|
2012
|
+
|
2013
|
+
for (start += name->len; start < end && *start == ' '; start++) {
|
2014
|
+
/* void */
|
2015
|
+
}
|
2016
|
+
|
2017
|
+
if (start == end || *start++ != '=') {
|
2018
|
+
/* the invalid header value */
|
2019
|
+
continue;
|
2020
|
+
}
|
2021
|
+
|
2022
|
+
while (start < end && *start == ' ') { start++; }
|
2023
|
+
|
2024
|
+
for (last = start; last < end && *last != ';'; last++) {
|
2025
|
+
/* void */
|
2026
|
+
}
|
2027
|
+
|
2028
|
+
value->len = last - start;
|
2029
|
+
value->data = start;
|
2030
|
+
|
2031
|
+
return i;
|
2032
|
+
}
|
2033
|
+
|
2034
|
+
return NGX_DECLINED;
|
2035
|
+
}
|
2036
|
+
|
2037
|
+
|
1987
2038
|
ngx_int_t
|
1988
2039
|
ngx_http_arg(ngx_http_request_t *r, u_char *name, size_t len, ngx_str_t *value)
|
1989
2040
|
{
|
@@ -652,6 +652,7 @@ ngx_http_ssl_handshake(ngx_event_t *rev)
|
|
652
652
|
|
653
653
|
if (n == -1) {
|
654
654
|
if (err == NGX_EAGAIN) {
|
655
|
+
rev->ready = 0;
|
655
656
|
|
656
657
|
if (!rev->timer_set) {
|
657
658
|
ngx_add_timer(rev, c->listening->post_accept_timeout);
|
@@ -2169,13 +2170,11 @@ ngx_http_request_handler(ngx_event_t *ev)
|
|
2169
2170
|
{
|
2170
2171
|
ngx_connection_t *c;
|
2171
2172
|
ngx_http_request_t *r;
|
2172
|
-
ngx_http_log_ctx_t *ctx;
|
2173
2173
|
|
2174
2174
|
c = ev->data;
|
2175
2175
|
r = c->data;
|
2176
2176
|
|
2177
|
-
|
2178
|
-
ctx->current_request = r;
|
2177
|
+
ngx_http_set_log_request(c->log, r);
|
2179
2178
|
|
2180
2179
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
2181
2180
|
"http run request: \"%V?%V\"", &r->uri, &r->args);
|
@@ -2195,7 +2194,6 @@ void
|
|
2195
2194
|
ngx_http_run_posted_requests(ngx_connection_t *c)
|
2196
2195
|
{
|
2197
2196
|
ngx_http_request_t *r;
|
2198
|
-
ngx_http_log_ctx_t *ctx;
|
2199
2197
|
ngx_http_posted_request_t *pr;
|
2200
2198
|
|
2201
2199
|
for ( ;; ) {
|
@@ -2215,8 +2213,7 @@ ngx_http_run_posted_requests(ngx_connection_t *c)
|
|
2215
2213
|
|
2216
2214
|
r = pr->request;
|
2217
2215
|
|
2218
|
-
|
2219
|
-
ctx->current_request = r;
|
2216
|
+
ngx_http_set_log_request(c->log, r);
|
2220
2217
|
|
2221
2218
|
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
|
2222
2219
|
"http posted request: \"%V?%V\"", &r->uri, &r->args);
|
@@ -2528,6 +2525,11 @@ ngx_http_finalize_connection(ngx_http_request_t *r)
|
|
2528
2525
|
return;
|
2529
2526
|
}
|
2530
2527
|
|
2528
|
+
if (r->reading_body) {
|
2529
|
+
r->keepalive = 0;
|
2530
|
+
r->lingering_close = 1;
|
2531
|
+
}
|
2532
|
+
|
2531
2533
|
if (!ngx_terminate
|
2532
2534
|
&& !ngx_exiting
|
2533
2535
|
&& r->keepalive
|
@@ -2655,6 +2657,12 @@ ngx_http_writer(ngx_http_request_t *r)
|
|
2655
2657
|
|
2656
2658
|
if (r->buffered || r->postponed || (r == r->main && c->buffered)) {
|
2657
2659
|
|
2660
|
+
#if (NGX_HTTP_SPDY)
|
2661
|
+
if (r->spdy_stream) {
|
2662
|
+
return;
|
2663
|
+
}
|
2664
|
+
#endif
|
2665
|
+
|
2658
2666
|
if (!wev->delayed) {
|
2659
2667
|
ngx_add_timer(wev, clcf->send_timeout);
|
2660
2668
|
}
|
@@ -473,6 +473,7 @@ struct ngx_http_request_s {
|
|
473
473
|
unsigned request_body_in_clean_file:1;
|
474
474
|
unsigned request_body_file_group_access:1;
|
475
475
|
unsigned request_body_file_log_level:3;
|
476
|
+
unsigned request_body_no_buffering:1;
|
476
477
|
|
477
478
|
unsigned subrequest_in_memory:1;
|
478
479
|
unsigned waited:1;
|
@@ -509,9 +510,9 @@ struct ngx_http_request_s {
|
|
509
510
|
unsigned keepalive:1;
|
510
511
|
unsigned lingering_close:1;
|
511
512
|
unsigned discard_body:1;
|
513
|
+
unsigned reading_body:1;
|
512
514
|
unsigned internal:1;
|
513
515
|
unsigned error_page:1;
|
514
|
-
unsigned ignore_content_encoding:1;
|
515
516
|
unsigned filter_finalize:1;
|
516
517
|
unsigned post_action:1;
|
517
518
|
unsigned request_complete:1;
|
@@ -529,6 +530,7 @@ struct ngx_http_request_s {
|
|
529
530
|
unsigned filter_need_temporary:1;
|
530
531
|
unsigned allow_ranges:1;
|
531
532
|
unsigned single_range:1;
|
533
|
+
unsigned disable_not_modified:1;
|
532
534
|
|
533
535
|
#if (NGX_STAT_STUB)
|
534
536
|
unsigned stat_reading:1;
|
@@ -574,12 +576,12 @@ struct ngx_http_request_s {
|
|
574
576
|
|
575
577
|
typedef struct {
|
576
578
|
ngx_http_posted_request_t terminal_posted_request;
|
577
|
-
#if (NGX_HAVE_AIO_SENDFILE)
|
578
|
-
u_char aio_preload;
|
579
|
-
#endif
|
580
579
|
} ngx_http_ephemeral_t;
|
581
580
|
|
582
581
|
|
582
|
+
#define ngx_http_ephemeral(r) (void *) (&r->uri_start)
|
583
|
+
|
584
|
+
|
583
585
|
extern ngx_http_header_t ngx_http_headers_in[];
|
584
586
|
extern ngx_http_header_out_t ngx_http_headers_out[];
|
585
587
|
|
@@ -588,9 +590,15 @@ extern ngx_http_header_out_t ngx_http_headers_out[];
|
|
588
590
|
\
|
589
591
|
c->log->file = l->file; \
|
590
592
|
c->log->next = l->next; \
|
593
|
+
c->log->writer = l->writer; \
|
594
|
+
c->log->wdata = l->wdata; \
|
591
595
|
if (!(c->log->log_level & NGX_LOG_DEBUG_CONNECTION)) { \
|
592
596
|
c->log->log_level = l->log_level; \
|
593
597
|
}
|
594
598
|
|
595
599
|
|
600
|
+
#define ngx_http_set_log_request(log, r) \
|
601
|
+
((ngx_http_log_ctx_t *) log->data)->current_request = r
|
602
|
+
|
603
|
+
|
596
604
|
#endif /* _NGX_HTTP_REQUEST_H_INCLUDED_ */
|
@@ -24,8 +24,6 @@ static ngx_int_t ngx_http_request_body_length_filter(ngx_http_request_t *r,
|
|
24
24
|
ngx_chain_t *in);
|
25
25
|
static ngx_int_t ngx_http_request_body_chunked_filter(ngx_http_request_t *r,
|
26
26
|
ngx_chain_t *in);
|
27
|
-
static ngx_int_t ngx_http_request_body_save_filter(ngx_http_request_t *r,
|
28
|
-
ngx_chain_t *in);
|
29
27
|
|
30
28
|
|
31
29
|
ngx_int_t
|
@@ -44,12 +42,14 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
|
44
42
|
|
45
43
|
#if (NGX_HTTP_SPDY)
|
46
44
|
if (r->spdy_stream && r == r->main) {
|
45
|
+
r->request_body_no_buffering = 0;
|
47
46
|
rc = ngx_http_spdy_read_request_body(r, post_handler);
|
48
47
|
goto done;
|
49
48
|
}
|
50
49
|
#endif
|
51
50
|
|
52
51
|
if (r != r->main || r->request_body || r->discard_body) {
|
52
|
+
r->request_body_no_buffering = 0;
|
53
53
|
post_handler(r);
|
54
54
|
return NGX_OK;
|
55
55
|
}
|
@@ -59,6 +59,10 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
|
59
59
|
goto done;
|
60
60
|
}
|
61
61
|
|
62
|
+
if (r->request_body_no_buffering) {
|
63
|
+
r->request_body_in_file_only = 0;
|
64
|
+
}
|
65
|
+
|
62
66
|
rb = ngx_pcalloc(r->pool, sizeof(ngx_http_request_body_t));
|
63
67
|
if (rb == NULL) {
|
64
68
|
rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
|
@@ -81,6 +85,7 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
|
81
85
|
r->request_body = rb;
|
82
86
|
|
83
87
|
if (r->headers_in.content_length_n < 0 && !r->headers_in.chunked) {
|
88
|
+
r->request_body_no_buffering = 0;
|
84
89
|
post_handler(r);
|
85
90
|
return NGX_OK;
|
86
91
|
}
|
@@ -173,6 +178,8 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
|
173
178
|
}
|
174
179
|
}
|
175
180
|
|
181
|
+
r->request_body_no_buffering = 0;
|
182
|
+
|
176
183
|
post_handler(r);
|
177
184
|
|
178
185
|
return NGX_OK;
|
@@ -216,6 +223,21 @@ ngx_http_read_client_request_body(ngx_http_request_t *r,
|
|
216
223
|
|
217
224
|
done:
|
218
225
|
|
226
|
+
if (r->request_body_no_buffering
|
227
|
+
&& (rc == NGX_OK || rc == NGX_AGAIN))
|
228
|
+
{
|
229
|
+
if (rc == NGX_OK) {
|
230
|
+
r->request_body_no_buffering = 0;
|
231
|
+
|
232
|
+
} else {
|
233
|
+
/* rc == NGX_AGAIN */
|
234
|
+
r->reading_body = 1;
|
235
|
+
}
|
236
|
+
|
237
|
+
r->read_event_handler = ngx_http_block_reading;
|
238
|
+
post_handler(r);
|
239
|
+
}
|
240
|
+
|
219
241
|
if (rc >= NGX_HTTP_SPECIAL_RESPONSE) {
|
220
242
|
r->main->count--;
|
221
243
|
}
|
@@ -224,6 +246,26 @@ done:
|
|
224
246
|
}
|
225
247
|
|
226
248
|
|
249
|
+
ngx_int_t
|
250
|
+
ngx_http_read_unbuffered_request_body(ngx_http_request_t *r)
|
251
|
+
{
|
252
|
+
ngx_int_t rc;
|
253
|
+
|
254
|
+
if (r->connection->read->timedout) {
|
255
|
+
r->connection->timedout = 1;
|
256
|
+
return NGX_HTTP_REQUEST_TIME_OUT;
|
257
|
+
}
|
258
|
+
|
259
|
+
rc = ngx_http_do_read_client_request_body(r);
|
260
|
+
|
261
|
+
if (rc == NGX_OK) {
|
262
|
+
r->reading_body = 0;
|
263
|
+
}
|
264
|
+
|
265
|
+
return rc;
|
266
|
+
}
|
267
|
+
|
268
|
+
|
227
269
|
static void
|
228
270
|
ngx_http_read_client_request_body_handler(ngx_http_request_t *r)
|
229
271
|
{
|
@@ -266,32 +308,43 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
|
|
266
308
|
for ( ;; ) {
|
267
309
|
if (rb->buf->last == rb->buf->end) {
|
268
310
|
|
269
|
-
|
311
|
+
if (rb->buf->pos != rb->buf->last) {
|
270
312
|
|
271
|
-
|
272
|
-
out.next = NULL;
|
313
|
+
/* pass buffer to request body filter chain */
|
273
314
|
|
274
|
-
|
315
|
+
out.buf = rb->buf;
|
316
|
+
out.next = NULL;
|
275
317
|
|
276
|
-
|
277
|
-
return rc;
|
278
|
-
}
|
318
|
+
rc = ngx_http_request_body_filter(r, &out);
|
279
319
|
|
280
|
-
|
320
|
+
if (rc != NGX_OK) {
|
321
|
+
return rc;
|
322
|
+
}
|
281
323
|
|
282
|
-
|
283
|
-
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
284
|
-
}
|
324
|
+
} else {
|
285
325
|
|
286
|
-
|
326
|
+
/* update chains */
|
287
327
|
|
288
|
-
|
328
|
+
rc = ngx_http_request_body_filter(r, NULL);
|
289
329
|
|
290
|
-
|
291
|
-
|
330
|
+
if (rc != NGX_OK) {
|
331
|
+
return rc;
|
332
|
+
}
|
292
333
|
}
|
293
334
|
|
294
335
|
if (rb->busy != NULL) {
|
336
|
+
if (r->request_body_no_buffering) {
|
337
|
+
if (c->read->timer_set) {
|
338
|
+
ngx_del_timer(c->read);
|
339
|
+
}
|
340
|
+
|
341
|
+
if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
|
342
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
343
|
+
}
|
344
|
+
|
345
|
+
return NGX_AGAIN;
|
346
|
+
}
|
347
|
+
|
295
348
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
296
349
|
}
|
297
350
|
|
@@ -358,6 +411,22 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
|
|
358
411
|
}
|
359
412
|
|
360
413
|
if (!c->read->ready) {
|
414
|
+
|
415
|
+
if (r->request_body_no_buffering
|
416
|
+
&& rb->buf->pos != rb->buf->last)
|
417
|
+
{
|
418
|
+
/* pass buffer to request body filter chain */
|
419
|
+
|
420
|
+
out.buf = rb->buf;
|
421
|
+
out.next = NULL;
|
422
|
+
|
423
|
+
rc = ngx_http_request_body_filter(r, &out);
|
424
|
+
|
425
|
+
if (rc != NGX_OK) {
|
426
|
+
return rc;
|
427
|
+
}
|
428
|
+
}
|
429
|
+
|
361
430
|
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
|
362
431
|
ngx_add_timer(c->read, clcf->client_body_timeout);
|
363
432
|
|
@@ -403,9 +472,10 @@ ngx_http_do_read_client_request_body(ngx_http_request_t *r)
|
|
403
472
|
}
|
404
473
|
}
|
405
474
|
|
406
|
-
r->
|
407
|
-
|
408
|
-
|
475
|
+
if (!r->request_body_no_buffering) {
|
476
|
+
r->read_event_handler = ngx_http_block_reading;
|
477
|
+
rb->post_handler(r);
|
478
|
+
}
|
409
479
|
|
410
480
|
return NGX_OK;
|
411
481
|
}
|
@@ -415,7 +485,7 @@ static ngx_int_t
|
|
415
485
|
ngx_http_write_request_body(ngx_http_request_t *r)
|
416
486
|
{
|
417
487
|
ssize_t n;
|
418
|
-
ngx_chain_t *cl;
|
488
|
+
ngx_chain_t *cl, *ln;
|
419
489
|
ngx_temp_file_t *tf;
|
420
490
|
ngx_http_request_body_t *rb;
|
421
491
|
ngx_http_core_loc_conf_t *clcf;
|
@@ -478,8 +548,13 @@ ngx_http_write_request_body(ngx_http_request_t *r)
|
|
478
548
|
|
479
549
|
/* mark all buffers as written */
|
480
550
|
|
481
|
-
for (cl = rb->bufs; cl;
|
551
|
+
for (cl = rb->bufs; cl; /* void */) {
|
552
|
+
|
482
553
|
cl->buf->pos = cl->buf->last;
|
554
|
+
|
555
|
+
ln = cl;
|
556
|
+
cl = cl->next;
|
557
|
+
ngx_free_chain(r->pool, ln);
|
483
558
|
}
|
484
559
|
|
485
560
|
rb->bufs = NULL;
|
@@ -874,6 +949,7 @@ ngx_http_request_body_length_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
874
949
|
b->pos = cl->buf->pos;
|
875
950
|
b->last = cl->buf->last;
|
876
951
|
b->end = cl->buf->end;
|
952
|
+
b->flush = r->request_body_no_buffering;
|
877
953
|
|
878
954
|
size = cl->buf->last - cl->buf->pos;
|
879
955
|
|
@@ -892,7 +968,7 @@ ngx_http_request_body_length_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
892
968
|
ll = &tl->next;
|
893
969
|
}
|
894
970
|
|
895
|
-
rc =
|
971
|
+
rc = ngx_http_top_request_body_filter(r, out);
|
896
972
|
|
897
973
|
ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
|
898
974
|
(ngx_buf_tag_t) &ngx_http_read_client_request_body);
|
@@ -936,7 +1012,7 @@ ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
936
1012
|
|
937
1013
|
ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
|
938
1014
|
"http body chunked buf "
|
939
|
-
"t:%d f:%d %p, pos %p, size: %z file: %O, size: %
|
1015
|
+
"t:%d f:%d %p, pos %p, size: %z file: %O, size: %O",
|
940
1016
|
cl->buf->temporary, cl->buf->in_file,
|
941
1017
|
cl->buf->start, cl->buf->pos,
|
942
1018
|
cl->buf->last - cl->buf->pos,
|
@@ -981,6 +1057,7 @@ ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
981
1057
|
b->pos = cl->buf->pos;
|
982
1058
|
b->last = cl->buf->last;
|
983
1059
|
b->end = cl->buf->end;
|
1060
|
+
b->flush = r->request_body_no_buffering;
|
984
1061
|
|
985
1062
|
*ll = tl;
|
986
1063
|
ll = &tl->next;
|
@@ -1044,7 +1121,7 @@ ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
1044
1121
|
}
|
1045
1122
|
}
|
1046
1123
|
|
1047
|
-
rc =
|
1124
|
+
rc = ngx_http_top_request_body_filter(r, out);
|
1048
1125
|
|
1049
1126
|
ngx_chain_update_chains(r->pool, &rb->free, &rb->busy, &out,
|
1050
1127
|
(ngx_buf_tag_t) &ngx_http_read_client_request_body);
|
@@ -1053,7 +1130,7 @@ ngx_http_request_body_chunked_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
1053
1130
|
}
|
1054
1131
|
|
1055
1132
|
|
1056
|
-
|
1133
|
+
ngx_int_t
|
1057
1134
|
ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
1058
1135
|
{
|
1059
1136
|
#if (NGX_DEBUG)
|
@@ -1068,7 +1145,7 @@ ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
1068
1145
|
for (cl = rb->bufs; cl; cl = cl->next) {
|
1069
1146
|
ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
|
1070
1147
|
"http body old buf t:%d f:%d %p, pos %p, size: %z "
|
1071
|
-
"file: %O, size: %
|
1148
|
+
"file: %O, size: %O",
|
1072
1149
|
cl->buf->temporary, cl->buf->in_file,
|
1073
1150
|
cl->buf->start, cl->buf->pos,
|
1074
1151
|
cl->buf->last - cl->buf->pos,
|
@@ -1079,7 +1156,7 @@ ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
1079
1156
|
for (cl = in; cl; cl = cl->next) {
|
1080
1157
|
ngx_log_debug7(NGX_LOG_DEBUG_EVENT, r->connection->log, 0,
|
1081
1158
|
"http body new buf t:%d f:%d %p, pos %p, size: %z "
|
1082
|
-
"file: %O, size: %
|
1159
|
+
"file: %O, size: %O",
|
1083
1160
|
cl->buf->temporary, cl->buf->in_file,
|
1084
1161
|
cl->buf->start, cl->buf->pos,
|
1085
1162
|
cl->buf->last - cl->buf->pos,
|
@@ -1095,5 +1172,14 @@ ngx_http_request_body_save_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
1095
1172
|
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
1096
1173
|
}
|
1097
1174
|
|
1175
|
+
if (rb->rest > 0
|
1176
|
+
&& rb->buf && rb->buf->last == rb->buf->end
|
1177
|
+
&& !r->request_body_no_buffering)
|
1178
|
+
{
|
1179
|
+
if (ngx_http_write_request_body(r) != NGX_OK) {
|
1180
|
+
return NGX_HTTP_INTERNAL_SERVER_ERROR;
|
1181
|
+
}
|
1182
|
+
}
|
1183
|
+
|
1098
1184
|
return NGX_OK;
|
1099
1185
|
}
|