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.
Files changed (169) hide show
  1. checksums.yaml +4 -4
  2. data/bin/nginxtra +1 -1
  3. data/bin/nginxtra_rails +1 -1
  4. data/lib/nginxtra/version.rb +1 -1
  5. data/vendor/nginx/CHANGES +286 -19
  6. data/vendor/nginx/CHANGES.ru +296 -22
  7. data/vendor/nginx/auto/cc/clang +4 -3
  8. data/vendor/nginx/auto/cc/conf +23 -0
  9. data/vendor/nginx/auto/cc/msvc +1 -0
  10. data/vendor/nginx/auto/cc/name +1 -1
  11. data/vendor/nginx/auto/cc/owc +4 -4
  12. data/vendor/nginx/auto/cc/sunc +1 -1
  13. data/vendor/nginx/auto/endianness +2 -2
  14. data/vendor/nginx/auto/feature +1 -1
  15. data/vendor/nginx/auto/include +1 -1
  16. data/vendor/nginx/auto/lib/libatomic/make +3 -1
  17. data/vendor/nginx/auto/lib/openssl/conf +4 -0
  18. data/vendor/nginx/auto/lib/openssl/make +1 -1
  19. data/vendor/nginx/auto/lib/pcre/conf +5 -0
  20. data/vendor/nginx/auto/lib/pcre/make +11 -11
  21. data/vendor/nginx/auto/lib/pcre/makefile.bcc +4 -3
  22. data/vendor/nginx/auto/lib/pcre/makefile.msvc +2 -1
  23. data/vendor/nginx/auto/lib/pcre/makefile.owc +2 -1
  24. data/vendor/nginx/auto/lib/perl/make +1 -0
  25. data/vendor/nginx/auto/lib/test +1 -1
  26. data/vendor/nginx/auto/lib/zlib/make +22 -1
  27. data/vendor/nginx/auto/modules +8 -0
  28. data/vendor/nginx/auto/options +3 -0
  29. data/vendor/nginx/auto/os/darwin +1 -1
  30. data/vendor/nginx/auto/os/linux +32 -0
  31. data/vendor/nginx/auto/os/win32 +12 -1
  32. data/vendor/nginx/auto/sources +8 -2
  33. data/vendor/nginx/auto/types/sizeof +1 -1
  34. data/vendor/nginx/auto/types/typedef +1 -1
  35. data/vendor/nginx/auto/types/uintptr_t +1 -1
  36. data/vendor/nginx/auto/unix +13 -1
  37. data/vendor/nginx/conf/mime.types +11 -2
  38. data/vendor/nginx/conf/nginx.conf +3 -4
  39. data/vendor/nginx/contrib/README +6 -0
  40. data/vendor/nginx/contrib/vim/ftdetect/nginx.vim +4 -0
  41. data/vendor/nginx/contrib/vim/indent/nginx.vim +11 -0
  42. data/vendor/nginx/contrib/vim/syntax/nginx.vim +703 -0
  43. data/vendor/nginx/src/core/nginx.c +2 -7
  44. data/vendor/nginx/src/core/nginx.h +2 -2
  45. data/vendor/nginx/src/core/ngx_conf_file.c +8 -88
  46. data/vendor/nginx/src/core/ngx_conf_file.h +3 -3
  47. data/vendor/nginx/src/core/ngx_config.h +2 -2
  48. data/vendor/nginx/src/core/ngx_connection.c +100 -29
  49. data/vendor/nginx/src/core/ngx_connection.h +11 -0
  50. data/vendor/nginx/src/core/ngx_core.h +1 -0
  51. data/vendor/nginx/src/core/ngx_cycle.c +23 -99
  52. data/vendor/nginx/src/core/ngx_cycle.h +2 -0
  53. data/vendor/nginx/src/core/ngx_file.c +100 -8
  54. data/vendor/nginx/src/core/ngx_file.h +3 -0
  55. data/vendor/nginx/src/core/ngx_hash.c +6 -9
  56. data/vendor/nginx/src/core/ngx_inet.c +93 -5
  57. data/vendor/nginx/src/core/ngx_inet.h +4 -2
  58. data/vendor/nginx/src/core/ngx_list.c +1 -9
  59. data/vendor/nginx/src/core/ngx_log.c +132 -30
  60. data/vendor/nginx/src/core/ngx_log.h +5 -2
  61. data/vendor/nginx/src/core/ngx_open_file_cache.c +67 -1
  62. data/vendor/nginx/src/core/ngx_palloc.c +5 -2
  63. data/vendor/nginx/src/core/ngx_proxy_protocol.c +91 -0
  64. data/vendor/nginx/src/core/ngx_proxy_protocol.h +23 -0
  65. data/vendor/nginx/src/core/ngx_resolver.c +1080 -285
  66. data/vendor/nginx/src/core/ngx_resolver.h +33 -3
  67. data/vendor/nginx/src/core/ngx_slab.c +7 -2
  68. data/vendor/nginx/src/core/ngx_slab.h +2 -0
  69. data/vendor/nginx/src/core/ngx_string.c +78 -13
  70. data/vendor/nginx/src/core/ngx_string.h +2 -0
  71. data/vendor/nginx/src/event/modules/ngx_devpoll_module.c +2 -2
  72. data/vendor/nginx/src/event/modules/ngx_epoll_module.c +13 -5
  73. data/vendor/nginx/src/event/modules/ngx_select_module.c +1 -1
  74. data/vendor/nginx/src/event/modules/ngx_win32_select_module.c +2 -2
  75. data/vendor/nginx/src/event/ngx_event.c +0 -1
  76. data/vendor/nginx/src/event/ngx_event.h +7 -6
  77. data/vendor/nginx/src/event/ngx_event_accept.c +6 -4
  78. data/vendor/nginx/src/event/ngx_event_connect.c +2 -2
  79. data/vendor/nginx/src/event/ngx_event_openssl.c +304 -13
  80. data/vendor/nginx/src/event/ngx_event_openssl.h +20 -1
  81. data/vendor/nginx/src/event/ngx_event_openssl_stapling.c +35 -23
  82. data/vendor/nginx/src/event/ngx_event_pipe.c +15 -30
  83. data/vendor/nginx/src/http/modules/ngx_http_access_module.c +115 -35
  84. data/vendor/nginx/src/http/modules/ngx_http_auth_basic_module.c +1 -1
  85. data/vendor/nginx/src/http/modules/ngx_http_auth_request_module.c +444 -0
  86. data/vendor/nginx/src/http/modules/ngx_http_autoindex_module.c +2 -1
  87. data/vendor/nginx/src/http/modules/ngx_http_charset_filter_module.c +1 -1
  88. data/vendor/nginx/src/http/modules/ngx_http_dav_module.c +1 -3
  89. data/vendor/nginx/src/http/modules/ngx_http_fastcgi_module.c +251 -36
  90. data/vendor/nginx/src/http/modules/ngx_http_gunzip_filter_module.c +9 -5
  91. data/vendor/nginx/src/http/modules/ngx_http_gzip_filter_module.c +5 -3
  92. data/vendor/nginx/src/http/modules/ngx_http_gzip_static_module.c +1 -1
  93. data/vendor/nginx/src/http/modules/ngx_http_headers_filter_module.c +4 -0
  94. data/vendor/nginx/src/http/modules/ngx_http_image_filter_module.c +8 -2
  95. data/vendor/nginx/src/http/modules/ngx_http_limit_req_module.c +5 -1
  96. data/vendor/nginx/src/http/modules/ngx_http_map_module.c +3 -3
  97. data/vendor/nginx/src/http/modules/ngx_http_memcached_module.c +21 -10
  98. data/vendor/nginx/src/http/modules/ngx_http_mp4_module.c +669 -197
  99. data/vendor/nginx/src/http/modules/ngx_http_proxy_module.c +93 -60
  100. data/vendor/nginx/src/http/modules/ngx_http_range_filter_module.c +13 -6
  101. data/vendor/nginx/src/http/modules/ngx_http_realip_module.c +20 -1
  102. data/vendor/nginx/src/http/modules/ngx_http_referer_module.c +132 -74
  103. data/vendor/nginx/src/http/modules/ngx_http_scgi_module.c +18 -12
  104. data/vendor/nginx/src/http/modules/ngx_http_ssi_filter_module.c +22 -20
  105. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.c +121 -3
  106. data/vendor/nginx/src/http/modules/ngx_http_ssl_module.h +5 -0
  107. data/vendor/nginx/src/http/modules/ngx_http_stub_status_module.c +3 -0
  108. data/vendor/nginx/src/http/modules/ngx_http_sub_filter_module.c +123 -91
  109. data/vendor/nginx/src/http/modules/ngx_http_upstream_ip_hash_module.c +29 -19
  110. data/vendor/nginx/src/http/modules/ngx_http_upstream_keepalive_module.c +2 -5
  111. data/vendor/nginx/src/http/modules/ngx_http_uwsgi_module.c +215 -19
  112. data/vendor/nginx/src/http/modules/ngx_http_xslt_filter_module.c +32 -6
  113. data/vendor/nginx/src/http/modules/perl/nginx.xs +4 -7
  114. data/vendor/nginx/src/http/modules/perl/ngx_http_perl_module.c +2 -2
  115. data/vendor/nginx/src/http/ngx_http.c +17 -7
  116. data/vendor/nginx/src/http/ngx_http_cache.h +4 -2
  117. data/vendor/nginx/src/http/ngx_http_copy_filter_module.c +4 -2
  118. data/vendor/nginx/src/http/ngx_http_core_module.c +63 -50
  119. data/vendor/nginx/src/http/ngx_http_core_module.h +5 -0
  120. data/vendor/nginx/src/http/ngx_http_file_cache.c +115 -3
  121. data/vendor/nginx/src/http/ngx_http_header_filter_module.c +9 -6
  122. data/vendor/nginx/src/http/ngx_http_parse.c +88 -10
  123. data/vendor/nginx/src/http/ngx_http_postpone_filter_module.c +2 -4
  124. data/vendor/nginx/src/http/ngx_http_request.c +116 -8
  125. data/vendor/nginx/src/http/ngx_http_request.h +5 -1
  126. data/vendor/nginx/src/http/ngx_http_request_body.c +7 -7
  127. data/vendor/nginx/src/http/ngx_http_script.c +6 -5
  128. data/vendor/nginx/src/http/ngx_http_spdy.c +889 -271
  129. data/vendor/nginx/src/http/ngx_http_spdy.h +51 -28
  130. data/vendor/nginx/src/http/ngx_http_spdy_filter_module.c +382 -167
  131. data/vendor/nginx/src/http/ngx_http_spdy_module.c +65 -8
  132. data/vendor/nginx/src/http/ngx_http_spdy_module.h +5 -0
  133. data/vendor/nginx/src/http/ngx_http_special_response.c +1 -1
  134. data/vendor/nginx/src/http/ngx_http_upstream.c +290 -114
  135. data/vendor/nginx/src/http/ngx_http_upstream.h +9 -5
  136. data/vendor/nginx/src/http/ngx_http_upstream_round_robin.c +32 -24
  137. data/vendor/nginx/src/http/ngx_http_variables.c +40 -6
  138. data/vendor/nginx/src/http/ngx_http_write_filter_module.c +12 -5
  139. data/vendor/nginx/src/mail/ngx_mail.c +4 -2
  140. data/vendor/nginx/src/mail/ngx_mail.h +2 -0
  141. data/vendor/nginx/src/mail/ngx_mail_auth_http_module.c +0 -1
  142. data/vendor/nginx/src/mail/ngx_mail_core_module.c +2 -1
  143. data/vendor/nginx/src/mail/ngx_mail_handler.c +17 -4
  144. data/vendor/nginx/src/mail/ngx_mail_parse.c +32 -2
  145. data/vendor/nginx/src/mail/ngx_mail_proxy_module.c +54 -7
  146. data/vendor/nginx/src/mail/ngx_mail_smtp_handler.c +50 -78
  147. data/vendor/nginx/src/mail/ngx_mail_ssl_module.c +48 -11
  148. data/vendor/nginx/src/mail/ngx_mail_ssl_module.h +3 -0
  149. data/vendor/nginx/src/os/unix/ngx_channel.c +3 -1
  150. data/vendor/nginx/src/os/unix/ngx_darwin_config.h +1 -0
  151. data/vendor/nginx/src/os/unix/ngx_darwin_init.c +1 -1
  152. data/vendor/nginx/src/os/unix/ngx_darwin_sendfile_chain.c +14 -16
  153. data/vendor/nginx/src/os/unix/ngx_errno.h +3 -0
  154. data/vendor/nginx/src/os/unix/ngx_files.h +10 -16
  155. data/vendor/nginx/src/os/unix/ngx_freebsd_config.h +6 -0
  156. data/vendor/nginx/src/os/unix/ngx_freebsd_init.c +1 -1
  157. data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.c +1 -1
  158. data/vendor/nginx/src/os/unix/ngx_freebsd_rfork_thread.h +2 -2
  159. data/vendor/nginx/src/os/unix/ngx_freebsd_sendfile_chain.c +17 -19
  160. data/vendor/nginx/src/os/unix/ngx_linux_config.h +8 -2
  161. data/vendor/nginx/src/os/unix/ngx_linux_sendfile_chain.c +20 -22
  162. data/vendor/nginx/src/os/unix/ngx_posix_config.h +1 -0
  163. data/vendor/nginx/src/os/unix/ngx_process.c +5 -0
  164. data/vendor/nginx/src/os/unix/ngx_process_cycle.c +15 -3
  165. data/vendor/nginx/src/os/unix/ngx_readv_chain.c +2 -1
  166. data/vendor/nginx/src/os/unix/ngx_recv.c +4 -1
  167. data/vendor/nginx/src/os/unix/ngx_solaris_config.h +1 -0
  168. data/vendor/nginx/src/os/unix/ngx_solaris_sendfilev_chain.c +14 -16
  169. metadata +8 -2
