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
@@ -17,6 +17,7 @@ typedef struct {
|
|
17
17
|
ngx_hash_t types;
|
18
18
|
|
19
19
|
ngx_flag_t once;
|
20
|
+
ngx_flag_t last_modified;
|
20
21
|
|
21
22
|
ngx_array_t *types_keys;
|
22
23
|
} ngx_http_sub_loc_conf_t;
|
@@ -89,6 +90,13 @@ static ngx_command_t ngx_http_sub_filter_commands[] = {
|
|
89
90
|
offsetof(ngx_http_sub_loc_conf_t, once),
|
90
91
|
NULL },
|
91
92
|
|
93
|
+
{ ngx_string("sub_filter_last_modified"),
|
94
|
+
NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
|
95
|
+
ngx_conf_set_flag_slot,
|
96
|
+
NGX_HTTP_LOC_CONF_OFFSET,
|
97
|
+
offsetof(ngx_http_sub_loc_conf_t, last_modified),
|
98
|
+
NULL },
|
99
|
+
|
92
100
|
ngx_null_command
|
93
101
|
};
|
94
102
|
|
@@ -167,8 +175,11 @@ ngx_http_sub_header_filter(ngx_http_request_t *r)
|
|
167
175
|
|
168
176
|
if (r == r->main) {
|
169
177
|
ngx_http_clear_content_length(r);
|
170
|
-
ngx_http_clear_last_modified(r);
|
171
178
|
ngx_http_clear_etag(r);
|
179
|
+
|
180
|
+
if (!slcf->last_modified) {
|
181
|
+
ngx_http_clear_last_modified(r);
|
182
|
+
}
|
172
183
|
}
|
173
184
|
|
174
185
|
return ngx_http_next_header_filter(r);
|
@@ -250,66 +261,43 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
250
261
|
return rc;
|
251
262
|
}
|
252
263
|
|
253
|
-
if (ctx->
|
264
|
+
if (ctx->saved.len) {
|
254
265
|
|
255
266
|
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
|
256
267
|
"saved: \"%V\"", &ctx->saved);
|
257
268
|
|
258
|
-
|
269
|
+
cl = ngx_chain_get_free_buf(r->pool, &ctx->free);
|
270
|
+
if (cl == NULL) {
|
271
|
+
return NGX_ERROR;
|
272
|
+
}
|
259
273
|
|
260
|
-
|
261
|
-
cl = ctx->free;
|
262
|
-
ctx->free = ctx->free->next;
|
263
|
-
b = cl->buf;
|
264
|
-
ngx_memzero(b, sizeof(ngx_buf_t));
|
274
|
+
b = cl->buf;
|
265
275
|
|
266
|
-
|
267
|
-
b = ngx_calloc_buf(r->pool);
|
268
|
-
if (b == NULL) {
|
269
|
-
return NGX_ERROR;
|
270
|
-
}
|
276
|
+
ngx_memzero(b, sizeof(ngx_buf_t));
|
271
277
|
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
278
|
+
b->pos = ngx_pnalloc(r->pool, ctx->saved.len);
|
279
|
+
if (b->pos == NULL) {
|
280
|
+
return NGX_ERROR;
|
281
|
+
}
|
276
282
|
|
277
|
-
|
278
|
-
|
283
|
+
ngx_memcpy(b->pos, ctx->saved.data, ctx->saved.len);
|
284
|
+
b->last = b->pos + ctx->saved.len;
|
285
|
+
b->memory = 1;
|
279
286
|
|
280
|
-
|
281
|
-
|
282
|
-
return NGX_ERROR;
|
283
|
-
}
|
287
|
+
*ctx->last_out = cl;
|
288
|
+
ctx->last_out = &cl->next;
|
284
289
|
|
285
|
-
|
286
|
-
|
287
|
-
b->memory = 1;
|
290
|
+
ctx->saved.len = 0;
|
291
|
+
}
|
288
292
|
|
289
|
-
|
290
|
-
ctx->last_out = &cl->next;
|
293
|
+
if (ctx->copy_start != ctx->copy_end) {
|
291
294
|
|
292
|
-
|
295
|
+
cl = ngx_chain_get_free_buf(r->pool, &ctx->free);
|
296
|
+
if (cl == NULL) {
|
297
|
+
return NGX_ERROR;
|
293
298
|
}
|
294
299
|
|
295
|
-
|
296
|
-
cl = ctx->free;
|
297
|
-
ctx->free = ctx->free->next;
|
298
|
-
b = cl->buf;
|
299
|
-
|
300
|
-
} else {
|
301
|
-
b = ngx_alloc_buf(r->pool);
|
302
|
-
if (b == NULL) {
|
303
|
-
return NGX_ERROR;
|
304
|
-
}
|
305
|
-
|
306
|
-
cl = ngx_alloc_chain_link(r->pool);
|
307
|
-
if (cl == NULL) {
|
308
|
-
return NGX_ERROR;
|
309
|
-
}
|
310
|
-
|
311
|
-
cl->buf = b;
|
312
|
-
}
|
300
|
+
b = cl->buf;
|
313
301
|
|
314
302
|
ngx_memcpy(b, ctx->buf, sizeof(ngx_buf_t));
|
315
303
|
|
@@ -324,7 +312,6 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
324
312
|
b->file_pos += b->pos - ctx->buf->pos;
|
325
313
|
}
|
326
314
|
|
327
|
-
cl->next = NULL;
|
328
315
|
*ctx->last_out = cl;
|
329
316
|
ctx->last_out = &cl->next;
|
330
317
|
}
|
@@ -338,6 +325,11 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
338
325
|
ctx->copy_end = NULL;
|
339
326
|
}
|
340
327
|
|
328
|
+
if (ctx->looked.len > (size_t) (ctx->pos - ctx->buf->pos)) {
|
329
|
+
ctx->saved.len = ctx->looked.len - (ctx->pos - ctx->buf->pos);
|
330
|
+
ngx_memcpy(ctx->saved.data, ctx->looked.data, ctx->saved.len);
|
331
|
+
}
|
332
|
+
|
341
333
|
if (rc == NGX_AGAIN) {
|
342
334
|
continue;
|
343
335
|
}
|
@@ -345,16 +337,15 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
345
337
|
|
346
338
|
/* rc == NGX_OK */
|
347
339
|
|
348
|
-
|
349
|
-
if (b == NULL) {
|
350
|
-
return NGX_ERROR;
|
351
|
-
}
|
352
|
-
|
353
|
-
cl = ngx_alloc_chain_link(r->pool);
|
340
|
+
cl = ngx_chain_get_free_buf(r->pool, &ctx->free);
|
354
341
|
if (cl == NULL) {
|
355
342
|
return NGX_ERROR;
|
356
343
|
}
|
357
344
|
|
345
|
+
b = cl->buf;
|
346
|
+
|
347
|
+
ngx_memzero(b, sizeof(ngx_buf_t));
|
348
|
+
|
358
349
|
slcf = ngx_http_get_module_loc_conf(r, ngx_http_sub_filter_module);
|
359
350
|
|
360
351
|
if (ctx->sub.data == NULL) {
|
@@ -375,8 +366,6 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
375
366
|
b->sync = 1;
|
376
367
|
}
|
377
368
|
|
378
|
-
cl->buf = b;
|
379
|
-
cl->next = NULL;
|
380
369
|
*ctx->last_out = cl;
|
381
370
|
ctx->last_out = &cl->next;
|
382
371
|
|
@@ -385,36 +374,47 @@ ngx_http_sub_body_filter(ngx_http_request_t *r, ngx_chain_t *in)
|
|
385
374
|
continue;
|
386
375
|
}
|
387
376
|
|
388
|
-
if (ctx->buf->last_buf
|
377
|
+
if (ctx->buf->last_buf && ctx->looked.len) {
|
378
|
+
cl = ngx_chain_get_free_buf(r->pool, &ctx->free);
|
379
|
+
if (cl == NULL) {
|
380
|
+
return NGX_ERROR;
|
381
|
+
}
|
382
|
+
|
383
|
+
b = cl->buf;
|
384
|
+
|
385
|
+
ngx_memzero(b, sizeof(ngx_buf_t));
|
386
|
+
|
387
|
+
b->pos = ctx->looked.data;
|
388
|
+
b->last = b->pos + ctx->looked.len;
|
389
|
+
b->memory = 1;
|
390
|
+
|
391
|
+
*ctx->last_out = cl;
|
392
|
+
ctx->last_out = &cl->next;
|
393
|
+
|
394
|
+
ctx->looked.len = 0;
|
395
|
+
}
|
396
|
+
|
397
|
+
if (ctx->buf->last_buf || ctx->buf->flush
|
398
|
+
|| ngx_buf_in_memory(ctx->buf))
|
399
|
+
{
|
389
400
|
if (b == NULL) {
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
b = cl->buf;
|
394
|
-
ngx_memzero(b, sizeof(ngx_buf_t));
|
395
|
-
|
396
|
-
} else {
|
397
|
-
b = ngx_calloc_buf(r->pool);
|
398
|
-
if (b == NULL) {
|
399
|
-
return NGX_ERROR;
|
400
|
-
}
|
401
|
-
|
402
|
-
cl = ngx_alloc_chain_link(r->pool);
|
403
|
-
if (cl == NULL) {
|
404
|
-
return NGX_ERROR;
|
405
|
-
}
|
406
|
-
|
407
|
-
cl->buf = b;
|
401
|
+
cl = ngx_chain_get_free_buf(r->pool, &ctx->free);
|
402
|
+
if (cl == NULL) {
|
403
|
+
return NGX_ERROR;
|
408
404
|
}
|
409
405
|
|
406
|
+
b = cl->buf;
|
407
|
+
|
408
|
+
ngx_memzero(b, sizeof(ngx_buf_t));
|
409
|
+
|
410
410
|
b->sync = 1;
|
411
411
|
|
412
|
-
cl->next = NULL;
|
413
412
|
*ctx->last_out = cl;
|
414
413
|
ctx->last_out = &cl->next;
|
415
414
|
}
|
416
415
|
|
417
416
|
b->last_buf = ctx->buf->last_buf;
|
417
|
+
b->flush = ctx->buf->flush;
|
418
418
|
b->shadow = ctx->buf;
|
419
419
|
|
420
420
|
b->recycled = ctx->buf->recycled;
|
@@ -507,7 +507,7 @@ static ngx_int_t
|
|
507
507
|
ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
|
508
508
|
{
|
509
509
|
u_char *p, *last, *copy_end, ch, match;
|
510
|
-
size_t looked;
|
510
|
+
size_t looked, i;
|
511
511
|
ngx_http_sub_state_e state;
|
512
512
|
|
513
513
|
if (ctx->once) {
|
@@ -578,13 +578,11 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
|
|
578
578
|
looked++;
|
579
579
|
|
580
580
|
if (looked == ctx->match.len) {
|
581
|
-
if ((size_t) (p - ctx->pos) < looked) {
|
582
|
-
ctx->saved.len = 0;
|
583
|
-
}
|
584
581
|
|
585
582
|
ctx->state = sub_start_state;
|
586
583
|
ctx->pos = p + 1;
|
587
584
|
ctx->looked.len = 0;
|
585
|
+
ctx->saved.len = 0;
|
588
586
|
ctx->copy_end = copy_end;
|
589
587
|
|
590
588
|
if (ctx->copy_start == NULL && copy_end) {
|
@@ -594,18 +592,53 @@ ngx_http_sub_parse(ngx_http_request_t *r, ngx_http_sub_ctx_t *ctx)
|
|
594
592
|
return NGX_OK;
|
595
593
|
}
|
596
594
|
|
597
|
-
} else if (ch == ctx->match.data[0]) {
|
598
|
-
copy_end = p;
|
599
|
-
ctx->looked.data[0] = *p;
|
600
|
-
looked = 1;
|
601
|
-
|
602
595
|
} else {
|
603
|
-
|
604
|
-
|
605
|
-
|
596
|
+
/*
|
597
|
+
* check if there is another partial match in previously
|
598
|
+
* matched substring to catch cases like "aab" in "aaab"
|
599
|
+
*/
|
600
|
+
|
601
|
+
ctx->looked.data[looked] = *p;
|
602
|
+
looked++;
|
603
|
+
|
604
|
+
for (i = 1; i < looked; i++) {
|
605
|
+
if (ngx_strncasecmp(ctx->looked.data + i,
|
606
|
+
ctx->match.data, looked - i)
|
607
|
+
== 0)
|
608
|
+
{
|
609
|
+
break;
|
610
|
+
}
|
611
|
+
}
|
612
|
+
|
613
|
+
if (i < looked) {
|
614
|
+
if (ctx->saved.len > i) {
|
615
|
+
ctx->saved.len = i;
|
616
|
+
}
|
617
|
+
|
618
|
+
if ((size_t) (p + 1 - ctx->buf->pos) >= looked - i) {
|
619
|
+
copy_end = p + 1 - (looked - i);
|
620
|
+
}
|
621
|
+
|
622
|
+
ngx_memmove(ctx->looked.data, ctx->looked.data + i, looked - i);
|
623
|
+
looked = looked - i;
|
624
|
+
|
625
|
+
} else {
|
626
|
+
copy_end = p;
|
627
|
+
looked = 0;
|
628
|
+
state = sub_start_state;
|
629
|
+
}
|
630
|
+
|
631
|
+
if (ctx->saved.len) {
|
632
|
+
p++;
|
633
|
+
goto out;
|
634
|
+
}
|
606
635
|
}
|
607
636
|
}
|
608
637
|
|
638
|
+
ctx->saved.len = 0;
|
639
|
+
|
640
|
+
out:
|
641
|
+
|
609
642
|
ctx->state = state;
|
610
643
|
ctx->pos = p;
|
611
644
|
ctx->looked.len = looked;
|
@@ -666,14 +699,12 @@ ngx_http_sub_create_conf(ngx_conf_t *cf)
|
|
666
699
|
* set by ngx_pcalloc():
|
667
700
|
*
|
668
701
|
* conf->match = { 0, NULL };
|
669
|
-
* conf->sub = { 0, NULL };
|
670
|
-
* conf->sub_lengths = NULL;
|
671
|
-
* conf->sub_values = NULL;
|
672
702
|
* conf->types = { NULL };
|
673
703
|
* conf->types_keys = NULL;
|
674
704
|
*/
|
675
705
|
|
676
706
|
slcf->once = NGX_CONF_UNSET;
|
707
|
+
slcf->last_modified = NGX_CONF_UNSET;
|
677
708
|
|
678
709
|
return slcf;
|
679
710
|
}
|
@@ -687,6 +718,7 @@ ngx_http_sub_merge_conf(ngx_conf_t *cf, void *parent, void *child)
|
|
687
718
|
|
688
719
|
ngx_conf_merge_value(conf->once, prev->once, 1);
|
689
720
|
ngx_conf_merge_str_value(conf->match, prev->match, "");
|
721
|
+
ngx_conf_merge_value(conf->last_modified, prev->last_modified, 0);
|
690
722
|
|
691
723
|
if (conf->value.value.data == NULL) {
|
692
724
|
conf->value = prev->value;
|
@@ -174,7 +174,7 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
|
|
174
174
|
|
175
175
|
for ( ;; ) {
|
176
176
|
|
177
|
-
for (i = 0; i < iphp->addrlen; i++) {
|
177
|
+
for (i = 0; i < (ngx_uint_t) iphp->addrlen; i++) {
|
178
178
|
hash = (hash * 113 + iphp->addr[i]) % 6271;
|
179
179
|
}
|
180
180
|
|
@@ -197,33 +197,39 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
|
|
197
197
|
n = p / (8 * sizeof(uintptr_t));
|
198
198
|
m = (uintptr_t) 1 << p % (8 * sizeof(uintptr_t));
|
199
199
|
|
200
|
-
if (
|
200
|
+
if (iphp->rrp.tried[n] & m) {
|
201
|
+
goto next;
|
202
|
+
}
|
201
203
|
|
202
|
-
|
203
|
-
|
204
|
+
ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,
|
205
|
+
"get ip hash peer, hash: %ui %04XA", p, m);
|
204
206
|
|
205
|
-
|
207
|
+
peer = &iphp->rrp.peers->peer[p];
|
206
208
|
|
207
|
-
|
209
|
+
/* ngx_lock_mutex(iphp->rrp.peers->mutex); */
|
208
210
|
|
209
|
-
|
211
|
+
if (peer->down) {
|
212
|
+
goto next_try;
|
213
|
+
}
|
210
214
|
|
211
|
-
|
212
|
-
|
213
|
-
|
215
|
+
if (peer->max_fails
|
216
|
+
&& peer->fails >= peer->max_fails
|
217
|
+
&& now - peer->checked <= peer->fail_timeout)
|
218
|
+
{
|
219
|
+
goto next_try;
|
220
|
+
}
|
214
221
|
|
215
|
-
|
216
|
-
peer->checked = now;
|
217
|
-
break;
|
218
|
-
}
|
219
|
-
}
|
222
|
+
break;
|
220
223
|
|
221
|
-
|
224
|
+
next_try:
|
222
225
|
|
223
|
-
|
226
|
+
iphp->rrp.tried[n] |= m;
|
224
227
|
|
225
|
-
|
226
|
-
|
228
|
+
/* ngx_unlock_mutex(iphp->rrp.peers->mutex); */
|
229
|
+
|
230
|
+
pc->tries--;
|
231
|
+
|
232
|
+
next:
|
227
233
|
|
228
234
|
if (++iphp->tries >= 20) {
|
229
235
|
return iphp->get_rr_peer(pc, &iphp->rrp);
|
@@ -236,6 +242,10 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
|
|
236
242
|
pc->socklen = peer->socklen;
|
237
243
|
pc->name = &peer->name;
|
238
244
|
|
245
|
+
if (now - peer->checked > peer->fail_timeout) {
|
246
|
+
peer->checked = now;
|
247
|
+
}
|
248
|
+
|
239
249
|
/* ngx_unlock_mutex(iphp->rrp.peers->mutex); */
|
240
250
|
|
241
251
|
iphp->rrp.tried[n] |= m;
|
@@ -81,7 +81,7 @@ static ngx_command_t ngx_http_upstream_keepalive_commands[] = {
|
|
81
81
|
{ ngx_string("keepalive"),
|
82
82
|
NGX_HTTP_UPS_CONF|NGX_CONF_TAKE12,
|
83
83
|
ngx_http_upstream_keepalive,
|
84
|
-
|
84
|
+
NGX_HTTP_SRV_CONF_OFFSET,
|
85
85
|
0,
|
86
86
|
NULL },
|
87
87
|
|
@@ -481,7 +481,7 @@ static char *
|
|
481
481
|
ngx_http_upstream_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
482
482
|
{
|
483
483
|
ngx_http_upstream_srv_conf_t *uscf;
|
484
|
-
ngx_http_upstream_keepalive_srv_conf_t *kcf;
|
484
|
+
ngx_http_upstream_keepalive_srv_conf_t *kcf = conf;
|
485
485
|
|
486
486
|
ngx_int_t n;
|
487
487
|
ngx_str_t *value;
|
@@ -489,9 +489,6 @@ ngx_http_upstream_keepalive(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
|
|
489
489
|
|
490
490
|
uscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_module);
|
491
491
|
|
492
|
-
kcf = ngx_http_conf_upstream_srv_conf(uscf,
|
493
|
-
ngx_http_upstream_keepalive_module);
|
494
|
-
|
495
492
|
if (kcf->original_init_upstream) {
|
496
493
|
return "is duplicate";
|
497
494
|
}
|