nginxtra 1.2.7.8 → 1.2.8.8

Sign up to get free protection for your applications and to get access to all the features.
data/bin/nginxtra CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "rubygems"
3
- gem "nginxtra", "= 1.2.7.8"
3
+ gem "nginxtra", "= 1.2.8.8"
4
4
  gem "thor", "~> 0.16.0"
5
5
  require "nginxtra"
6
6
  Nginxtra::CLI.start
data/bin/nginxtra_rails CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require "rubygems"
3
- gem "nginxtra", "= 1.2.7.8"
3
+ gem "nginxtra", "= 1.2.8.8"
4
4
  gem "thor", "~> 0.16.0"
5
5
  require "nginxtra"
6
6
  Nginxtra::Rails::CLI.start
@@ -6,7 +6,7 @@ module Nginxtra
6
6
  end
7
7
 
8
8
  def to_s
9
- "1.2.7.8"
9
+ "1.2.8.8"
10
10
  end
11
11
  end
12
12
  end
data/vendor/nginx/CHANGES CHANGED
@@ -1,4 +1,21 @@
1
1
 
2
+ Changes with nginx 1.2.8 02 Apr 2013
3
+
4
+ *) Bugfix: new sessions were not always stored if the "ssl_session_cache
5
+ shared" directive was used and there was no free space in shared
6
+ memory.
7
+ Thanks to Piotr Sikora.
8
+
9
+ *) Bugfix: responses might hang if subrequests were used and a DNS error
10
+ happened during subrequest processing.
11
+ Thanks to Lanshun Zhou.
12
+
13
+ *) Bugfix: in the ngx_http_mp4_module.
14
+ Thanks to Gernot Vormayr.
15
+
16
+ *) Bugfix: in backend usage accounting.
17
+
18
+
2
19
  Changes with nginx 1.2.7 12 Feb 2013
3
20
 
4
21
  *) Change: now if the "include" directive with mask is used on Unix
@@ -1,4 +1,21 @@
1
1
 
2
+ Изменения в nginx 1.2.8 02.04.2013
3
+
4
+ *) Исправление: при использовании директивы "ssl_session_cache shared"
5
+ новые сессии могли не сохраняться, если заканчивалось место в
6
+ разделяемой памяти.
7
+ Спасибо Piotr Sikora.
8
+
9
+ *) Исправление: ответы могли зависать, если использовались подзапросы и
10
+ при обработке подзапроса происходила DNS-ошибка.
11
+ Спасибо Lanshun Zhou.
12
+
13
+ *) Исправление: в модуле ngx_http_mp4_module.
14
+ Спасибо Gernot Vormayr.
15
+
16
+ *) Исправление: в процедуре учёта использования бэкендов.
17
+
18
+
2
19
  Изменения в nginx 1.2.7 12.02.2013
3
20
 
4
21
  *) Изменение: теперь при использовании директивы include с маской на
@@ -6,11 +6,12 @@
6
6
  cat << END >> $NGX_MAKEFILE
7
7
 
8
8
  $NGX_OBJS/src/http/modules/perl/blib/arch/auto/nginx/nginx.so: \
9
+ \$(CORE_DEPS) \$(HTTP_DEPS) \
9
10
  src/http/modules/perl/nginx.pm \
10
11
  src/http/modules/perl/nginx.xs \
11
12
  src/http/modules/perl/ngx_http_perl_module.h \
12
13
  $NGX_OBJS/src/http/modules/perl/Makefile
13
- cp -p src/http/modules/perl/nginx.* $NGX_OBJS/src/http/modules/perl/
14
+ cp src/http/modules/perl/nginx.* $NGX_OBJS/src/http/modules/perl/
14
15
 
15
16
  cd $NGX_OBJS/src/http/modules/perl && \$(MAKE)
16
17
 
@@ -594,6 +594,10 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
594
594
  var = ngx_alloc(sizeof(NGINX_VAR)
595
595
  + cycle->listening.nelts * (NGX_INT32_LEN + 1) + 2,
596
596
  cycle->log);
597
+ if (var == NULL) {
598
+ ngx_free(env);
599
+ return NGX_INVALID_PID;
600
+ }
597
601
 
598
602
  p = ngx_cpymem(var, NGINX_VAR "=", sizeof(NGINX_VAR));