@@ -34,6 +34,12 @@ typedef struct {
34
34
 
35
35
  ngx_uint_t modifier1;
36
36
  ngx_uint_t modifier2;
37
+
38
+ #if (NGX_HTTP_SSL)
39
+ ngx_uint_t ssl;
40
+ ngx_uint_t ssl_protocols;
41
+ ngx_str_t ssl_ciphers;
42
+ #endif
37
43
  } ngx_http_uwsgi_loc_conf_t;
38
44
 
39
45
 
@@ -66,6 +72,11 @@ static char *ngx_http_uwsgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd,
66
72
  void *conf);
67
73
  #endif
68
74
 
75
+ #if (NGX_HTTP_SSL)
76
+ static ngx_int_t ngx_http_uwsgi_set_ssl(ngx_conf_t *cf,
77
+ ngx_http_uwsgi_loc_conf_t *uwcf);
78
+ #endif
79
+
69
80
 
70
81
  static ngx_conf_num_bounds_t ngx_http_uwsgi_modifier_bounds = {
71
82
  ngx_conf_check_num_bounds, 0, 255
@@ -78,6 +89,7 @@ static ngx_conf_bitmask_t ngx_http_uwsgi_next_upstream_masks[] = {
78
89
  { ngx_string("invalid_header"), NGX_HTTP_UPSTREAM_FT_INVALID_HEADER },
79
90
  { ngx_string("http_500"), NGX_HTTP_UPSTREAM_FT_HTTP_500 },
80
91
  { ngx_string("http_503"), NGX_HTTP_UPSTREAM_FT_HTTP_503 },
92
+ { ngx_string("http_403"), NGX_HTTP_UPSTREAM_FT_HTTP_403 },
81
93
  { ngx_string("http_404"), NGX_HTTP_UPSTREAM_FT_HTTP_404 },
82
94
  { ngx_string("updating"), NGX_HTTP_UPSTREAM_FT_UPDATING },
83
95
  { ngx_string("off"), NGX_HTTP_UPSTREAM_FT_OFF },
@@ -85,6 +97,20 @@ static ngx_conf_bitmask_t ngx_http_uwsgi_next_upstream_masks[] = {
85
97
  };
86
98
 
87
99
 
100
+ #if (NGX_HTTP_SSL)
101
+
102
+ static ngx_conf_bitmask_t ngx_http_uwsgi_ssl_protocols[] = {
103
+ { ngx_string("SSLv2"), NGX_SSL_SSLv2 },
104
+ { ngx_string("SSLv3"), NGX_SSL_SSLv3 },
105
+ { ngx_string("TLSv1"), NGX_SSL_TLSv1 },
106
+ { ngx_string("TLSv1.1"), NGX_SSL_TLSv1_1 },
107
+ { ngx_string("TLSv1.2"), NGX_SSL_TLSv1_2 },
108
+ { ngx_null_string, 0 }
109
+ };
110
+
111
+ #endif
112
+
113
+
88
114
  ngx_module_t ngx_http_uwsgi_module;
89
115
 
90
116
 
@@ -288,6 +314,13 @@ static ngx_command_t ngx_http_uwsgi_commands[] = {
288
314
  offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_lock_timeout),
289
315
  NULL },
290
316
 
317
+ { ngx_string("uwsgi_cache_revalidate"),
318
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
319
+ ngx_conf_set_flag_slot,
320
+ NGX_HTTP_LOC_CONF_OFFSET,
321
+ offsetof(ngx_http_uwsgi_loc_conf_t, upstream.cache_revalidate),
322
+ NULL },
323
+
291
324
  #endif
292
325
 
293
326
  { ngx_string("uwsgi_temp_path"),
@@ -353,6 +386,31 @@ static ngx_command_t ngx_http_uwsgi_commands[] = {
353
386
  offsetof(ngx_http_uwsgi_loc_conf_t, upstream.ignore_headers),
354
387
  &ngx_http_upstream_ignore_headers_masks },
355
388
 
389
+ #if (NGX_HTTP_SSL)
390
+
391
+ { ngx_string("uwsgi_ssl_session_reuse"),
392
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
393
+ ngx_conf_set_flag_slot,
394
+ NGX_HTTP_LOC_CONF_OFFSET,
395
+ offsetof(ngx_http_uwsgi_loc_conf_t, upstream.ssl_session_reuse),
396
+ NULL },
397
+
398
+ { ngx_string("uwsgi_ssl_protocols"),
399
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_1MORE,
400
+ ngx_conf_set_bitmask_slot,
401
+ NGX_HTTP_LOC_CONF_OFFSET,
402
+ offsetof(ngx_http_uwsgi_loc_conf_t, ssl_protocols),
403
+ &ngx_http_uwsgi_ssl_protocols },
404
+
405
+ { ngx_string("uwsgi_ssl_ciphers"),
406
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1,
407
+ ngx_conf_set_str_slot,
408
+ NGX_HTTP_LOC_CONF_OFFSET,
409
+ offsetof(ngx_http_uwsgi_loc_conf_t, ssl_ciphers),
410
+ NULL },
411
+
412
+ #endif
413
+
356
414
  ngx_null_command
357
415
  };
358
416
 
@@ -401,7 +459,8 @@ static ngx_str_t ngx_http_uwsgi_hide_headers[] = {
401
459
  #if (NGX_HTTP_CACHE)
402
460
 
403
461
  static ngx_keyval_t ngx_http_uwsgi_cache_headers[] = {
404
- { ngx_string("HTTP_IF_MODIFIED_SINCE"), ngx_string("") },
462
+ { ngx_string("HTTP_IF_MODIFIED_SINCE"),
463
+ ngx_string("$upstream_cache_last_modified") },
405
464
  { ngx_string("HTTP_IF_UNMODIFIED_SINCE"), ngx_string("") },
406
465
  { ngx_string("HTTP_IF_NONE_MATCH"), ngx_string("") },
407
466
  { ngx_string("HTTP_IF_MATCH"), ngx_string("") },
@@ -426,13 +485,6 @@ ngx_http_uwsgi_handler(ngx_http_request_t *r)
426
485
  ngx_http_upstream_t *u;
427
486
  ngx_http_uwsgi_loc_conf_t *uwcf;
428
487
 
429
- if (r->subrequest_in_memory) {
430
- ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
431
- "ngx_http_uwsgi_module does not support "
432
- "subrequests in memory");
433
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
434
- }
435
-
436
488
  if (ngx_http_upstream_create(r) != NGX_OK) {
437
489
  return NGX_HTTP_INTERNAL_SERVER_ERROR;
438
490
  }
@@ -446,15 +498,29 @@ ngx_http_uwsgi_handler(ngx_http_request_t *r)
446
498
 
447
499
  uwcf = ngx_http_get_module_loc_conf(r, ngx_http_uwsgi_module);
448
500
 
449
- if (uwcf->uwsgi_lengths) {
501
+ u = r->upstream;
502
+
503
+ if (uwcf->uwsgi_lengths == NULL) {
504
+
505
+ #if (NGX_HTTP_SSL)
506
+ u->ssl = (uwcf->upstream.ssl != NULL);
507
+
508
+ if (u->ssl) {
509
+ ngx_str_set(&u->schema, "suwsgi://");
510
+
511
+ } else {
512
+ ngx_str_set(&u->schema, "uwsgi://");
513
+ }
514
+ #else
515
+ ngx_str_set(&u->schema, "uwsgi://");
516
+ #endif
517
+
518
+ } else {
450
519
  if (ngx_http_uwsgi_eval(r, uwcf) != NGX_OK) {
451
520
  return NGX_HTTP_INTERNAL_SERVER_ERROR;
452
521
  }
453
522
  }
454
523
 
455
- u = r->upstream;
456
-
457
- ngx_str_set(&u->schema, "uwsgi://");
458
524
  u->output.tag = (ngx_buf_tag_t) &ngx_http_uwsgi_module;
459
525
 
460
526
  u->conf = &uwcf->upstream;
@@ -492,6 +558,7 @@ ngx_http_uwsgi_handler(ngx_http_request_t *r)
492
558
  static ngx_int_t
493
559
  ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf)
494
560
  {
561
+ size_t add;
495
562
  ngx_url_t url;
496
563
  ngx_http_upstream_t *u;
497
564
 
@@ -504,6 +571,41 @@ ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf)
504
571
  return NGX_ERROR;
505
572
  }
506
573
 
574
+ if (url.url.len > 8
575
+ && ngx_strncasecmp(url.url.data, (u_char *) "uwsgi://", 8) == 0)
576
+ {
577
+ add = 8;
578
+
579
+ } else if (url.url.len > 9
580
+ && ngx_strncasecmp(url.url.data, (u_char *) "suwsgi://", 9) == 0)
581
+ {
582
+
583
+ #if (NGX_HTTP_SSL)
584
+ add = 9;
585
+ r->upstream->ssl = 1;
586
+ #else
587
+ ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
588
+ "suwsgi protocol requires SSL support");
589
+ return NGX_ERROR;
590
+ #endif
591
+
592
+ } else {
593
+ add = 0;
594
+ }
595
+
596
+ u = r->upstream;
597
+
598
+ if (add) {
599
+ u->schema.len = add;
600
+ u->schema.data = url.url.data;
601
+
602
+ url.url.data += add;
603
+ url.url.len -= add;
604
+
605
+ } else {
606
+ ngx_str_set(&u->schema, "uwsgi://");
607
+ }
608
+
507
609
  url.no_resolve = 1;
