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
@@ -24,10 +24,11 @@
|
|
24
24
|
#define NGX_HTTP_UPSTREAM_FT_HTTP_502 0x00000020
|
25
25
|
#define NGX_HTTP_UPSTREAM_FT_HTTP_503 0x00000040
|
26
26
|
#define NGX_HTTP_UPSTREAM_FT_HTTP_504 0x00000080
|
27
|
-
#define
|
28
|
-
#define
|
29
|
-
#define
|
30
|
-
#define
|
27
|
+
#define NGX_HTTP_UPSTREAM_FT_HTTP_403 0x00000100
|
28
|
+
#define NGX_HTTP_UPSTREAM_FT_HTTP_404 0x00000200
|
29
|
+
#define NGX_HTTP_UPSTREAM_FT_UPDATING 0x00000400
|
30
|
+
#define NGX_HTTP_UPSTREAM_FT_BUSY_LOCK 0x00000800
|
31
|
+
#define NGX_HTTP_UPSTREAM_FT_MAX_WAITING 0x00001000
|
31
32
|
#define NGX_HTTP_UPSTREAM_FT_NOLIVE 0x40000000
|
32
33
|
#define NGX_HTTP_UPSTREAM_FT_OFF 0x80000000
|
33
34
|
|
@@ -35,6 +36,7 @@
|
|
35
36
|
|NGX_HTTP_UPSTREAM_FT_HTTP_502 \
|
36
37
|
|NGX_HTTP_UPSTREAM_FT_HTTP_503 \
|
37
38
|
|NGX_HTTP_UPSTREAM_FT_HTTP_504 \
|
39
|
+
|NGX_HTTP_UPSTREAM_FT_HTTP_403 \
|
38
40
|
|NGX_HTTP_UPSTREAM_FT_HTTP_404)
|
39
41
|
|
40
42
|
#define NGX_HTTP_UPSTREAM_INVALID_HEADER 40
|
@@ -176,6 +178,8 @@ typedef struct {
|
|
176
178
|
ngx_flag_t cache_lock;
|
177
179
|
ngx_msec_t cache_lock_timeout;
|
178
180
|
|
181
|
+
ngx_flag_t cache_revalidate;
|
182
|
+
|
179
183
|
ngx_array_t *cache_valid;
|
180
184
|
ngx_array_t *cache_bypass;
|
181
185
|
ngx_array_t *no_cache;
|
@@ -252,7 +256,7 @@ typedef struct {
|
|
252
256
|
ngx_uint_t no_port; /* unsigned no_port:1 */
|
253
257
|
|
254
258
|
ngx_uint_t naddrs;
|
255
|
-
|
259
|
+
ngx_addr_t *addrs;
|
256
260
|
|
257
261
|
struct sockaddr *sockaddr;
|
258
262
|
socklen_t socklen;
|
@@ -71,20 +71,20 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
|
|
71
71
|
n = 0;
|
72
72
|
|
73
73
|
for (i = 0; i < us->servers->nelts; i++) {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
}
|
74
|
+
if (server[i].backup) {
|
75
|
+
continue;
|
76
|
+
}
|
78
77
|
|
78
|
+
for (j = 0; j < server[i].naddrs; j++) {
|
79
79
|
peers->peer[n].sockaddr = server[i].addrs[j].sockaddr;
|
80
80
|
peers->peer[n].socklen = server[i].addrs[j].socklen;
|
81
81
|
peers->peer[n].name = server[i].addrs[j].name;
|
82
|
-
peers->peer[n].max_fails = server[i].max_fails;
|
83
|
-
peers->peer[n].fail_timeout = server[i].fail_timeout;
|
84
|
-
peers->peer[n].down = server[i].down;
|
85
82
|
peers->peer[n].weight = server[i].weight;
|
86
83
|
peers->peer[n].effective_weight = server[i].weight;
|
87
84
|
peers->peer[n].current_weight = 0;
|
85
|
+
peers->peer[n].max_fails = server[i].max_fails;
|
86
|
+
peers->peer[n].fail_timeout = server[i].fail_timeout;
|
87
|
+
peers->peer[n].down = server[i].down;
|
88
88
|
n++;
|
89
89
|
}
|
90
90
|
}
|
@@ -125,11 +125,11 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
|
|
125
125
|
n = 0;
|
126
126
|
|
127
127
|
for (i = 0; i < us->servers->nelts; i++) {
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
}
|
128
|
+
if (!server[i].backup) {
|
129
|
+
continue;
|
130
|
+
}
|
132
131
|
|
132
|
+
for (j = 0; j < server[i].naddrs; j++) {
|
133
133
|
backup->peer[n].sockaddr = server[i].addrs[j].sockaddr;
|
134
134
|
backup->peer[n].socklen = server[i].addrs[j].socklen;
|
135
135
|
backup->peer[n].name = server[i].addrs[j].name;
|
@@ -266,8 +266,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
|
|
266
266
|
{
|
267
267
|
u_char *p;
|
268
268
|
size_t len;
|
269
|
+
socklen_t socklen;
|
269
270
|
ngx_uint_t i, n;
|
270
|
-
struct
|
271
|
+
struct sockaddr *sockaddr;
|
271
272
|
ngx_http_upstream_rr_peers_t *peers;
|
272
273
|
ngx_http_upstream_rr_peer_data_t *rrp;
|
273
274
|
|
@@ -306,27 +307,34 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
|
|
306
307
|
|
307
308
|
for (i = 0; i < ur->naddrs; i++) {
|
308
309
|
|
309
|
-
|
310
|
+
socklen = ur->addrs[i].socklen;
|
310
311
|
|
311
|
-
|
312
|
-
if (
|
312
|
+
sockaddr = ngx_palloc(r->pool, socklen);
|
313
|
+
if (sockaddr == NULL) {
|
313
314
|
return NGX_ERROR;
|
314
315
|
}
|
315
316
|
|
316
|
-
|
317
|
-
len = ngx_sprintf(&p[len], ":%d", ur->port) - p;
|
317
|
+
ngx_memcpy(sockaddr, ur->addrs[i].sockaddr, socklen);
|
318
318
|
|
319
|
-
|
320
|
-
|
319
|
+
switch (sockaddr->sa_family) {
|
320
|
+
#if (NGX_HAVE_INET6)
|
321
|
+
case AF_INET6:
|
322
|
+
((struct sockaddr_in6 *) sockaddr)->sin6_port = htons(ur->port);
|
323
|
+
break;
|
324
|
+
#endif
|
325
|
+
default: /* AF_INET */
|
326
|
+
((struct sockaddr_in *) sockaddr)->sin_port = htons(ur->port);
|
327
|
+
}
|
328
|
+
|
329
|
+
p = ngx_pnalloc(r->pool, NGX_SOCKADDR_STRLEN);
|
330
|
+
if (p == NULL) {
|
321
331
|
return NGX_ERROR;
|
322
332
|
}
|
323
333
|
|
324
|
-
|
325
|
-
sin->sin_port = htons(ur->port);
|
326
|
-
sin->sin_addr.s_addr = ur->addrs[i];
|
334
|
+
len = ngx_sock_ntop(sockaddr, socklen, p, NGX_SOCKADDR_STRLEN, 1);
|
327
335
|
|
328
|
-
peers->peer[i].sockaddr =
|
329
|
-
peers->peer[i].socklen =
|
336
|
+
peers->peer[i].sockaddr = sockaddr;
|
337
|
+
peers->peer[i].socklen = socklen;
|
330
338
|
peers->peer[i].name.len = len;
|
331
339
|
peers->peer[i].name.data = p;
|
332
340
|
peers->peer[i].weight = 1;
|
@@ -54,6 +54,8 @@ static ngx_int_t ngx_http_variable_remote_addr(ngx_http_request_t *r,
|
|
54
54
|
ngx_http_variable_value_t *v, uintptr_t data);
|
55
55
|
static ngx_int_t ngx_http_variable_remote_port(ngx_http_request_t *r,
|
56
56
|
ngx_http_variable_value_t *v, uintptr_t data);
|
57
|
+
static ngx_int_t ngx_http_variable_proxy_protocol_addr(ngx_http_request_t *r,
|
58
|
+
ngx_http_variable_value_t *v, uintptr_t data);
|
57
59
|
static ngx_int_t ngx_http_variable_server_addr(ngx_http_request_t *r,
|
58
60
|
ngx_http_variable_value_t *v, uintptr_t data);
|
59
61
|
static ngx_int_t ngx_http_variable_server_port(ngx_http_request_t *r,
|
@@ -183,6 +185,9 @@ static ngx_http_variable_t ngx_http_core_variables[] = {
|
|
183
185
|
|
184
186
|
{ ngx_string("remote_port"), NULL, ngx_http_variable_remote_port, 0, 0, 0 },
|
185
187
|
|
188
|
+
{ ngx_string("proxy_protocol_addr"), NULL,
|
189
|
+
ngx_http_variable_proxy_protocol_addr, 0, 0, 0 },
|
190
|
+
|
186
191
|
{ ngx_string("server_addr"), NULL, ngx_http_variable_server_addr, 0, 0, 0 },
|
187
192
|
|
188
193
|
{ ngx_string("server_port"), NULL, ngx_http_variable_server_port, 0, 0, 0 },
|
@@ -487,7 +492,7 @@ ngx_http_get_indexed_variable(ngx_http_request_t *r, ngx_uint_t index)
|
|
487
492
|
|
488
493
|
if (cmcf->variables.nelts <= index) {
|
489
494
|
ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
|
490
|
-
"unknown variable index: %
|
495
|
+
"unknown variable index: %ui", index);
|
491
496
|
return NULL;
|
492
497
|
}
|
493
498
|
|
@@ -1185,6 +1190,12 @@ ngx_http_variable_remote_port(ngx_http_request_t *r,
|
|
1185
1190
|
break;
|
1186
1191
|
#endif
|
1187
1192
|
|
1193
|
+
#if (NGX_HAVE_UNIX_DOMAIN)
|
1194
|
+
case AF_UNIX:
|
1195
|
+
port = 0;
|
1196
|
+
break;
|
1197
|
+
#endif
|
1198
|
+
|
1188
1199
|
default: /* AF_INET */
|
1189
1200
|
sin = (struct sockaddr_in *) r->connection->sockaddr;
|
1190
1201
|
port = ntohs(sin->sin_port);
|
@@ -1199,6 +1210,20 @@ ngx_http_variable_remote_port(ngx_http_request_t *r,
|
|
1199
1210
|
}
|
1200
1211
|
|
1201
1212
|
|
1213
|
+
static ngx_int_t
|
1214
|
+
ngx_http_variable_proxy_protocol_addr(ngx_http_request_t *r,
|
1215
|
+
ngx_http_variable_value_t *v, uintptr_t data)
|
1216
|
+
{
|
1217
|
+
v->len = r->connection->proxy_protocol_addr.len;
|
1218
|
+
v->valid = 1;
|
1219
|
+
v->no_cacheable = 0;
|
1220
|
+
v->not_found = 0;
|
1221
|
+
v->data = r->connection->proxy_protocol_addr.data;
|
1222
|
+
|
1223
|
+
return NGX_OK;
|
1224
|
+
}
|
1225
|
+
|
1226
|
+
|
1202
1227
|
static ngx_int_t
|
1203
1228
|
ngx_http_variable_server_addr(ngx_http_request_t *r,
|
1204
1229
|
ngx_http_variable_value_t *v, uintptr_t data)
|
@@ -1263,6 +1288,12 @@ ngx_http_variable_server_port(ngx_http_request_t *r,
|
|
1263
1288
|
break;
|
1264
1289
|
#endif
|
1265
1290
|
|
1291
|
+
#if (NGX_HAVE_UNIX_DOMAIN)
|
1292
|
+
case AF_UNIX:
|
1293
|
+
port = 0;
|
1294
|
+
break;
|
1295
|
+
#endif
|
1296
|
+
|
1266
1297
|
default: /* AF_INET */
|
1267
1298
|
sin = (struct sockaddr_in *) r->connection->local_sockaddr;
|
1268
1299
|
port = ntohs(sin->sin_port);
|
@@ -1374,7 +1405,9 @@ ngx_http_variable_document_root(ngx_http_request_t *r,
|
|
1374
1405
|
return NGX_ERROR;
|
1375
1406
|
}
|
1376
1407
|
|
1377
|
-
if (
|
1408
|
+
if (ngx_get_full_name(r->pool, (ngx_str_t *) &ngx_cycle->prefix, &path)
|
1409
|
+
!= NGX_OK)
|
1410
|
+
{
|
1378
1411
|
return NGX_ERROR;
|
1379
1412
|
}
|
1380
1413
|
|
@@ -1416,7 +1449,9 @@ ngx_http_variable_realpath_root(ngx_http_request_t *r,
|
|
1416
1449
|
|
1417
1450
|
path.data[path.len - 1] = '\0';
|
1418
1451
|
|
1419
|
-
if (
|
1452
|
+
if (ngx_get_full_name(r->pool, (ngx_str_t *) &ngx_cycle->prefix, &path)
|
1453
|
+
!= NGX_OK)
|
1454
|
+
{
|
1420
1455
|
return NGX_ERROR;
|
1421
1456
|
}
|
1422
1457
|
}
|
@@ -1740,8 +1775,7 @@ ngx_http_variable_sent_last_modified(ngx_http_request_t *r,
|
|
1740
1775
|
}
|
1741
1776
|
|
1742
1777
|
if (r->headers_out.last_modified_time >= 0) {
|
1743
|
-
p = ngx_pnalloc(r->pool,
|
1744
|
-
sizeof("Last-Modified: Mon, 28 Sep 1970 06:00:00 GMT") - 1);
|
1778
|
+
p = ngx_pnalloc(r->pool, sizeof("Mon, 28 Sep 1970 06:00:00 GMT") - 1);
|
1745
1779
|
if (p == NULL) {
|
1746
1780
|
return NGX_ERROR;
|
1747
1781
|
}
|
@@ -2257,6 +2291,7 @@ ngx_http_regex_compile(ngx_conf_t *cf, ngx_regex_compile_t *rc)
|
|
2257
2291
|
|
2258
2292
|
re->regex = rc->regex;
|
2259
2293
|
re->ncaptures = rc->captures;
|
2294
|
+
re->name = rc->pattern;
|
2260
2295
|
|
2261
2296
|
cmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_core_module);
|
2262
2297
|
cmcf->ncaptures = ngx_max(cmcf->ncaptures, re->ncaptures);
|
@@ -2274,7 +2309,6 @@ ngx_http_regex_compile(ngx_conf_t *cf, ngx_regex_compile_t *rc)
|
|
2274
2309
|
|
2275
2310
|
re->variables = rv;
|
2276
2311
|
re->nvariables = n;
|
2277
|
-
re->name = rc->pattern;
|
2278
2312
|
|
2279
2313
|
size = rc->name_size;
|
2280
2314
|
p = rc->names;
|
@@ -184,7 +184,10 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
184
184
|
return NGX_AGAIN;
|
185
185
|
}
|
186
186
|
|
187
|
-
if (size == 0
|
187
|
+
if (size == 0
|
188
|
+
&& !(c->buffered & NGX_LOWLEVEL_BUFFERED)
|
189
|
+
&& !(last && c->need_last_buf))
|
190
|
+
{
|
188
191
|
if (last || flush) {
|
189
192
|
for (cl = r->out; cl; /* void */) {
|
190
193
|
ln = cl;
|
@@ -207,8 +210,12 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
207
210
|
}
|
208
211
|
|
209
212
|
if (r->limit_rate) {
|
213
|
+
if (r->limit_rate_after == 0) {
|
214
|
+
r->limit_rate_after = clcf->limit_rate_after;
|
215
|
+
}
|
216
|
+
|
210
217
|
limit = (off_t) r->limit_rate * (ngx_time() - r->start_sec + 1)
|
211
|
-
- (c->sent -
|
218
|
+
- (c->sent - r->limit_rate_after);
|
212
219
|
|
213
220
|
if (limit <= 0) {
|
214
221
|
c->write->delayed = 1;
|
@@ -249,14 +256,14 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
249
256
|
|
250
257
|
nsent = c->sent;
|
251
258
|
|
252
|
-
if (
|
259
|
+
if (r->limit_rate_after) {
|
253
260
|
|
254
|
-
sent -=
|
261
|
+
sent -= r->limit_rate_after;
|
255
262
|
if (sent < 0) {
|
256
263
|
sent = 0;
|
257
264
|
}
|
258
265
|
|
259
|
-
nsent -=
|
266
|
+
nsent -= r->limit_rate_after;
|
260
267
|
if (nsent < 0) {
|
261
268
|
nsent = 0;
|
262
269
|
}
|
@@ -465,7 +465,8 @@ ngx_mail_add_addrs(ngx_conf_t *cf, ngx_mail_port_t *mport,
|
|
465
465
|
addrs[i].conf.ssl = addr[i].ssl;
|
466
466
|
#endif
|
467
467
|
|
468
|
-
len = ngx_sock_ntop(addr[i].sockaddr,
|
468
|
+
len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen, buf,
|
469
|
+
NGX_SOCKADDR_STRLEN, 1);
|
469
470
|
|
470
471
|
p = ngx_pnalloc(cf->pool, len);
|
471
472
|
if (p == NULL) {
|
@@ -513,7 +514,8 @@ ngx_mail_add_addrs6(ngx_conf_t *cf, ngx_mail_port_t *mport,
|
|
513
514
|
addrs6[i].conf.ssl = addr[i].ssl;
|
514
515
|
#endif
|
515
516
|
|
516
|
-
len = ngx_sock_ntop(addr[i].sockaddr,
|
517
|
+
len = ngx_sock_ntop(addr[i].sockaddr, addr[i].socklen, buf,
|
518
|
+
NGX_SOCKADDR_STRLEN, 1);
|
517
519
|
|
518
520
|
p = ngx_pnalloc(cf->pool, len);
|
519
521
|
if (p == NULL) {
|
@@ -699,7 +699,6 @@ ngx_mail_auth_http_process_headers(ngx_mail_session_t *s,
|
|
699
699
|
|
700
700
|
p = ngx_pnalloc(s->connection->pool, ctx->err.len);
|
701
701
|
if (p == NULL) {
|
702
|
-
ngx_close_connection(ctx->peer.connection);
|
703
702
|
ngx_destroy_pool(ctx->pool);
|
704
703
|
ngx_mail_session_internal_server_error(s);
|
705
704
|
return;
|
@@ -439,7 +439,8 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
439
439
|
ls->bind = 1;
|
440
440
|
|
441
441
|
} else {
|
442
|
-
len = ngx_sock_ntop(sa,
|
442
|
+
len = ngx_sock_ntop(sa, ls->socklen, buf,
|
443
|
+
NGX_SOCKADDR_STRLEN, 1);
|
443
444
|
|
444
445
|
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
|
445
446
|
"ipv6only is not supported "
|
@@ -127,7 +127,7 @@ ngx_mail_init_connection(ngx_connection_t *c)
|
|
127
127
|
c->data = s;
|
128
128
|
s->connection = c;
|
129
129
|
|
130
|
-
ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%
|
130
|
+
ngx_log_error(NGX_LOG_INFO, c->log, 0, "*%uA client %V connected to %V",
|
131
131
|
c->number, &c->addr_text, s->addr_text);
|
132
132
|
|
133
133
|
ctx = ngx_palloc(c->pool, sizeof(ngx_mail_log_ctx_t));
|
@@ -559,8 +559,13 @@ ngx_mail_send(ngx_event_t *wev)
|
|
559
559
|
n = c->send(c, s->out.data, s->out.len);
|
560
560
|
|
561
561
|
if (n > 0) {
|
562
|
+
s->out.data += n;
|
562
563
|
s->out.len -= n;
|
563
564
|
|
565
|
+
if (s->out.len != 0) {
|
566
|
+
goto again;
|
567
|
+
}
|
568
|
+
|
564
569
|
if (wev->timer_set) {
|
565
570
|
ngx_del_timer(wev);
|
566
571
|
}
|
@@ -584,6 +589,8 @@ ngx_mail_send(ngx_event_t *wev)
|
|
584
589
|
|
585
590
|
/* n == NGX_AGAIN */
|
586
591
|
|
592
|
+
again:
|
593
|
+
|
587
594
|
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
|
588
595
|
|
589
596
|
ngx_add_timer(c->write, cscf->timeout);
|
@@ -620,7 +627,9 @@ ngx_mail_read_command(ngx_mail_session_t *s, ngx_connection_t *c)
|
|
620
627
|
return NGX_ERROR;
|
621
628
|
}
|
622
629
|
|
623
|
-
|
630
|
+
if (s->buffer->pos == s->buffer->last) {
|
631
|
+
return NGX_AGAIN;
|
632
|
+
}
|
624
633
|
}
|
625
634
|
|
626
635
|
cscf = ngx_mail_get_module_srv_conf(s, ngx_mail_core_module);
|
@@ -661,8 +670,12 @@ void
|
|
661
670
|
ngx_mail_auth(ngx_mail_session_t *s, ngx_connection_t *c)
|
662
671
|
{
|
663
672
|
s->args.nelts = 0;
|
664
|
-
|
665
|
-
s->buffer->
|
673
|
+
|
674
|
+
if (s->buffer->pos == s->buffer->last) {
|
675
|
+
s->buffer->pos = s->buffer->start;
|
676
|
+
s->buffer->last = s->buffer->start;
|
677
|
+
}
|
678
|
+
|
666
679
|
s->state = 0;
|
667
680
|
|
668
681
|
if (c->read->timer_set) {
|
@@ -626,6 +626,8 @@ ngx_mail_smtp_parse_command(ngx_mail_session_t *s)
|
|
626
626
|
ngx_str_t *arg;
|
627
627
|
enum {
|
628
628
|
sw_start = 0,
|
629
|
+
sw_command,
|
630
|
+
sw_invalid,
|
629
631
|
sw_spaces_before_argument,
|
630
632
|
sw_argument,
|
631
633
|
sw_almost_done
|
@@ -640,8 +642,14 @@ ngx_mail_smtp_parse_command(ngx_mail_session_t *s)
|
|
640
642
|
|
641
643
|
/* SMTP command */
|
642
644
|
case sw_start:
|
645
|
+
s->cmd_start = p;
|
646
|
+
state = sw_command;
|
647
|
+
|
648
|
+
/* fall through */
|
649
|
+
|
650
|
+
case sw_command:
|
643
651
|
if (ch == ' ' || ch == CR || ch == LF) {
|
644
|
-
c = s->
|
652
|
+
c = s->cmd_start;
|
645
653
|
|
646
654
|
if (p - c == 4) {
|
647
655
|
|
@@ -719,6 +727,9 @@ ngx_mail_smtp_parse_command(ngx_mail_session_t *s)
|
|
719
727
|
goto invalid;
|
720
728
|
}
|
721
729
|
|
730
|
+
s->cmd.data = s->cmd_start;
|
731
|
+
s->cmd.len = p - s->cmd_start;
|
732
|
+
|
722
733
|
switch (ch) {
|
723
734
|
case ' ':
|
724
735
|
state = sw_spaces_before_argument;
|
@@ -738,6 +749,9 @@ ngx_mail_smtp_parse_command(ngx_mail_session_t *s)
|
|
738
749
|
|
739
750
|
break;
|
740
751
|
|
752
|
+
case sw_invalid:
|
753
|
+
goto invalid;
|
754
|
+
|
741
755
|
case sw_spaces_before_argument:
|
742
756
|
switch (ch) {
|
743
757
|
case ' ':
|
@@ -824,9 +838,21 @@ done:
|
|
824
838
|
|
825
839
|
invalid:
|
826
840
|
|
827
|
-
s->state =
|
841
|
+
s->state = sw_invalid;
|
828
842
|
s->arg_start = NULL;
|
829
843
|
|
844
|
+
/* skip invalid command till LF */
|
845
|
+
|
846
|
+
for (p = s->buffer->pos; p < s->buffer->last; p++) {
|
847
|
+
if (*p == LF) {
|
848
|
+
s->state = sw_start;
|
849
|
+
p++;
|
850
|
+
break;
|
851
|
+
}
|
852
|
+
}
|
853
|
+
|
854
|
+
s->buffer->pos = p;
|
855
|
+
|
830
856
|
return NGX_MAIL_PARSE_INVALID_COMMAND;
|
831
857
|
}
|
832
858
|
|
@@ -842,6 +868,10 @@ ngx_mail_auth_parse(ngx_mail_session_t *s, ngx_connection_t *c)
|
|
842
868
|
}
|
843
869
|
#endif
|
844
870
|
|
871
|
+
if (s->args.nelts == 0) {
|
872
|
+
return NGX_MAIL_PARSE_INVALID_COMMAND;
|
873
|
+
}
|
874
|
+
|
845
875
|
arg = s->args.elts;
|
846
876
|
|
847
877
|
if (arg[0].len == 5) {
|