599
603
 
@@ -633,7 +637,7 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
633
637
 
634
638
  ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
635
639
 
636
- if (ngx_rename_file(ccf->pid.data, ccf->oldpid.data) != NGX_OK) {
640
+ if (ngx_rename_file(ccf->pid.data, ccf->oldpid.data) == NGX_FILE_ERROR) {
637
641
  ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
638
642
  ngx_rename_file_n " %s to %s failed "
639
643
  "before executing new binary process \"%s\"",
@@ -648,7 +652,9 @@ ngx_exec_new_binary(ngx_cycle_t *cycle, char *const *argv)
648
652
  pid = ngx_execute(cycle, &ctx);
649
653
 
650
654
  if (pid == NGX_INVALID_PID) {
651
- if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data) != NGX_OK) {
655
+ if (ngx_rename_file(ccf->oldpid.data, ccf->pid.data)
656
+ == NGX_FILE_ERROR)
657
+ {
652
658
  ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
653
659
  ngx_rename_file_n " %s back to %s failed after "
654
660
  "an attempt to execute new binary process \"%s\"",
@@ -9,8 +9,8 @@
9
9
  #define _NGINX_H_INCLUDED_
10
10
 
11
11
 
12
- #define nginx_version 1002007
13
- #define NGINX_VERSION "1.2.7"
12
+ #define nginx_version 1002008
13
+ #define NGINX_VERSION "1.2.8"
14
14
  #define NGINX_VER "nginx/" NGINX_VERSION
15
15
 
16
16
  #define NGINX_VAR "NGINX"
@@ -133,7 +133,7 @@ ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
133
133
 
134
134
  cf->conf_file = &conf_file;
135
135
 
136
- if (ngx_fd_info(fd, &cf->conf_file->file.info) == -1) {
136
+ if (ngx_fd_info(fd, &cf->conf_file->file.info) == NGX_FILE_ERROR) {
137
137
  ngx_log_error(NGX_LOG_EMERG, cf->log, ngx_errno,
138
138
  ngx_fd_info_n " \"%s\" failed", filename->data);
139
139
  }
@@ -412,7 +412,7 @@ ngx_open_listening_sockets(ngx_cycle_t *cycle)
412
412
  }
413
413
 
414
414
  if (ngx_test_config) {
415
- if (ngx_delete_file(name) == -1) {
415
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
416
416
  ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
417
417
  ngx_delete_file_n " %s failed", name);
418
418
  }
@@ -739,7 +739,7 @@ ngx_close_listening_sockets(ngx_cycle_t *cycle)
739
739
  {
740
740
  u_char *name = ls[i].addr_text.data + sizeof("unix:") - 1;
741
741
 
742
- if (ngx_delete_file(name) == -1) {
742
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
743
743
  ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
744
744
  ngx_delete_file_n " %s failed", name);
745
745
  }
@@ -679,7 +679,7 @@ old_shm_zone_done:
679
679
  ngx_log_error(NGX_LOG_WARN, cycle->log, 0,
680
680
  "deleting socket %s", name);
681
681
 
682
- if (ngx_delete_file(name) == -1) {
682
+ if (ngx_delete_file(name) == NGX_FILE_ERROR) {
683
683
  ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_socket_errno,
684
684
  ngx_delete_file_n " %s failed", name);
685
685
  }
@@ -1716,8 +1716,18 @@ ngx_ssl_new_session(ngx_ssl_conn_t *ssl_conn, ngx_ssl_session_t *sess)
1716
1716
  }
1717
1717
 
1718
1718
  sess_id = ngx_slab_alloc_locked(shpool, sizeof(ngx_ssl_sess_id_t));
1719
+
1719
1720
  if (sess_id == NULL) {
1720
- goto failed;
1721
+
1722
+ /* drop the oldest non-expired session and try once more */
1723
+
1724
+ ngx_ssl_expire_sessions(cache, shpool, 0);
1725
+
1726
+ sess_id = ngx_slab_alloc_locked(shpool, sizeof(ngx_ssl_sess_id_t));
1727
+
1728
+ if (sess_id == NULL) {
1729
+ goto failed;
1730
+ }
1721
1731
  }
1722
1732
 
1723
1733
  #if (NGX_PTR_SIZE == 8)
@@ -1727,8 +1737,18 @@ ngx_ssl_new_session(ngx_ssl_conn_t *ssl_conn, ngx_ssl_session_t *sess)
1727
1737
  #else
1728
1738
 
1729
1739
  id = ngx_slab_alloc_locked(shpool, sess->session_id_length);
1740
+
1730
1741
  if (id == NULL) {
1731
- goto failed;
1742
+
1743
+ /* drop the oldest non-expired session and try once more */
1744
+
1745
+ ngx_ssl_expire_sessions(cache, shpool, 0);
1746
+
1747
+ id = ngx_slab_alloc_locked(shpool, sess->session_id_length);
1748
+
1749
+ if (id == NULL) {
1750
+ goto failed;
1751
+ }
1732
1752
  }
1733
1753
 
1734
1754
  #endif
@@ -489,8 +489,11 @@ ngx_http_autoindex_handler(ngx_http_request_t *r)
489
489
  }
490
490
 
491
491
  b->last = ngx_cpymem(b->last, "</a>", sizeof("</a>") - 1);
492
- ngx_memset(b->last, ' ', NGX_HTTP_AUTOINDEX_NAME_LEN - len);
493
- b->last += NGX_HTTP_AUTOINDEX_NAME_LEN - len;
492
+
493
+ if (NGX_HTTP_AUTOINDEX_NAME_LEN - len > 0) {
494
+ ngx_memset(b->last, ' ', NGX_HTTP_AUTOINDEX_NAME_LEN - len);
495
+ b->last += NGX_HTTP_AUTOINDEX_NAME_LEN - len;
496
+ }
494
497
  }