508
610
 
509
611
  if (ngx_parse_url(r->pool, &url) != NGX_OK) {
@@ -515,8 +617,6 @@ ngx_http_uwsgi_eval(ngx_http_request_t *r, ngx_http_uwsgi_loc_conf_t * uwcf)
515
617
  return NGX_ERROR;
516
618
  }
517
619
 
518
- u = r->upstream;
519
-
520
620
  u->resolved = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_resolved_t));
521
621
  if (u->resolved == NULL) {
522
622
  return NGX_ERROR;
@@ -917,7 +1017,7 @@ ngx_http_uwsgi_process_status_line(ngx_http_request_t *r)
917
1017
  return ngx_http_uwsgi_process_header(r);
918
1018
  }
919
1019
 
920
- if (u->state) {
1020
+ if (u->state && u->state->status == 0) {
921
1021
  u->state->status = status->code;
922
1022
  }
923
1023
 
@@ -1045,7 +1145,7 @@ ngx_http_uwsgi_process_header(ngx_http_request_t *r)
1045
1145
  ngx_str_set(&u->headers_in.status_line, "200 OK");
1046
1146
  }
1047
1147
 
1048
- if (u->state) {
1148
+ if (u->state && u->state->status == 0) {
1049
1149
  u->state->status = u->headers_in.status_n;
1050
1150
  }
1051
1151
 
@@ -1136,12 +1236,16 @@ ngx_http_uwsgi_create_loc_conf(ngx_conf_t *cf)
1136
1236
  conf->upstream.cache_valid = NGX_CONF_UNSET_PTR;
1137
1237
  conf->upstream.cache_lock = NGX_CONF_UNSET;
1138
1238
  conf->upstream.cache_lock_timeout = NGX_CONF_UNSET_MSEC;
1239
+ conf->upstream.cache_revalidate = NGX_CONF_UNSET;
1139
1240
  #endif
1140
1241
 
1141
1242
  conf->upstream.hide_headers = NGX_CONF_UNSET_PTR;
1142
1243
  conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
1143
1244
 
1144
1245
  conf->upstream.intercept_errors = NGX_CONF_UNSET;
1246
+ #if (NGX_HTTP_SSL)
1247
+ conf->upstream.ssl_session_reuse = NGX_CONF_UNSET;
1248
+ #endif
1145
1249
 
1146
1250
  /* "uwsgi_cyclic_temp_file" is disabled */
1147
1251
  conf->upstream.cyclic_temp_file = 0;
@@ -1376,6 +1480,9 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
1376
1480
  ngx_conf_merge_msec_value(conf->upstream.cache_lock_timeout,
1377
1481
  prev->upstream.cache_lock_timeout, 5000);
1378
1482
 
1483
+ ngx_conf_merge_value(conf->upstream.cache_revalidate,
1484
+ prev->upstream.cache_revalidate, 0);
1485
+
1379
1486
  #endif
1380
1487
 
1381
1488
  ngx_conf_merge_value(conf->upstream.pass_request_headers,
@@ -1386,6 +1493,27 @@ ngx_http_uwsgi_merge_loc_conf(ngx_conf_t *cf, void *parent, void *child)
1386
1493
  ngx_conf_merge_value(conf->upstream.intercept_errors,
1387
1494
  prev->upstream.intercept_errors, 0);
1388
1495
 
1496
+ #if (NGX_HTTP_SSL)
1497
+ ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
1498
+ prev->upstream.ssl_session_reuse, 1);
1499
+
1500
+ ngx_conf_merge_bitmask_value(conf->ssl_protocols, prev->ssl_protocols,
1501
+ (NGX_CONF_BITMASK_SET|NGX_SSL_SSLv3
1502
+ |NGX_SSL_TLSv1|NGX_SSL_TLSv1_1
1503
+ |NGX_SSL_TLSv1_2));
1504
+
1505
+ ngx_conf_merge_str_value(conf->ssl_ciphers, prev->ssl_ciphers,
1506
+ "DEFAULT");
1507
+
1508
+ if (conf->ssl && ngx_http_uwsgi_set_ssl(cf, conf) != NGX_OK) {
1509
+ return NGX_CONF_ERROR;
1510
+ }
1511
+
1512
+ if (conf->upstream.ssl == NULL) {
1513
+ conf->upstream.ssl = prev->upstream.ssl;
1514
+ }
1515
+ #endif
1516
+
1389
1517
  ngx_conf_merge_str_value(conf->uwsgi_string, prev->uwsgi_string, "");
1390
1518
 
1391
1519
  hash.max_size = 512;
@@ -1542,7 +1670,7 @@ ngx_http_uwsgi_merge_params(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *conf,
1542
1670
 
1543
1671
  s->key = h->key;
1544
1672
  s->value = h->value;
1545
- s->skip_empty = 0;
1673
+ s->skip_empty = 1;
1546
1674
 
1547
1675
  next:
1548
1676
 
@@ -1664,6 +1792,7 @@ ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1664
1792
  {
1665
1793
  ngx_http_uwsgi_loc_conf_t *uwcf = conf;
1666
1794
 
1795
+ size_t add;
1667
1796
  ngx_url_t u;
1668
1797
  ngx_str_t *value, *url;
1669
1798
  ngx_uint_t n;
@@ -1699,12 +1828,35 @@ ngx_http_uwsgi_pass(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1699
1828
  return NGX_CONF_ERROR;
1700
1829
  }
1701
1830
 
1831
+ #if (NGX_HTTP_SSL)
1832
+ uwcf->ssl = 1;
1833
+ #endif
1834
+
1702
1835
  return NGX_CONF_OK;
1703
1836
  }
1704
1837
 
1838
+ if (ngx_strncasecmp(url->data, (u_char *) "uwsgi://", 8) == 0) {
1839
+ add = 8;
1840
+
1841
+ } else if (ngx_strncasecmp(url->data, (u_char *) "suwsgi://", 9) == 0) {
1842
+
1843
+ #if (NGX_HTTP_SSL)
1844
+ add = 9;
1845
+ uwcf->ssl = 1;
1846
+ #else
1847
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
1848
+ "suwsgi protocol requires SSL support");
1849
+ return NGX_CONF_ERROR;
1850
+ #endif
1851
+
1852
+ } else {
1853
+ add = 0;
1854
+ }
1855
+
1705
1856
  ngx_memzero(&u, sizeof(ngx_url_t));
1706
1857
 
1707
- u.url = value[1];
1858
+ u.url.len = url->len - add;
1859
+ u.url.data = url->data + add;
1708
1860
  u.no_resolve = 1;
1709
1861
 
1710
1862
  uwcf->upstream.upstream = ngx_http_upstream_add(cf, &u, 0);
@@ -1764,7 +1916,7 @@ ngx_http_uwsgi_store(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1764
1916
  sc.source = &value[1];
1765
1917
  sc.lengths = &uwcf->upstream.store_lengths;
1766
1918
  sc.values = &uwcf->upstream.store_values;
1767
- sc.variables = ngx_http_script_variables_count(&value[1]);;
1919
+ sc.variables = ngx_http_script_variables_count(&value[1]);
1768
1920
  sc.complete_lengths = 1;
1769
1921
  sc.complete_values = 1;
1770
1922
 
@@ -1838,3 +1990,47 @@ ngx_http_uwsgi_cache_key(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1838
1990
  }
1839
1991
 
1840
1992
  #endif
1993
+
1994
+
1995
+ #if (NGX_HTTP_SSL)
1996
+
1997
+ static ngx_int_t
1998
+ ngx_http_uwsgi_set_ssl(ngx_conf_t *cf, ngx_http_uwsgi_loc_conf_t *uwcf)
1999
+ {
2000
+ ngx_pool_cleanup_t *cln;
2001
+
2002
+ uwcf->upstream.ssl = ngx_pcalloc(cf->pool, sizeof(ngx_ssl_t));
2003
+ if (uwcf->upstream.ssl == NULL) {
2004
+ return NGX_ERROR;
2005
+ }
2006
+
2007
+ uwcf->upstream.ssl->log = cf->log;
2008
+
2009
+ if (ngx_ssl_create(uwcf->upstream.ssl, uwcf->ssl_protocols, NULL)
2010
+ != NGX_OK)
2011
+ {
2012
+ return NGX_ERROR;
2013
+ }
2014
+
2015
+ if (SSL_CTX_set_cipher_list(uwcf->upstream.ssl->ctx,
2016
+ (const char *) uwcf->ssl_ciphers.data)
2017
+ == 0)
2018
+ {
2019
+ ngx_ssl_error(NGX_LOG_EMERG, cf->log, 0,
2020
+ "SSL_CTX_set_cipher_list(\"%V\") failed",
2021
+ &uwcf->ssl_ciphers);
2022
+ return NGX_ERROR;
2023
+ }
2024
+
2025
+ cln = ngx_pool_cleanup_add(cf->pool, 0);
2026
+ if (cln == NULL) {
2027
+ return NGX_ERROR;
2028
+ }
2029
+
2030
+ cln->handler = ngx_ssl_cleanup_ctx;
2031
+ cln->data = uwcf->upstream.ssl;
2032
+
2033
+ return NGX_OK;
2034
+ }
2035
+
2036
+ #endif
@@ -58,6 +58,7 @@ typedef struct {
58
58
  ngx_hash_t types;
59
59
  ngx_array_t *types_keys;
60
60
  ngx_array_t *params; /* ngx_http_xslt_param_t */
61
+ ngx_flag_t last_modified;
61
62
  } ngx_http_xslt_filter_loc_conf_t;
62
63
 
63
64
 
@@ -103,6 +104,7 @@ static void *ngx_http_xslt_filter_create_main_conf(ngx_conf_t *cf);
103
104
  static void *ngx_http_xslt_filter_create_conf(ngx_conf_t *cf);
104
105
  static char *ngx_http_xslt_filter_merge_conf(ngx_conf_t *cf, void *parent,
105
106
  void *child);
107
+ static ngx_int_t ngx_http_xslt_filter_preconfiguration(ngx_conf_t *cf);
106
108
  static ngx_int_t ngx_http_xslt_filter_init(ngx_conf_t *cf);
107
109
  static void ngx_http_xslt_filter_exit(ngx_cycle_t *cycle);
108
110
 
@@ -150,12 +152,19 @@ static ngx_command_t ngx_http_xslt_filter_commands[] = {
150
152
  offsetof(ngx_http_xslt_filter_loc_conf_t, types_keys),
151
153
  &ngx_http_xslt_default_types[0] },
152
154
 
155
+ { ngx_string("xslt_last_modified"),
156
+ NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
157
+ ngx_conf_set_flag_slot,
158
+ NGX_HTTP_LOC_CONF_OFFSET,
159
+ offsetof(ngx_http_xslt_filter_loc_conf_t, last_modified),
160
+ NULL },
161
+
153
162
  ngx_null_command
154
163
  };
155
164
 
156
165
 
157
166
  static ngx_http_module_t ngx_http_xslt_filter_module_ctx = {
158
- NULL, /* preconfiguration */
167
+ ngx_http_xslt_filter_preconfiguration, /* preconfiguration */
159
168
  ngx_http_xslt_filter_init, /* postconfiguration */
160
169
 
161
170
  ngx_http_xslt_filter_create_main_conf, /* create main configuration */
@@ -300,9 +309,10 @@ static ngx_int_t
300
309
  ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
301
310
  ngx_buf_t *b)
302
311
  {
303
- ngx_int_t rc;
304
- ngx_chain_t out;
305
- ngx_pool_cleanup_t *cln;
312
+ ngx_int_t rc;
313
+ ngx_chain_t out;
314
+ ngx_pool_cleanup_t *cln;
315
+ ngx_http_xslt_filter_loc_conf_t *conf;
306
316
 
307
317
  ctx->done = 1;
308
318
 
@@ -327,8 +337,13 @@ ngx_http_xslt_send(ngx_http_request_t *r, ngx_http_xslt_filter_ctx_t *ctx,
327
337
  r->headers_out.content_length = NULL;
328
338
  }
329
339
 
330
- ngx_http_clear_last_modified(r);
331
340
  ngx_http_clear_etag(r);
341
+
342
+ conf = ngx_http_get_module_loc_conf(r, ngx_http_xslt_filter_module);
343
+
344
+ if (!conf->last_modified) {
345
+ ngx_http_clear_last_modified(r);
346
+ }
332
347
  }
333
348
 
334
349
  rc = ngx_http_next_header_filter(r);
@@ -1058,6 +1073,8 @@ ngx_http_xslt_filter_create_conf(ngx_conf_t *cf)
1058
1073
  * conf->params = NULL;
1059
1074
  */
1060
1075
 
1076
+ conf->last_modified = NGX_CONF_UNSET;
1077
+
1061
1078
  return conf;
1062
1079
  }
1063
1080
 
@@ -1088,12 +1105,14 @@ ngx_http_xslt_filter_merge_conf(ngx_conf_t *cf, void *parent, void *child)
1088
1105
  return NGX_CONF_ERROR;
1089
1106
  }
1090
1107
 
1108
+ ngx_conf_merge_value(conf->last_modified, prev->last_modified, 0);
1109
+
1091
1110
  return NGX_CONF_OK;
1092
1111
  }
1093
1112
 
1094
1113
 
1095
1114
  static ngx_int_t
1096
- ngx_http_xslt_filter_init(ngx_conf_t *cf)
1115
+ ngx_http_xslt_filter_preconfiguration(ngx_conf_t *cf)
1097
1116
  {
1098
1117
  xmlInitParser();
1099
1118
 
@@ -1101,6 +1120,13 @@ ngx_http_xslt_filter_init(ngx_conf_t *cf)
1101
1120
  exsltRegisterAll();
1102
1121
  #endif
1103
1122
 
1123
+ return NGX_OK;
1124
+ }
1125
+
1126
+
1127
+ static ngx_int_t
1128
+ ngx_http_xslt_filter_init(ngx_conf_t *cf)
1129
+ {
1104
1130
  ngx_http_next_header_filter = ngx_http_top_header_filter;
1105
1131
  ngx_http_top_header_filter = ngx_http_xslt_header_filter;
1106
1132