495
498
 
496
499
  *b->last++ = ' ';
@@ -85,12 +85,12 @@ ngx_module_t ngx_http_index_module = {
85
85
 
86
86
  /*
87
87
  * Try to open/test the first index file before the test of directory
88
- * existence because valid requests should be much more than invalid ones.
89
- * If the file open()/stat() would fail, then the directory stat() should
90
- * be more quickly because some data is already cached in the kernel.
88
+ * existence because valid requests should prevail over invalid ones.
89
+ * If open()/stat() of a file will fail then stat() of a directory
90
+ * should be faster because kernel may have already cached some data.
91
91
  * Besides, Win32 may return ERROR_PATH_NOT_FOUND (NGX_ENOTDIR) at once.
92
- * Unix has ENOTDIR error, however, it's less helpful than Win32's one:
93
- * it only indicates that path contains an usual file in place of directory.
92
+ * Unix has ENOTDIR error; however, it's less helpful than Win32's one:
93
+ * it only indicates that path points to a regular file, not a directory.
94
94
  */
95
95
 
96
96
  static ngx_int_t
@@ -750,6 +750,13 @@ ngx_http_mp4_process(ngx_http_mp4_file_t *mp4)
750
750
 
751
751
  *prev = &mp4->mdat_atom;
752
752
 
753
+ if (start_offset > mp4->mdat_data.buf->file_last) {
754
+ ngx_log_error(NGX_LOG_ERR, mp4->file.log, 0,
755
+ "start time is out mp4 mdat atom in \"%s\"",
756
+ mp4->file.name.data);
757
+ return NGX_ERROR;
758
+ }
759
+
753
760
  adjustment = mp4->ftyp_size + mp4->moov_size
754
761
  + ngx_http_mp4_update_mdat_atom(mp4, start_offset)
755
762
  - start_offset;
@@ -218,7 +218,7 @@ ngx_http_split_clients(ngx_conf_t *cf, ngx_command_t *dummy, void *conf)
218
218
  part->percent = 0;
219
219
 
220
220
  } else {
221
- if (value[0].data[value[0].len - 1] != '%') {
221
+ if (value[0].len == 0 || value[0].data[value[0].len - 1] != '%') {
222
222
  goto invalid;
223
223
  }
224
224
 
@@ -593,7 +593,6 @@ ngx_http_ssl_session_cache(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
593
593
 
594
594
  for (j = sizeof("shared:") - 1; j < value[i].len; j++) {
595
595
  if (value[i].data[j] == ':') {
596
- value[i].data[j] = '\0';
597
596
  break;
598
597
  }
599
598
 
@@ -37,8 +37,6 @@ typedef struct {
37
37
  ngx_event_save_peer_session_pt original_save_session;
38
38
  #endif
39
39
 
40
- ngx_uint_t failed; /* unsigned:1 */
41
-
42
40
  } ngx_http_upstream_keepalive_peer_data_t;
43
41
 
44
42
 
@@ -220,8 +218,6 @@ ngx_http_upstream_get_keepalive_peer(ngx_peer_connection_t *pc, void *data)
220
218
  ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0,
221
219
  "get keepalive peer");
222
220
 
223
- kp->failed = 0;
224
-
225
221
  /* ask balancer */
226
222
 
227
223
  rc = kp->original_get_peer(pc, kp->data);
@@ -282,18 +278,12 @@ ngx_http_upstream_free_keepalive_peer(ngx_peer_connection_t *pc, void *data,
282
278
  ngx_log_debug0(NGX_LOG_DEBUG_HTTP, pc->log, 0,
283
279
  "free keepalive peer");
284
280
 
285
- /* remember failed state - peer.free() may be called more than once */
286
-
287
- if (state & NGX_PEER_FAILED) {
288
- kp->failed = 1;
289
- }
290
-
291
281
  /* cache valid connections */
292
282
 
293
283
  u = kp->upstream;
294
284
  c = pc->connection;
295
285
 
296
- if (kp->failed
286
+ if (state & NGX_PEER_FAILED
297
287
  || c == NULL
298
288
  || c->read->eof
299
289
  || c->read->error
@@ -353,10 +353,6 @@ ngx_http_upstream_free_least_conn_peer(ngx_peer_connection_t *pc,
353
353
  return;
354
354
  }
355
355
 
356
- if (state == 0 && pc->tries == 0) {
357
- return;
358
- }
359
-
360
356
  lcp->conns[lcp->rrp.current]--;
361
357
 
362
358
  lcp->free_rr_peer(pc, &lcp->rrp, state);
@@ -50,7 +50,7 @@ our @EXPORT = qw(
50
50
  HTTP_INSUFFICIENT_STORAGE
51
51
  );
52
52
 
53
- our $VERSION = '1.2.7';
53
+ our $VERSION = '1.2.8';
54
54
 
55
55
  require XSLoader;
56
56
  XSLoader::load('nginx', $VERSION);
@@ -94,7 +94,6 @@ void ngx_http_split_args(ngx_http_request_t *r, ngx_str_t *uri,
94
94
  ngx_str_t *args);
95
95
 
96
96
 
97
- ngx_int_t ngx_http_find_server_conf(ngx_http_request_t *r);
98
97
  void ngx_http_update_location_config(ngx_http_request_t *r);
99
98
  void ngx_http_handler(ngx_http_request_t *r);
100
99
  void ngx_http_run_posted_requests(ngx_connection_t *c);
@@ -1674,8 +1674,6 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
1674
1674
  p = (u_char *) ngx_strchr(name.data, ':');
1675
1675
 
1676
1676
  if (p) {
1677
- *p = '\0';
1678
-
1679
1677
  name.len = p - name.data;
1680
1678
 
1681
1679
  p++;
@@ -2743,6 +2743,7 @@ ngx_http_keepalive_handler(ngx_event_t *rev)
2743
2743
  if (n == NGX_AGAIN) {
2744
2744
  if (ngx_handle_read_event(rev, 0) != NGX_OK) {
2745
2745
  ngx_http_close_connection(c);
2746
+ return;
2746
2747
  }
2747
2748
 
2748
2749
  /*
@@ -865,11 +865,13 @@ ngx_http_upstream_cache_send(ngx_http_request_t *r, ngx_http_upstream_t *u)
865
865
  static void
866
866
  ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
867
867
  {
868
+ ngx_connection_t *c;
868
869
  ngx_http_request_t *r;
869
870
  ngx_http_upstream_t *u;
870
871
  ngx_http_upstream_resolved_t *ur;
871
872
 
872
873
  r = ctx->data;
874
+ c = r->connection;
873
875
 
874
876
  u = r->upstream;
875
877
  ur = u->resolved;
@@ -881,7 +883,7 @@ ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
881
883
  ngx_resolver_strerror(ctx->state));
882
884
 
883
885
  ngx_http_upstream_finalize_request(r, u, NGX_HTTP_BAD_GATEWAY);
884
- return;
886
+ goto failed;
885
887
  }
886
888
 
887
889
  ur->naddrs = ctx->naddrs;
@@ -906,13 +908,17 @@ ngx_http_upstream_resolve_handler(ngx_resolver_ctx_t *ctx)
906
908
  if (ngx_http_upstream_create_round_robin_peer(r, ur) != NGX_OK) {
907
909
  ngx_http_upstream_finalize_request(r, u,
908
910
  NGX_HTTP_INTERNAL_SERVER_ERROR);
909
- return;
911
+ goto failed;
910
912
  }
911
913
 
912
914
  ngx_resolve_name_done(ctx);
913
915
  ur->ctx = NULL;
914
916
 
915
917
  ngx_http_upstream_connect(r, u);
918
+
919
+ failed:
920
+
921
+ ngx_http_run_posted_requests(c);
916
922
  }
917
923
 
918
924
 
@@ -2840,14 +2846,16 @@ ngx_http_upstream_next(ngx_http_request_t *r, ngx_http_upstream_t *u,
2840
2846
  ngx_http_busy_unlock(u->conf->busy_lock, &u->busy_lock);
2841
2847
  #endif
2842
2848
 
2843
- if (ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_404) {
2844
- state = NGX_PEER_NEXT;
2845
- } else {
2846
- state = NGX_PEER_FAILED;
2847
- }
2849
+ if (u->peer.sockaddr) {
2850
+
2851
+ if (ft_type == NGX_HTTP_UPSTREAM_FT_HTTP_404) {
2852
+ state = NGX_PEER_NEXT;
2853
+ } else {
2854
+ state = NGX_PEER_FAILED;
2855
+ }
2848
2856
 
2849
- if (ft_type != NGX_HTTP_UPSTREAM_FT_NOLIVE) {
2850
2857
  u->peer.free(&u->peer, u->peer.data, state);
2858
+ u->peer.sockaddr = NULL;
2851
2859
  }
2852
2860
 
2853
2861
  if (ft_type == NGX_HTTP_UPSTREAM_FT_TIMEOUT) {
@@ -3007,8 +3015,9 @@ ngx_http_upstream_finalize_request(ngx_http_request_t *r,
3007
3015
 
3008
3016
  u->finalize_request(r, rc);
3009
3017
 
3010
- if (u->peer.free) {
3018
+ if (u->peer.free && u->peer.sockaddr) {
3011
3019
  u->peer.free(&u->peer, u->peer.data, 0);
3020
+ u->peer.sockaddr = NULL;
3012
3021
  }
3013
3022
 
3014
3023
  if (u->peer.connection) {
@@ -584,10 +584,6 @@ ngx_http_upstream_free_round_robin_peer(ngx_peer_connection_t *pc, void *data,
584
584
  ngx_log_debug2(NGX_LOG_DEBUG_HTTP, pc->log, 0,
585
585
  "free rr peer %ui %ui", pc->tries, state);
586
586
 
587
- if (state == 0 && pc->tries == 0) {
588
- return;
589
- }
590
-
591
587
  /* TODO: NGX_PEER_KEEPALIVE */
592
588
 
593
589
  if (rrp->peers->single) {
@@ -57,9 +57,6 @@ ngx_int_t ngx_http_variable_unknown_header(ngx_http_variable_value_t *v,
57
57
  ngx_str_t *var, ngx_list_part_t *part, size_t prefix);
58
58
 
59
59
 
60
- #define ngx_http_clear_variable(r, index) r->variables0[index].text.data = NULL;
61
-
62
-
63
60
  #if (NGX_PCRE)
64
61
 
65
62
  typedef struct {
@@ -647,7 +647,7 @@ ngx_reap_children(ngx_cycle_t *cycle)
647
647
 
648
648
  if (ngx_rename_file((char *) ccf->oldpid.data,
649
649
  (char *) ccf->pid.data)
650
- != NGX_OK)
650
+ == NGX_FILE_ERROR)
651
651
  {
652
652
  ngx_log_error(NGX_LOG_ALERT, cycle->log, ngx_errno,
653
653
  ngx_rename_file_n " %s back to %s failed "
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nginxtra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.7.8
4
+ version: 1.2.8.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-12 00:00:00.000000000 Z
12
+ date: 2013-04-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor