[-]
[+]
|
Deleted |
nginx.changes
|
@@ -1,75 +0,0 @@
--------------------------------------------------------------------
-Wed Aug 14 12:08:47 UTC 2019 - Local OBS User <cs@linux-administrator.com>
-
-- security update 1.16.1
-
--------------------------------------------------------------------
-Tue Mar 12 06:58:53 UTC 2019 - Local OBS User <cs@linux-administrator.com>
-
-- update to nginx 1.14.2
-- update openssl to 1.1.1b
-
--------------------------------------------------------------------
-Tue Jun 5 13:27:07 UTC 2018 - cs@linux-administrator.com
-
-- update to nginx 1.14.0
-
--------------------------------------------------------------------
-Tue Jun 5 13:00:11 UTC 2018 - cs@linux-administrator.com
-
-- update to nginx 1.13.12
-- update openssl to 1.1.0h
-
--------------------------------------------------------------------
-Mon Mar 5 06:35:03 UTC 2018 - cs@linux-administrator.com
-
-- downgrade to 1.13.8 because of startup segfault
-
--------------------------------------------------------------------
-Wed Feb 28 06:49:49 UTC 2018 - cs@linux-administrator.com
-
-- update to nginx 1.13.9
-
--------------------------------------------------------------------
-Wed Jan 17 08:34:43 UTC 2018 - cs@linux-administrator.com
-
-- update to nginx 1.13.8
-
--------------------------------------------------------------------
-Tue Dec 12 11:37:50 UTC 2017 - cs@linux-administrator.com
-
-- update to nginx 1.13.7
-
--------------------------------------------------------------------
-Wed Apr 5 10:58:26 UTC 2017 - cs@linux-administrator.com
-
-- update to nginx 1.11.13
-
--------------------------------------------------------------------
-Wed Dec 28 20:00:08 UTC 2016 - cs@linux-administrator.com
-
-- update to nginx 1.11.8
-
--------------------------------------------------------------------
-Wed Dec 14 11:07:19 UTC 2016 - cs@linux-administrator.com
-
-- update to nginx 1.11.7
-
--------------------------------------------------------------------
-Mon Nov 28 07:21:41 UTC 2016 - cs@linux-administrator.com
-
-- update to nginx 1.11.6
-- update nginx rtmp module to 1.1.10
-
--------------------------------------------------------------------
-Wed Oct 12 21:29:31 UTC 2016 - cs@linux-administrator.com
-
-- update to nginx 1.11.5
-
--------------------------------------------------------------------
-Wed Sep 28 18:04:31 UTC 2016 - cs@linux-administrator.com
-
-- update to nginx 1.11.4
-- update openssl to 1.0.2j
-- update nginx rtmp module to 1.1.9
-
|
[-]
[+]
|
Changed |
nginx.spec
^
|
|
[-]
[+]
|
Deleted |
2bc1dac6fb3ed263529decb211ec784824132bf4.patch
^
|
@@ -1,38 +0,0 @@
-From 2bc1dac6fb3ed263529decb211ec784824132bf4 Mon Sep 17 00:00:00 2001
-From: Chris Lea <chris.lea@gmail.com>
-Date: Tue, 15 Nov 2016 22:26:35 -0800
-Subject: [PATCH] default_port was removed in 1.11.6.
-
----
- ngx_http_upstream_fair_module.c | 9 ++++++++-
- 1 file changed, 8 insertions(+), 1 deletion(-)
-
-diff --git a/ngx_http_upstream_fair_module.c b/ngx_http_upstream_fair_module.c
-index a4419ca..66144e9 100644
---- a/ngx_http_upstream_fair_module.c
-+++ b/ngx_http_upstream_fair_module.c
-@@ -540,7 +540,11 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
-
- /* an upstream implicitly defined by proxy_pass, etc. */
-
-+#if nginx_version < 1011006
- if (us->port == 0 && us->default_port == 0) {
-+#else
-+ if (us->port == 0) {
-+#endif
- ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
- "no port in upstream \"%V\" in %s:%ui",
- &us->host, us->file_name, us->line);
-@@ -550,8 +554,11 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
- ngx_memzero(&u, sizeof(ngx_url_t));
-
- u.host = us->host;
-+#if nginx_version < 1011006
- u.port = (in_port_t) (us->port ? us->port : us->default_port);
--
-+#else
-+ u.port = (in_port_t) us->port;
-+#endif
- if (ngx_inet_resolve_host(cf->pool, &u) != NGX_OK) {
- if (u.err) {
- ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
|
[-]
[+]
|
Added |
check_1.2.6+.patch
^
|
@@ -0,0 +1,209 @@
+diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c
+index 89ccc2b..a552044 100644
+--- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
++++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
+@@ -9,6 +9,10 @@
+ #include <ngx_core.h>
+ #include <ngx_http.h>
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
++#endif
++
+
+ typedef struct {
+ /* the round robin data must be first */
+@@ -208,6 +212,12 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
+
+ if (!peer->down) {
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
++ "get ip_hash peer, check_index: %ui",
++ peer->check_index);
++ if (!ngx_http_check_peer_down(peer->check_index)) {
++#endif
+ if (peer->max_fails == 0 || peer->fails < peer->max_fails) {
+ break;
+ }
+@@ -216,6 +226,9 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
+ peer->checked = now;
+ break;
+ }
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ }
++#endif
+ }
+
+ iphp->rrp.tried[n] |= m;
+diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c
+index 21156ae..c57393d 100644
+--- a/src/http/modules/ngx_http_upstream_least_conn_module.c
++++ b/src/http/modules/ngx_http_upstream_least_conn_module.c
+@@ -9,6 +9,10 @@
+ #include <ngx_core.h>
+ #include <ngx_http.h>
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
++#endif
++
+
+ typedef struct {
+ ngx_uint_t *conns;
+@@ -203,6 +207,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
+ continue;
+ }
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
++ "get least_conn peer, check_index: %ui",
++ peer->check_index);
++
++ if (ngx_http_check_peer_down(peer->check_index)) {
++ continue;
++ }
++#endif
++
+ if (peer->max_fails
+ && peer->fails >= peer->max_fails
+ && now - peer->checked <= peer->fail_timeout)
+@@ -256,6 +270,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
+ continue;
+ }
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
++ "get least_conn peer, check_index: %ui",
++ peer->check_index);
++
++ if (ngx_http_check_peer_down(peer->check_index)) {
++ continue;
++ }
++#endif
++
+ if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
+ continue;
+ }
+diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
+index 4b78cff..f077b46 100644
+--- a/src/http/ngx_http_upstream_round_robin.c
++++ b/src/http/ngx_http_upstream_round_robin.c
+@@ -9,6 +9,9 @@
+ #include <ngx_core.h>
+ #include <ngx_http.h>
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
++#endif
+
+ static ngx_int_t ngx_http_upstream_cmp_servers(const void *one,
+ const void *two);
+@@ -87,7 +90,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
+ peers->peer[n].weight = server[i].weight;
+ peers->peer[n].effective_weight = server[i].weight;
+ peers->peer[n].current_weight = 0;
+- n++;
++
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (!server[i].down) {
++ peers->peer[n].check_index =
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
++ }
++ else {
++ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
++ }
++#endif
++ n++;
+ }
+ }
+
+@@ -145,6 +158,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
+ backup->peer[n].max_fails = server[i].max_fails;
+ backup->peer[n].fail_timeout = server[i].fail_timeout;
+ backup->peer[n].down = server[i].down;
++
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (!server[i].down) {
++ backup->peer[n].check_index =
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
++ }
++ else {
++ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
++ }
++#endif
++
+ n++;
+ }
+ }
+@@ -206,6 +230,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
+ peers->peer[i].current_weight = 0;
+ peers->peer[i].max_fails = 1;
+ peers->peer[i].fail_timeout = 10;
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
++#endif
+ }
+
+ us->peer.data = peers;
+@@ -323,6 +350,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
+ peers->peer[0].current_weight = 0;
+ peers->peer[0].max_fails = 1;
+ peers->peer[0].fail_timeout = 10;
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
++#endif
+
+ } else {
+
+@@ -356,6 +386,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
+ peers->peer[i].current_weight = 0;
+ peers->peer[i].max_fails = 1;
+ peers->peer[i].fail_timeout = 10;
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
++#endif
+ }
+ }
+
+@@ -434,6 +467,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
+ goto failed;
+ }
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
++ goto failed;
++ }
++#endif
++
+ } else {
+
+ /* there are several peers */
+@@ -531,6 +570,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp)
+ continue;
+ }
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
++ continue;
++ }
++#endif
++
+ if (peer->max_fails
+ && peer->fails >= peer->max_fails
+ && now - peer->checked <= peer->fail_timeout)
+diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h
+index 3f8cbf8..1613168 100644
+--- a/src/http/ngx_http_upstream_round_robin.h
++++ b/src/http/ngx_http_upstream_round_robin.h
+@@ -30,6 +30,10 @@ typedef struct {
|
[-]
[+]
|
Deleted |
check_1.7.5+.patch
^
|
@@ -1,195 +0,0 @@
-diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c
-index 148d73a..913e395 100644
---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
-+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- typedef struct {
- /* the round robin data must be first */
-@@ -212,6 +215,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
- goto next_try;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get ip_hash peer, check_index: %ui",
-+ peer->check_index);
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ goto next_try;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c
-index 623bc9b..a223839 100644
---- a/src/http/modules/ngx_http_upstream_least_conn_module.c
-+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- typedef struct {
- ngx_uint_t *conns;
-@@ -203,6 +206,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get least_conn peer, check_index: %ui",
-+ peer->check_index);
-+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-@@ -256,6 +269,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get least_conn peer, check_index: %ui",
-+ peer->check_index);
-+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
- continue;
- }
-diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
-index 2d0649b..b9789eb 100644
---- a/src/http/ngx_http_upstream_round_robin.c
-+++ b/src/http/ngx_http_upstream_round_robin.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- #define ngx_http_upstream_tries(p) ((p)->number \
- + ((p)->next ? (p)->next->number : 0))
-@@ -92,6 +95,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[n].fail_timeout = server[i].fail_timeout;
- peer[n].down = server[i].down;
- peer[n].server = server[i].name;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (!server[i].down) {
-+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
-+ } else {
-+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
-+ }
-+#endif
- n++;
- }
- }
-@@ -148,6 +159,15 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[n].fail_timeout = server[i].fail_timeout;
- peer[n].down = server[i].down;
- peer[n].server = server[i].name;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (!server[i].down) {
-+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
-+ }
-+ else {
-+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
-+ }
-+#endif
- n++;
- }
- }
-@@ -207,6 +227,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[i].current_weight = 0;
- peer[i].max_fails = 1;
- peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- }
-
- us->peer.data = peers;
-@@ -316,7 +339,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
- peer[0].current_weight = 0;
- peer[0].max_fails = 1;
- peer[0].fail_timeout = 10;
--
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- } else {
-
- for (i = 0; i < ur->naddrs; i++) {
-@@ -356,6 +381,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
- peer[i].current_weight = 0;
- peer[i].max_fails = 1;
- peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- }
- }
-
-@@ -415,6 +443,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
- goto failed;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ goto failed;
-+ }
-+#endif
-+
- } else {
-
- /* there are several peers */
-@@ -507,6 +541,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h
-index 9db82a6..6e19a65 100644
---- a/src/http/ngx_http_upstream_round_robin.h
-+++ b/src/http/ngx_http_upstream_round_robin.h
-@@ -31,6 +31,10 @@ typedef struct {
- ngx_uint_t max_fails;
- time_t fail_timeout;
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_uint_t check_index;
-+#endif
-+
- ngx_uint_t down; /* unsigned down:1; */
-
- #if (NGX_HTTP_SSL)
|
[-]
[+]
|
Added |
nginx-versiontilt.patch
^
|
@@ -0,0 +1,13 @@
+--- nginx-1.2.0/src/core/nginx.h 2012-04-23 14:54:14.000000000 +0200
++++ nginx-1.2.0/src/core/nginx.h~ 2012-04-25 16:20:55.000000000 +0200
+@@ -10,8 +10,8 @@
+
+
+ #define nginx_version 1002000
+-#define NGINX_VERSION "1.2.0"
+-#define NGINX_VER "nginx/" NGINX_VERSION
++#define NGINX_VERSION ""
++#define NGINX_VER "" NGINX_VERSION
+
+ #define NGINX_VAR "NGINX"
+ #define NGX_OLDPID_EXT ".oldbin"
|
[-]
[+]
|
Deleted |
openssl-rc4tilt.patch
^
|
@@ -1,17 +0,0 @@
-Nur in openssl-1.0.1j-norc4: openssl__disable_rc4.patch.
-diff -ru openssl-1.0.1j/ssl/s3_lib.c openssl-1.0.1j-norc4/ssl/s3_lib.c
---- openssl-1.0.1j/ssl/s3_lib.c 2014-10-15 14:53:39.000000000 +0200
-+++ openssl-1.0.1j-norc4/ssl/s3_lib.c 2014-10-23 18:57:16.468131600 +0200
-@@ -3844,6 +3844,11 @@
- (TLS1_get_version(s) < TLS1_2_VERSION))
- continue;
-
-+ /* Disable RC4 for TLS v1.1+ */
-+ if ((c->algorithm_enc == SSL_RC4) &&
-+ (TLS1_get_version(s) >= TLS1_1_VERSION))
-+ continue;
-+
- ssl_set_cert_masks(cert,c);
- mask_k = cert->mask_k;
- mask_a = cert->mask_a;
-Nur in openssl-1.0.1j-norc4/ssl: s3_lib.c.orig.
|
[-]
[+]
|
Deleted |
openssl__chacha20_poly1305_draft_and_rfc_ossl102g.patch
^
|
@@ -1,5227 +0,0 @@
-From d21c75c622eb13a80080ed15fa30474f806a0a0f Mon Sep 17 00:00:00 2001
-From: Vlad Krasnov <vlad@cloudflare.com>
-Date: Fri, 12 Feb 2016 18:25:11 -0800
-Subject: [PATCH] Implementation of draft and RFC versions of CHACHA20-POLY1305
- ciphers
-
----
- Configure | 48 +-
- Makefile.org | 4 +-
- apps/speed.c | 30 +-
- crypto/chacha20poly1305/Makefile | 97 +++
- crypto/chacha20poly1305/asm/chacha20_avx.pl | 408 +++++++++++
- crypto/chacha20poly1305/asm/chacha20_avx2.pl | 443 ++++++++++++
- crypto/chacha20poly1305/asm/poly1305_avx.pl | 732 ++++++++++++++++++++
- crypto/chacha20poly1305/asm/poly1305_avx2.pl | 984 +++++++++++++++++++++++++++
- crypto/chacha20poly1305/asm/poly1305_x64.pl | 281 ++++++++
- crypto/chacha20poly1305/chacha20.c | 162 +++++
- crypto/chacha20poly1305/chacha20poly1305.h | 79 +++
- crypto/chacha20poly1305/chapolytest.c | 470 +++++++++++++
- crypto/chacha20poly1305/poly1305.c | 287 ++++++++
- crypto/cryptlib.c | 10 -
- crypto/evp/Makefile | 7 +-
- crypto/evp/e_chacha20poly1305.c | 435 ++++++++++++
- crypto/evp/evp.h | 4 +
- ssl/s3_lib.c | 119 ++++
- ssl/ssl.h | 2 +
- ssl/ssl_ciph.c | 60 +-
- ssl/ssl_locl.h | 2 +
- ssl/tls1.h | 28 +
- test/Makefile | 17 +-
- 23 files changed, 4655 insertions(+), 54 deletions(-)
- create mode 100644 crypto/chacha20poly1305/Makefile
- create mode 100644 crypto/chacha20poly1305/asm/chacha20_avx.pl
- create mode 100644 crypto/chacha20poly1305/asm/chacha20_avx2.pl
- create mode 100644 crypto/chacha20poly1305/asm/poly1305_avx.pl
- create mode 100644 crypto/chacha20poly1305/asm/poly1305_avx2.pl
- create mode 100644 crypto/chacha20poly1305/asm/poly1305_x64.pl
- create mode 100644 crypto/chacha20poly1305/chacha20.c
- create mode 100644 crypto/chacha20poly1305/chacha20poly1305.h
- create mode 100644 crypto/chacha20poly1305/chapolytest.c
- create mode 100644 crypto/chacha20poly1305/poly1305.c
- create mode 100644 crypto/evp/e_chacha20poly1305.c
-
-diff --git a/Configure b/Configure
-index 4a715dc..f3ab6cd 100755
---- a/Configure
-+++ b/Configure
-@@ -146,25 +146,25 @@ my $tlib="-lnsl -lsocket";
- my $bits1="THIRTY_TWO_BIT ";
- my $bits2="SIXTY_FOUR_BIT ";
-
--my $x86_asm="x86cpuid.o:bn-586.o co-586.o x86-mont.o x86-gf2m.o::des-586.o crypt586.o:aes-586.o vpaes-x86.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:cmll-x86.o:ghash-x86.o:";
-+my $x86_asm="x86cpuid.o:bn-586.o co-586.o x86-mont.o x86-gf2m.o::des-586.o crypt586.o:aes-586.o vpaes-x86.o aesni-x86.o:bf-586.o:md5-586.o:sha1-586.o sha256-586.o sha512-586.o:cast-586.o:rc4-586.o:rmd-586.o:rc5-586.o:wp_block.o wp-mmx.o:cmll-x86.o:ghash-x86.o::";
-
- my $x86_elf_asm="$x86_asm:elf";
-
--my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o:ecp_nistz256.o ecp_nistz256-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:ghash-x86_64.o aesni-gcm-x86_64.o:";
--my $ia64_asm="ia64cpuid.o:bn-ia64.o ia64-mont.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o:::::ghash-ia64.o::void";
--my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o::des_enc-sparc.o fcrypt_b.o dest4-sparcv9.o:aes_core.o aes_cbc.o aes-sparcv9.o aest4-sparcv9.o::md5-sparcv9.o:sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o::::::camellia.o cmll_misc.o cmll_cbc.o cmllt4-sparcv9.o:ghash-sparcv9.o::void";
--my $sparcv8_asm=":sparcv8.o::des_enc-sparc.o fcrypt_b.o:::::::::::::void";
--my $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::sha1-alpha.o:::::::ghash-alpha.o::void";
--my $mips64_asm=":bn-mips.o mips-mont.o:::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o sha512-mips.o::::::::";
-+my $x86_64_asm="x86_64cpuid.o:x86_64-gcc.o x86_64-mont.o x86_64-mont5.o x86_64-gf2m.o rsaz_exp.o rsaz-x86_64.o rsaz-avx2.o:ecp_nistz256.o ecp_nistz256-x86_64.o::aes-x86_64.o vpaes-x86_64.o bsaes-x86_64.o aesni-x86_64.o aesni-sha1-x86_64.o aesni-sha256-x86_64.o aesni-mb-x86_64.o::md5-x86_64.o:sha1-x86_64.o sha256-x86_64.o sha512-x86_64.o sha1-mb-x86_64.o sha256-mb-x86_64.o::rc4-x86_64.o rc4-md5-x86_64.o:::wp-x86_64.o:cmll-x86_64.o cmll_misc.o:ghash-x86_64.o aesni-gcm-x86_64.o::chacha20_avx.o chacha20_avx2.o poly1305_x64.o poly1305_avx2.o";
-+my $ia64_asm="ia64cpuid.o:bn-ia64.o ia64-mont.o:::aes_core.o aes_cbc.o aes-ia64.o::md5-ia64.o:sha1-ia64.o sha256-ia64.o sha512-ia64.o::rc4-ia64.o rc4_skey.o:::::ghash-ia64.o:::void";
-+my $sparcv9_asm="sparcv9cap.o sparccpuid.o:bn-sparcv9.o sparcv9-mont.o sparcv9a-mont.o vis3-mont.o sparct4-mont.o sparcv9-gf2m.o::des_enc-sparc.o fcrypt_b.o dest4-sparcv9.o:aes_core.o aes_cbc.o aes-sparcv9.o aest4-sparcv9.o::md5-sparcv9.o:sha1-sparcv9.o sha256-sparcv9.o sha512-sparcv9.o::::::camellia.o cmll_misc.o cmll_cbc.o cmllt4-sparcv9.o:ghash-sparcv9.o:::void";
-+my $sparcv8_asm=":sparcv8.o::des_enc-sparc.o fcrypt_b.o::::::::::::::void";
-+my $alpha_asm="alphacpuid.o:bn_asm.o alpha-mont.o::::::sha1-alpha.o:::::::ghash-alpha.o:::void";
-+my $mips64_asm=":bn-mips.o mips-mont.o:::aes_cbc.o aes-mips.o:::sha1-mips.o sha256-mips.o sha512-mips.o:::::::::";
- my $mips32_asm=$mips64_asm; $mips32_asm =~ s/\s*sha512\-mips\.o//;
--my $s390x_asm="s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o s390x-gf2m.o:::aes-s390x.o aes-ctr.o aes-xts.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::ghash-s390x.o:";
--my $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o:::aes_cbc.o aes-armv4.o bsaes-armv7.o aesv8-armx.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o ghashv8-armx.o::void";
--my $aarch64_asm="armcap.o arm64cpuid.o mem_clr.o::::aes_core.o aes_cbc.o aesv8-armx.o:::sha1-armv8.o sha256-armv8.o sha512-armv8.o:::::::ghashv8-armx.o:";
--my $parisc11_asm="pariscid.o:bn_asm.o parisc-mont.o:::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::32";
--my $parisc20_asm="pariscid.o:pa-risc2W.o parisc-mont.o:::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o::64";
--my $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o:::aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o sha256p8-ppc.o sha512p8-ppc.o:::::::ghashp8-ppc.o:";
-+my $s390x_asm="s390xcap.o s390xcpuid.o:bn-s390x.o s390x-mont.o s390x-gf2m.o:::aes-s390x.o aes-ctr.o aes-xts.o:::sha1-s390x.o sha256-s390x.o sha512-s390x.o::rc4-s390x.o:::::ghash-s390x.o::";
-+my $armv4_asm="armcap.o armv4cpuid.o:bn_asm.o armv4-mont.o armv4-gf2m.o:::aes_cbc.o aes-armv4.o bsaes-armv7.o aesv8-armx.o:::sha1-armv4-large.o sha256-armv4.o sha512-armv4.o:::::::ghash-armv4.o ghashv8-armx.o:::void";
-+my $aarch64_asm="armcap.o arm64cpuid.o mem_clr.o::::aes_core.o aes_cbc.o aesv8-armx.o:::sha1-armv8.o sha256-armv8.o sha512-armv8.o:::::::ghashv8-armx.o::";
-+my $parisc11_asm="pariscid.o:bn_asm.o parisc-mont.o:::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o:::32";
-+my $parisc20_asm="pariscid.o:pa-risc2W.o parisc-mont.o:::aes_core.o aes_cbc.o aes-parisc.o:::sha1-parisc.o sha256-parisc.o sha512-parisc.o::rc4-parisc.o:::::ghash-parisc.o:::64";
-+my $ppc64_asm="ppccpuid.o ppccap.o:bn-ppc.o ppc-mont.o ppc64-mont.o:::aes_core.o aes_cbc.o aes-ppc.o vpaes-ppc.o aesp8-ppc.o:::sha1-ppc.o sha256-ppc.o sha512-ppc.o sha256p8-ppc.o sha512p8-ppc.o:::::::ghashp8-ppc.o::";
- my $ppc32_asm=$ppc64_asm;
--my $no_asm="::::::::::::::::void";
-+my $no_asm=":::::::::::::::::void";
-
- # As for $BSDthreads. Idea is to maintain "collective" set of flags,
- # which would cover all BSD flavors. -pthread applies to them all,
-@@ -710,6 +710,7 @@ my $idx_wp_obj = $idx++;
- my $idx_cmll_obj = $idx++;
- my $idx_modes_obj = $idx++;
- my $idx_engines_obj = $idx++;
-+my $idx_chapoly_obj = $idx++;
- my $idx_perlasm_scheme = $idx++;
- my $idx_dso_scheme = $idx++;
- my $idx_shared_target = $idx++;
-@@ -752,6 +753,7 @@ my $bf ="crypto/bf/bf_locl.h";
- my $bn_asm ="bn_asm.o";
- my $des_enc="des_enc.o fcrypt_b.o";
- my $aes_enc="aes_core.o aes_cbc.o";
-+my $chapoly_enc="";
- my $bf_enc ="bf_enc.o";
- my $cast_enc="c_enc.o";
- my $rc4_enc="rc4_enc.o rc4_skey.o";
-@@ -1210,7 +1212,7 @@ $openssldir=$prefix . "/" . $openssldir if $openssldir !~ /(^\/|^[a-zA-Z]:[\\\/]
-
- print "IsMK1MF=$IsMK1MF\n";
-
--my @fields = split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
-+my @fields = split(/\s*:\s*/,$table{$target} . ":" x 31 , -1);
- my $cc = $fields[$idx_cc];
- # Allow environment CC to override compiler...
- if($ENV{CC}) {
-@@ -1239,6 +1241,7 @@ my $wp_obj = $fields[$idx_wp_obj];
- my $cmll_obj = $fields[$idx_cmll_obj];
- my $modes_obj = $fields[$idx_modes_obj];
- my $engines_obj = $fields[$idx_engines_obj];
-+my $chapoly_obj = $fields[$idx_chapoly_obj];
- my $perlasm_scheme = $fields[$idx_perlasm_scheme];
- my $dso_scheme = $fields[$idx_dso_scheme];
- my $shared_target = $fields[$idx_shared_target];
-@@ -1405,7 +1408,7 @@ if ($no_asm)
- {
- $cpuid_obj=$bn_obj=$ec_obj=
- $des_obj=$aes_obj=$bf_obj=$cast_obj=$rc4_obj=$rc5_obj=$cmll_obj=
-- $modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj="";
-+ $modes_obj=$sha1_obj=$md5_obj=$rmd160_obj=$wp_obj=$engines_obj=$chapoly_obj="";
- }
-
- if (!$no_shared)
-@@ -1558,6 +1561,14 @@ $bf_obj=$bf_enc unless ($bf_obj =~ /\.o$/);
- $cast_obj=$cast_enc unless ($cast_obj =~ /\.o$/);
- $rc4_obj=$rc4_enc unless ($rc4_obj =~ /\.o$/);
- $rc5_obj=$rc5_enc unless ($rc5_obj =~ /\.o$/);
-+if ($chapoly_obj =~ /\.o$/)
-+ {
-+ $cflags.=" -DCHAPOLY_x86_64_ASM";
-+ }
-+else
-+ {
-+ $chapoly_obj=$chapoly_enc;
-+ }
- if ($sha1_obj =~ /\.o$/)
- {
- # $sha1_obj=$sha1_enc;
-@@ -1740,6 +1751,7 @@ while (<IN>)
- s/^WP_ASM_OBJ=.*$/WP_ASM_OBJ= $wp_obj/;
- s/^CMLL_ENC=.*$/CMLL_ENC= $cmll_obj/;
- s/^MODES_ASM_OBJ.=*$/MODES_ASM_OBJ= $modes_obj/;
-+ s/^CHAPOLY_ENC=.*$/CHAPOLY_ENC= $chapoly_obj/;
- s/^ENGINES_ASM_OBJ.=*$/ENGINES_ASM_OBJ= $engines_obj/;
- s/^PERLASM_SCHEME=.*$/PERLASM_SCHEME= $perlasm_scheme/;
- s/^PROCESSOR=.*/PROCESSOR= $processor/;
-@@ -1802,6 +1814,7 @@ print "RMD160_OBJ_ASM=$rmd160_obj\n";
- print "CMLL_ENC =$cmll_obj\n";
- print "MODES_OBJ =$modes_obj\n";
- print "ENGINES_OBJ =$engines_obj\n";
-+print "CHAPOLY_ENC =$chapoly_obj\n";
- print "PROCESSOR =$processor\n";
- print "RANLIB =$ranlib\n";
- print "ARFLAGS =$arflags\n";
-@@ -2200,7 +2213,7 @@ sub print_table_entry
- my ($cc, $cflags, $unistd, $thread_cflag, $sys_id, $lflags,
- $bn_ops, $cpuid_obj, $bn_obj, $ec_obj, $des_obj, $aes_obj, $bf_obj,
- $md5_obj, $sha1_obj, $cast_obj, $rc4_obj, $rmd160_obj,
-- $rc5_obj, $wp_obj, $cmll_obj, $modes_obj, $engines_obj,
-+ $rc5_obj, $wp_obj, $cmll_obj, $modes_obj, $engines_obj, $chapoly_obj,
- $perlasm_scheme, $dso_scheme, $shared_target, $shared_cflag,
- $shared_ldflag, $shared_extension, $ranlib, $arflags, $multilib)=
- split(/\s*:\s*/,$table{$target} . ":" x 30 , -1);
-@@ -2231,6 +2244,7 @@ sub print_table_entry
- \$cmll_obj = $cmll_obj
- \$modes_obj = $modes_obj
- \$engines_obj = $engines_obj
-+\$chapoly_obj = $chapoly_obj
- \$perlasm_scheme = $perlasm_scheme
- \$dso_scheme = $dso_scheme
- \$shared_target= $shared_target
-diff --git a/Makefile.org b/Makefile.org
-index 76fdbdf..6556ef6 100644
---- a/Makefile.org
-+++ b/Makefile.org
-@@ -91,6 +91,7 @@ BN_ASM= bn_asm.o
- EC_ASM=
- DES_ENC= des_enc.o fcrypt_b.o
- AES_ENC= aes_core.o aes_cbc.o
-+CHAPOLY_ENC=
- BF_ENC= bf_enc.o
- CAST_ENC= c_enc.o
- RC4_ENC= rc4_enc.o
-@@ -148,7 +149,7 @@ SDIRS= \
- bn ec rsa dsa ecdsa dh ecdh dso engine \
- buffer bio stack lhash rand err \
- evp asn1 pem x509 x509v3 conf txt_db pkcs7 pkcs12 comp ocsp ui krb5 \
-- cms pqueue ts jpake srp store cmac
-+ cms pqueue ts jpake srp store cmac chacha20poly1305
- # keep in mind that the above list is adjusted by ./Configure
- # according to no-xxx arguments...
-
-@@ -234,6 +235,7 @@ BUILDENV= LC_ALL=C PLATFORM='$(PLATFORM)' PROCESSOR='$(PROCESSOR)'\
|
|
Deleted |
1.12.34.2-x64.tar.gz
^
|
[-]
[+]
|
Deleted |
_service
^
|
@@ -1,7 +0,0 @@
-<services>
- <service name="download_url">
- <param name="host">nginx.org</param>
- <param name="protocol">http</param>
- <param name="path">/download/nginx-1.16.1.tar.gz</param>
- </service>
-<service name="download_url"><param name="host">www.openssl.org</param><param name="protocol">https</param><param name="path">/source/openssl-1.1.1b.tar.gz</param></service></services>
|
|
Deleted |
_service:download_url:nginx-1.16.1.tar.gz
^
|
|
Deleted |
_service:download_url:openssl-1.1.1b.tar.gz
^
|
[-]
[+]
|
Deleted |
blockips.conf
^
|
@@ -1,718 +0,0 @@
-### updates are avail. at raw.githubusercontent.com/mariusv/nginx-badbot-blocker/master/blockips.conf
-
-
-deny 178.238.234.1;
-deny 76.90.254.19;
-deny 85.17.26.68; # spammy comments - Leaseweb
-deny 85.17.230.23; # spammy comments - Leaseweb
-deny 173.234.11.105; # junk referrers
-deny 173.234.31.9; # junk referrers - Ubiquityservers
-deny 173.234.38.25; # spammy comments
-deny 173.234.153.30; # junk referrers
-deny 173.234.153.106; # spammy comments - Ubiquityservers
-deny 173.234.175.68; # spammy comments
-deny 190.152.223.27; # junk referrers
-deny 195.191.54.90; # odd behaviour, Mozilla, doesnt fetch js/css. Ended up doing a POST, prob a spambot
-deny 195.229.241.174; # spammy comments - United Arab Emirates
-deny 210.212.194.60; # junk referrers + spammy comments
-deny 76.91.248.49; # bad bot
-deny 1.4.0.0/17;
-deny 1.10.16.0/20;
-deny 1.116.0.0/14;
-deny 5.34.242.0/23;
-deny 5.72.0.0/14;
-deny 5.134.128.0/19;
-deny 14.4.0.0/14;
-deny 14.245.0.0/16;
-deny 23.235.48.0/20;
-deny 27.111.48.0/20;
-deny 27.122.32.0/20;
-deny 27.126.160.0/20;
-deny 31.11.43.0/24;
-deny 31.222.200.0/21;
-deny 36.0.8.0/21;
-deny 36.37.48.0/20;
-deny 37.139.49.0/24;
-deny 37.148.216.0/21;
-deny 37.246.0.0/16;
-deny 41.72.64.0/19;
-deny 42.0.32.0/19;
-deny 42.1.56.0/22;
-deny 42.1.128.0/17;
-deny 42.52.0.0/14;
-deny 42.83.80.0/22;
-deny 42.96.0.0/18;
-deny 42.123.36.0/22;
-deny 42.128.0.0/12;
-deny 42.160.0.0/12;
-deny 42.194.8.0/22;
-deny 42.194.12.0/22;
-deny 42.194.128.0/17;
-deny 43.229.52.0/22;
-deny 43.236.0.0/16;
-deny 43.250.64.0/22;
-deny 43.250.116.0/22;
-deny 43.252.80.0/22;
-deny 43.252.152.0/22;
-deny 43.252.180.0/22;
-deny 43.255.188.0/22;
-deny 45.64.88.0/22;
-deny 45.117.208.0/22;
-deny 45.121.144.0/22;
-deny 46.29.248.0/22;
-deny 46.29.248.0/21;
-deny 46.148.112.0/20;
-deny 46.151.48.0/21;
-deny 46.232.192.0/21;
-deny 46.243.140.0/24;
-deny 46.243.142.0/24;
-deny 49.8.0.0/14;
-deny 49.128.104.0/22;
-deny 58.87.64.0/18;
-deny 59.254.0.0/15;
-deny 60.233.0.0/16;
-deny 61.11.224.0/19;
-deny 61.13.128.0/17;
-deny 61.45.251.0/24;
-deny 62.182.152.0/21;
-deny 64.234.224.0/20;
-deny 66.231.64.0/20;
-deny 67.213.128.0/20;
-deny 67.218.208.0/20;
-deny 72.13.16.0/20;
-deny 78.31.184.0/21;
-deny 78.31.211.0/24;
-deny 79.173.104.0/21;
-deny 80.76.8.0/21;
-deny 81.22.152.0/23;
-deny 83.175.0.0/18;
-deny 85.121.39.0/24;
-deny 86.55.40.0/23;
-deny 86.55.42.0/23;
-deny 88.135.16.0/20;
-deny 91.194.254.0/23;
-deny 91.195.254.0/23;
-deny 91.198.127.0/24;
-deny 91.200.248.0/22;
-deny 91.203.20.0/22;
-deny 91.207.4.0/22;
-deny 91.209.12.0/24;
-deny 91.212.104.0/24;
-deny 91.212.198.0/24;
-deny 91.212.201.0/24;
-deny 91.212.220.0/24;
-deny 91.213.126.0/24;
-deny 91.213.172.0/24;
-deny 91.216.3.0/24;
-deny 91.217.10.0/23;
-deny 91.220.35.0/24;
-deny 91.220.62.0/24;
-deny 91.220.163.0/24;
-deny 91.223.89.0/24;
-deny 91.226.97.0/24;
-deny 91.229.210.0/24;
-deny 91.230.110.0/24;
-deny 91.230.252.0/23;
-deny 91.234.36.0/24;
-deny 91.235.2.0/24;
-deny 91.236.74.0/23;
-deny 91.236.120.0/24;
-deny 91.237.198.0/24;
-deny 91.238.82.0/24;
-deny 91.239.24.0/24;
-deny 91.239.238.0/24;
-deny 91.240.163.0/24;
-deny 91.240.165.0/24;
-deny 91.242.217.0/24;
-deny 91.243.115.0/24;
-deny 93.175.240.0/20;
-deny 94.26.112.0/20;
-deny 94.154.128.0/18;
-deny 95.216.0.0/15;
-deny 101.192.0.0/14;
-deny 101.199.0.0/16;
-deny 101.202.0.0/16;
-deny 101.203.128.0/19;
-deny 101.248.0.0/15;
-deny 101.252.0.0/15;
-deny 103.2.44.0/22;
-deny 103.10.68.0/22;
-deny 103.12.216.0/22;
-deny 103.16.76.0/24;
-deny 103.20.36.0/22;
-deny 103.23.8.0/22;
-deny 103.36.64.0/22;
-deny 103.41.124.0/22;
-deny 103.41.180.0/22;
-deny 103.42.115.0/24;
-deny 103.55.28.0/22;
-deny 103.57.248.0/22;
-deny 103.61.4.0/22;
-deny 103.228.60.0/22;
-deny 103.229.36.0/22;
-deny 103.230.144.0/22;
-deny 103.231.84.0/22;
-deny 103.232.136.0/22;
-deny 103.232.172.0/22;
-deny 103.236.32.0/22;
-deny 103.242.184.0/22;
-deny 104.143.112.0/20;
-deny 104.255.136.0/21;
-deny 106.96.0.0/14;
-deny 108.166.224.0/19;
-deny 109.94.208.0/20;
-deny 110.44.128.0/20;
-deny 110.232.160.0/20;
-deny 113.20.160.0/19;
-deny 114.8.0.0/16;
-deny 115.85.133.0/24;
-deny 116.78.0.0/15;
-deny 116.128.0.0/10;
-deny 116.144.0.0/15;
-deny 116.146.0.0/15;
-deny 117.100.0.0/15;
-deny 118.177.0.0/16;
-deny 118.185.0.0/16;
-deny 119.232.0.0/16;
-deny 120.48.0.0/15;
-deny 120.92.0.0/17;
-deny 120.92.128.0/18;
-deny 120.92.192.0/19;
-deny 120.92.224.0/20;
-deny 121.100.128.0/18;
-deny 122.129.0.0/18;
-deny 122.202.96.0/19;
-deny 123.136.80.0/20;
-deny 124.68.0.0/15;
-deny 124.70.0.0/15;
-deny 124.157.0.0/18;
-deny 124.242.0.0/16;
-deny 124.245.0.0/16;
-deny 125.31.192.0/18;
-deny 125.58.0.0/18;
-deny 125.169.0.0/16;
-deny 128.13.0.0/16;
-deny 128.168.0.0/16;
-deny 128.191.0.0/16;
-deny 129.47.0.0/16;
-deny 129.76.64.0/18;
-deny 130.148.0.0/16;
|
[-]
[+]
|
Deleted |
changelog
^
|
@@ -1,131 +0,0 @@
-* Sun Mar 05 2016 Juergen Gotteswinter <jg@internetx.com> - 1.9.12-1
-- 1.9.12 bump
-- enabled http splice module
-
-* Tue Dec 08 2015 Juergen Gotteswinter <jg@internetx.com> - 1.9.7-1
-- version bump 1.9.7
-- enabled http2
-- enabled thread pool support
-
-* Wed May 12 2015 Juergen Gotteswinter <jg@internetx.com> - 1.9.1-1
-- Version Bump 1.9.1 Codename Putin
-
-* Wed May 12 2015 Juergen Gotteswinter <jg@internetx.com> - 1.9.0-1
-- moved on to the current stable mainline tree 1.9.x
-- enabled stream module (appeared in 1.9.0) - simple tcp proxy feature
-
-* Wed Mar 25 2015 Juergen Gotteswinter <jg@internetx.com> - 1.7.11-1
-- pushed bundled openssl to latest 1.0.2
-- enabled thread pool support (appeared in 1.7.11)
-- updated rtmp module to latest git (previous version does not build with
-- 1.7.11)
-
-* Thu Dec 31 2014 Juergen Gotteswinter <jg@internetx.com> - 1.7.9-2
-- added nginx pagespeed module - rhel/centos 7.x only
-- added nginx pagespeed sample config
-- enabled complete mainline module tree, except mail* support
-
-* Thu Dec 31 2014 Juergen Gotteswinter <jg@internetx.com> - 1.7.9-1
-- bumped to 1.7.9
-- fixed check upstream module + patch
-- 2014 byebye version bump
-
-* Thu Dec 02 2014 Juergen Gotteswinter <jg@internetx.com> - 1.7.8-1
-- bumped to 1.7.8
-
-* Thu Nov 13 2014 Juergen Gotteswinter <jg@internetx.com> - 1.7.7-1
-- bumped to 1.7.7
-
-* Thu Oct 23 2014 Juergen Gotteswinter <jg@internetx.com> - 1.7.6-1
-- added openssl source - nginx got built static against current vanilla
-* openssl
-- enabled additional mainline modules
-- added patch to get rid of rc4
-- bumped to 1.7.6
-
-* Fri Jun 28 2014 Juergen Gotteswinter <jg@internetx.com> - 1.7.3-1
-- bump to 1.7.3
-
-* Fri Apr 26 2014 Juergen Gotteswinter <jg@internetx.com> - 1.6.0-2
-- added nginx-statsd module
-
-* Fri Apr 26 2014 Juergen Gotteswinter <jg@internetx.com> - 1.6.0-1
-- pushed to new stable branch 1.6
-
-* Fri Apr 12 2014 Juergen Gotteswinter <jg@internetx.com> - 1.4.7-2
-- added patch to log heartbleed attacks
-
-* Tue Apr 03 2014 Juergen Gotteswinter <jg@internetx.com> - 1.4.7-1
-- bump to 1.4.7
-
-* Wed Nov 20 2013 Juergen Gotteswinter <jg@internetx.com> - 1.4.4-1
-- https://bugzilla.redhat.com/show_bug.cgi?id=1032266
-
-* Tue Oct 08 2013 Carsten Schoene <cs@linux-administrator.com> - 1.4.3-1
-- update nginx to 1.4.3
-- update rtmp module to 1.0.5
-
-* Sun Aug 04 2013 Carsten Schoene <cs@linux-administrator.com> - 1.4.2-2
-- update rtmp module to 1.0.2
-
-* Wed Jul 17 2013 Carsten Schoene <cs@linux-administrator.com> - 1.4.2-1
-- update nginx to 1.4.2
-
-* Sat Jun 29 2013 Carsten Schoene <cs@linux-administrator.com> - 1.4.1-4
-- update rtmp module to 1.0.1
-
-* Sat May 25 2013 Carsten Schoene <cs@linux-administrator.com> - 1.4.1-3
-- update rtmp module to 0.9.20
-
-* Mon May 13 2013 Carsten Schoene <cs@linux-administrator.com> - 1.4.1-2
-- update rtmp module to 0.9.19
-
-* Fri May 10 2013 Juergen Gotteswinter <jg@internetx.de> - 1.4.1-1
-- version bump to latest stable 1.4.1
-
-* Fri Apr 26 2013 Carsten Schoene <cs@linux-administrator.com> - 1.2.7-2
-- update rtmp module to 0.9.18
-
-* Sun Apr 14 2013 Carsten Schoene <cs@linux-administrator.com> - 1.2.7-4
-- update nginx to 1.2.7
-- update rtmp module to 0.9.14
-
-* Mon Mar 04 2013 Carsten Schoene <cs@linux-administrator.com> - 1.2.7-3
-- update rtmp module to 0.9.11
-
-* Thu Feb 28 2013 Carsten Schoene <cs@linux-administrator.com> - 1.2.7-2
-- update rtmp module to 0.9.8
-
-* Tue Feb 12 2013 Carsten Schoene <cs@linux-administrator.com> - 1.2.7-1
-- update nginx to 1.2.7
-- update rtmp module to 0.9.7
-
-* Fri Jan 25 2013 Carsten Schoene <cs@linux-administrator.com> - 1.2.6-4
-- update rtmp module to 0.9.1
-
-* Wed Jan 16 2013 Carsten Schoene <cs@linux-administrator.com> - 1.2.6-3
-- update rtmp module to 0.9.0
-
-* Sat Jan 12 2013 Carsten Schoene <cs@linux-administrator.com> - 1.2.6-2
-- added rtmp 0.8.7 module
-
-* Tue Dec 11 2012 Carsten Schoene <cs@linux-administrator.com> - 1.2.6-1
-- update to release 1.2.6
-
-* Tue Nov 13 2012 Carsten Schoene <cs@linux-administrator.com> - 1.2.5-1
-- update to release 1.2.5
-
-* Mon Oct 04 2010 Juergen Gotteswinter <jg at internetx.de> 0.8.52-1
-- update to latest stable branch
-
-* Wed Nov 17 2009 Juergen Gotteswinter <jg at internetx.de> 0.7.64-1
-
-- version bump to 0.7.64
-
-
-* Wed Oct 28 2009 Juergen Gotteswinter <jg at internetx.de> 0.7.63-1
-
-- version bump to 0.7.63
-
-* Fri Oct 23 2009 Juergen Gotteswinter <jg at internetx.de> 0.7.62-3
-- included nginx-socket-patch for unix socket support
\ No newline at end of file
|
[-]
[+]
|
Deleted |
magento-sample.conf-disabled
^
|
@@ -1,113 +0,0 @@
-server {
- include /etc/nginx/port.conf;
- server_name example.com;
- return 301 $scheme://www.example.com$request_uri;
-}
-
-server {
- include /etc/nginx/port.conf;
- #listen 443 ssl;
- server_name www.example.com; ## Domain is here
- root /var/www/html;
- access_log /var/log/nginx/access_www.example.com.log main;
-
- if ($http_user_agent = "") { return 444;}
-
- ####################################################################################
- ## SSL CONFIGURATION
-
- #ssl_certificate /etc/ssl/certs/www_server_com.chained.crt;
- #ssl_certificate_key /etc/ssl/certs/server.key;
-
- ####################################################################################
- ## Server maintenance block. insert dev ip 1.2.3.4 static address www.whatismyip.com
-
- #if ($remote_addr !~ "^(1.2.3.4|1.2.3.4)$") {
- #return 503;
- #}
-
- #error_page 503 @maintenance;
- #location @maintenance {
- #rewrite ^(.*)$ /error_page/503.html break;
- #internal;
- #access_log off;
- #log_not_found off;
- #}
-
- ####################################################################################
- ## 403 error log/page
-
- #error_page 403 /403.html;
- #location = /403.html {
- #root /var/www/html/error_page;
- #internal;
- #access_log /var/log/nginx/403.log error403;
- #}
-
- ####################################################################################
- ## Main Magento location
-
- location / {
- try_files $uri $uri/ @handler;
- }
-
- ####################################################################################
- ## These locations would be hidden by .htaccess normally, protected
-
- location ~ (/(app/|includes/|pkginfo/|var/|errors/local.xml)|/\.) {
- deny all;
- }
-
- ####################################################################################
- ## Protecting /admin/ and /downloader/ 1.2.3.4 = static ip (www.whatismyip.com)
-
- #location /downloader/ {
- #allow 1.2.3.4; allow 1.2.3.4; deny all;
- #rewrite ^/downloader/(.*)$ /downloader/index.php$1;
- #}
- #location /admin {
- #allow 1.2.3.4; allow 1.2.3.4; deny all;
- #rewrite / /@handler;
- #}
-
- ####################################################################################
- ## Images, scripts and styles set far future Expires header
-
- location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
- open_file_cache max=10000 inactive=8h;
- open_file_cache_valid 1h;
- open_file_cache_min_uses 2;
- open_file_cache_errors off;
- expires max;
- log_not_found off;
- access_log off;
- }
-
- ####################################################################################
- ## Main Magento location
-
- location @handler {
- rewrite / /index.php?$args;
- }
-
- location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
- rewrite ^(.*.php)/ $1 last;
- }
-
- ####################################################################################
- ## Execute PHP scripts
-
- location ~ .php$ {
- add_header X-UA-Compatible 'IE=Edge,chrome=1';
- add_header X-Time-Spent $request_time;
- try_files $uri $uri/ =404;
- fastcgi_pass 127.0.0.1:9000;
- fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
- ## Store code with multi domain
- #fastcgi_param MAGE_RUN_CODE $storecode;
- ## Default Store code
- fastcgi_param MAGE_RUN_CODE default;
- fastcgi_param MAGE_RUN_TYPE store; ## or website;
- include fastcgi_params; ## See /etc/nginx/fastcgi_params
- }
- }
|
|
Deleted |
naxsi-git.tar.gz
^
|
|
Changed |
nginx-1.4.7.tar.bz2
^
|
|
Changed |
nginx-1.6.2.tar.bz2
^
|
|
Deleted |
nginx-munin.tar.gz
^
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/HEAD
^
|
@@ -1 +0,0 @@
-ref: refs/heads/master
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/config
^
|
@@ -1,12 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = true
- bare = false
- logallrefupdates = true
- ignorecase = true
-[remote "origin"]
- fetch = +refs/heads/*:refs/remotes/origin/*
- url = https://github.com/arut/nginx-rtmp-module.git
-[branch "master"]
- remote = origin
- merge = refs/heads/master
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/description
^
|
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks/applypatch-msg.sample
^
|
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to check the commit log message taken by
-# applypatch from an e-mail message.
-#
-# The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit. The hook is
-# allowed to edit the commit message file.
-#
-# To enable this hook, rename this file to "applypatch-msg".
-
-. git-sh-setup
-test -x "$GIT_DIR/hooks/commit-msg" &&
- exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
-:
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks/commit-msg.sample
^
|
@@ -1,24 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to check the commit log message.
-# Called by "git commit" with one argument, the name of the file
-# that has the commit message. The hook should exit with non-zero
-# status after issuing an appropriate message if it wants to stop the
-# commit. The hook is allowed to edit the commit message file.
-#
-# To enable this hook, rename this file to "commit-msg".
-
-# Uncomment the below to add a Signed-off-by line to the message.
-# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
-# hook is more suited to it.
-#
-# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
-
-# This example catches duplicate Signed-off-by lines.
-
-test "" = "$(grep '^Signed-off-by: ' "$1" |
- sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
- echo >&2 Duplicate Signed-off-by lines.
- exit 1
-}
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks/post-update.sample
^
|
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to prepare a packed repository for use over
-# dumb transports.
-#
-# To enable this hook, rename this file to "post-update".
-
-exec git update-server-info
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks/pre-applypatch.sample
^
|
@@ -1,14 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed
-# by applypatch from an e-mail message.
-#
-# The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-applypatch".
-
-. git-sh-setup
-test -x "$GIT_DIR/hooks/pre-commit" &&
- exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
-:
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks/pre-commit.sample
^
|
@@ -1,50 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed.
-# Called by "git commit" with no arguments. The hook should
-# exit with non-zero status after issuing an appropriate message if
-# it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-commit".
-
-if git rev-parse --verify HEAD >/dev/null 2>&1
-then
- against=HEAD
-else
- # Initial commit: diff against an empty tree object
- against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-fi
-
-# If you want to allow non-ascii filenames set this variable to true.
-allownonascii=$(git config hooks.allownonascii)
-
-# Redirect output to stderr.
-exec 1>&2
-
-# Cross platform projects tend to avoid non-ascii filenames; prevent
-# them from being added to the repository. We exploit the fact that the
-# printable range starts at the space character and ends with tilde.
-if [ "$allownonascii" != "true" ] &&
- # Note that the use of brackets around a tr range is ok here, (it's
- # even required, for portability to Solaris 10's /usr/bin/tr), since
- # the square bracket bytes happen to fall in the designated range.
- test $(git diff --cached --name-only --diff-filter=A -z $against |
- LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
-then
- echo "Error: Attempt to add a non-ascii file name."
- echo
- echo "This can cause problems if you want to work"
- echo "with people on other platforms."
- echo
- echo "To be portable it is advisable to rename the file ..."
- echo
- echo "If you know what you are doing you can disable this"
- echo "check using:"
- echo
- echo " git config hooks.allownonascii true"
- echo
- exit 1
-fi
-
-# If there are whitespace errors, print the offending file names and fail.
-exec git diff-index --check --cached $against --
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks/pre-rebase.sample
^
|
@@ -1,169 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2006, 2008 Junio C Hamano
-#
-# The "pre-rebase" hook is run just before "git rebase" starts doing
-# its job, and can prevent the command from running by exiting with
-# non-zero status.
-#
-# The hook is called with the following parameters:
-#
-# $1 -- the upstream the series was forked from.
-# $2 -- the branch being rebased (or empty when rebasing the current branch).
-#
-# This sample shows how to prevent topic branches that are already
-# merged to 'next' branch from getting rebased, because allowing it
-# would result in rebasing already published history.
-
-publish=next
-basebranch="$1"
-if test "$#" = 2
-then
- topic="refs/heads/$2"
-else
- topic=`git symbolic-ref HEAD` ||
- exit 0 ;# we do not interrupt rebasing detached HEAD
-fi
-
-case "$topic" in
-refs/heads/??/*)
- ;;
-*)
- exit 0 ;# we do not interrupt others.
- ;;
-esac
-
-# Now we are dealing with a topic branch being rebased
-# on top of master. Is it OK to rebase it?
-
-# Does the topic really exist?
-git show-ref -q "$topic" || {
- echo >&2 "No such branch $topic"
- exit 1
-}
-
-# Is topic fully merged to master?
-not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
-if test -z "$not_in_master"
-then
- echo >&2 "$topic is fully merged to master; better remove it."
- exit 1 ;# we could allow it, but there is no point.
-fi
-
-# Is topic ever merged to next? If so you should not be rebasing it.
-only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
-only_next_2=`git rev-list ^master ${publish} | sort`
-if test "$only_next_1" = "$only_next_2"
-then
- not_in_topic=`git rev-list "^$topic" master`
- if test -z "$not_in_topic"
- then
- echo >&2 "$topic is already up-to-date with master"
- exit 1 ;# we could allow it, but there is no point.
- else
- exit 0
- fi
-else
- not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
- /usr/bin/perl -e '
- my $topic = $ARGV[0];
- my $msg = "* $topic has commits already merged to public branch:\n";
- my (%not_in_next) = map {
- /^([0-9a-f]+) /;
- ($1 => 1);
- } split(/\n/, $ARGV[1]);
- for my $elem (map {
- /^([0-9a-f]+) (.*)$/;
- [$1 => $2];
- } split(/\n/, $ARGV[2])) {
- if (!exists $not_in_next{$elem->[0]}) {
- if ($msg) {
- print STDERR $msg;
- undef $msg;
- }
- print STDERR " $elem->[1]\n";
- }
- }
- ' "$topic" "$not_in_next" "$not_in_master"
- exit 1
-fi
-
-exit 0
-
-################################################################
-
-This sample hook safeguards topic branches that have been
-published from being rewound.
-
-The workflow assumed here is:
-
- * Once a topic branch forks from "master", "master" is never
- merged into it again (either directly or indirectly).
-
- * Once a topic branch is fully cooked and merged into "master",
- it is deleted. If you need to build on top of it to correct
- earlier mistakes, a new topic branch is created by forking at
- the tip of the "master". This is not strictly necessary, but
- it makes it easier to keep your history simple.
-
- * Whenever you need to test or publish your changes to topic
- branches, merge them into "next" branch.
-
-The script, being an example, hardcodes the publish branch name
-to be "next", but it is trivial to make it configurable via
-$GIT_DIR/config mechanism.
-
-With this workflow, you would want to know:
-
-(1) ... if a topic branch has ever been merged to "next". Young
- topic branches can have stupid mistakes you would rather
- clean up before publishing, and things that have not been
- merged into other branches can be easily rebased without
- affecting other people. But once it is published, you would
- not want to rewind it.
-
-(2) ... if a topic branch has been fully merged to "master".
- Then you can delete it. More importantly, you should not
- build on top of it -- other people may already want to
- change things related to the topic as patches against your
- "master", so if you need further changes, it is better to
- fork the topic (perhaps with the same name) afresh from the
- tip of "master".
-
-Let's look at this example:
-
- o---o---o---o---o---o---o---o---o---o "next"
- / / / /
- / a---a---b A / /
- / / / /
- / / c---c---c---c B /
- / / / \ /
- / / / b---b C \ /
- / / / / \ /
- ---o---o---o---o---o---o---o---o---o---o---o "master"
-
-
-A, B and C are topic branches.
-
- * A has one fix since it was merged up to "next".
-
- * B has finished. It has been fully merged up to "master" and "next",
- and is ready to be deleted.
-
- * C has not merged to "next" at all.
-
-We would want to allow C to be rebased, refuse A, and encourage
-B to be deleted.
-
-To compute (1):
-
- git rev-list ^master ^topic next
- git rev-list ^master next
-
- if these match, topic has not merged in next at all.
-
-To compute (2):
-
- git rev-list master..topic
-
- if this is empty, it is fully merged to "master".
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks/prepare-commit-msg.sample
^
|
@@ -1,36 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to prepare the commit log message.
-# Called by "git commit" with the name of the file that has the
-# commit message, followed by the description of the commit
-# message's source. The hook's purpose is to edit the commit
-# message file. If the hook fails with a non-zero status,
-# the commit is aborted.
-#
-# To enable this hook, rename this file to "prepare-commit-msg".
-
-# This hook includes three examples. The first comments out the
-# "Conflicts:" part of a merge commit.
-#
-# The second includes the output of "git diff --name-status -r"
-# into the message, just before the "git status" output. It is
-# commented because it doesn't cope with --amend or with squashed
-# commits.
-#
-# The third example adds a Signed-off-by line to the message, that can
-# still be edited. This is rarely a good idea.
-
-case "$2,$3" in
- merge,)
- /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
-
-# ,|template,)
-# /usr/bin/perl -i.bak -pe '
-# print "\n" . `git diff --cached --name-status -r`
-# if /^#/ && $first++ == 0' "$1" ;;
-
- *) ;;
-esac
-
-# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/hooks/update.sample
^
|
@@ -1,128 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to blocks unannotated tags from entering.
-# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
-#
-# To enable this hook, rename this file to "update".
-#
-# Config
-# ------
-# hooks.allowunannotated
-# This boolean sets whether unannotated tags will be allowed into the
-# repository. By default they won't be.
-# hooks.allowdeletetag
-# This boolean sets whether deleting tags will be allowed in the
-# repository. By default they won't be.
-# hooks.allowmodifytag
-# This boolean sets whether a tag may be modified after creation. By default
-# it won't be.
-# hooks.allowdeletebranch
-# This boolean sets whether deleting branches will be allowed in the
-# repository. By default they won't be.
-# hooks.denycreatebranch
-# This boolean sets whether remotely creating branches will be denied
-# in the repository. By default this is allowed.
-#
-
-# --- Command line
-refname="$1"
-oldrev="$2"
-newrev="$3"
-
-# --- Safety check
-if [ -z "$GIT_DIR" ]; then
- echo "Don't run this script from the command line." >&2
- echo " (if you want, you could supply GIT_DIR then run" >&2
- echo " $0 <ref> <oldrev> <newrev>)" >&2
- exit 1
-fi
-
-if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
- echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
- exit 1
-fi
-
-# --- Config
-allowunannotated=$(git config --bool hooks.allowunannotated)
-allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
-denycreatebranch=$(git config --bool hooks.denycreatebranch)
-allowdeletetag=$(git config --bool hooks.allowdeletetag)
-allowmodifytag=$(git config --bool hooks.allowmodifytag)
-
-# check for no description
-projectdesc=$(sed -e '1q' "$GIT_DIR/description")
-case "$projectdesc" in
-"Unnamed repository"* | "")
- echo "*** Project description file hasn't been set" >&2
- exit 1
- ;;
-esac
-
-# --- Check types
-# if $newrev is 0000...0000, it's a commit to delete a ref.
-zero="0000000000000000000000000000000000000000"
-if [ "$newrev" = "$zero" ]; then
- newrev_type=delete
-else
- newrev_type=$(git cat-file -t $newrev)
-fi
-
-case "$refname","$newrev_type" in
- refs/tags/*,commit)
- # un-annotated tag
- short_refname=${refname##refs/tags/}
- if [ "$allowunannotated" != "true" ]; then
- echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
- echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
- exit 1
- fi
- ;;
- refs/tags/*,delete)
- # delete tag
- if [ "$allowdeletetag" != "true" ]; then
- echo "*** Deleting a tag is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/tags/*,tag)
- # annotated tag
- if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
- then
- echo "*** Tag '$refname' already exists." >&2
- echo "*** Modifying a tag is not allowed in this repository." >&2
- exit 1
- fi
- ;;
- refs/heads/*,commit)
- # branch
- if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
- echo "*** Creating a branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/heads/*,delete)
- # delete branch
- if [ "$allowdeletebranch" != "true" ]; then
- echo "*** Deleting a branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/remotes/*,commit)
- # tracking branch
- ;;
- refs/remotes/*,delete)
- # delete tracking branch
- if [ "$allowdeletebranch" != "true" ]; then
- echo "*** Deleting a tracking branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- *)
- # Anything else (is there anything else?)
- echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
- exit 1
- ;;
-esac
-
-# --- Finished
-exit 0
|
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/index
^
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/info
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/info/exclude
^
|
@@ -1,6 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/logs
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/logs/HEAD
^
|
@@ -1 +0,0 @@
-0000000000000000000000000000000000000000 5150993accb5edefa61d71e1c81ad8c02f515428 U-arrakis\jg <jg@arrakis.(none)> 1481905161 +0100 clone: from https://github.com/arut/nginx-rtmp-module.git
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/logs/refs
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/logs/refs/heads
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/logs/refs/heads/master
^
|
@@ -1 +0,0 @@
-0000000000000000000000000000000000000000 5150993accb5edefa61d71e1c81ad8c02f515428 U-arrakis\jg <jg@arrakis.(none)> 1481905161 +0100 clone: from https://github.com/arut/nginx-rtmp-module.git
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/objects
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/objects/info
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/objects/pack
^
|
-(directory)
|
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/objects/pack/pack-3912c9200a41c4fbd876afb583ab7ecb4733401b.idx
^
|
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/objects/pack/pack-3912c9200a41c4fbd876afb583ab7ecb4733401b.pack
^
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/packed-refs
^
|
@@ -1,369 +0,0 @@
-# pack-refs with: peeled
-406d3a9527e08ea148e7c10ffa4009e0e5070b11 refs/remotes/origin/access-log
-e19ff641b06d3abd30b3bad5cfb491d158835713 refs/remotes/origin/aggregate
-eee52d83c4bdafe712685be06822acb051d407a7 refs/remotes/origin/async-client-handshake
-87686029aa2cfddfea765c626be7161981583482 refs/remotes/origin/atc
-3d5f6df7311594b051fdd26d3ae120d4ae708bb4 refs/remotes/origin/atc-only
-3c2e29f215fb09e5b4cb29040d1e5e092ce73849 refs/remotes/origin/auto-push
-f39d3f66a3ea6bb15b50737b90004b12056a3ad1 refs/remotes/origin/avc-parser
-205664d8c5e040a61b36ae0b74ddf17bc16d2150 refs/remotes/origin/big-endian
-10bcbf0e8daf38e3f3569ba84050f85fd46dd2d0 refs/remotes/origin/big-hls-buffer
-fad4f4717b47ab368d80ff480f2889631edc6521 refs/remotes/origin/big-nal-buffer
-f6ccfb6fa1d05d3babc1bb20ca7003802f85f2f0 refs/remotes/origin/chunksizefix
-d9579d627d727d8ad5edd2a0054f66324bebd459 refs/remotes/origin/close-stream
-aeae84bf8babcd7130f71b5941834eeb4fafa61a refs/remotes/origin/cmd-handler-init
-ebc47f03a43758c4f44ae90c193f4111f9ab1e16 refs/remotes/origin/codec
-cb4623aa4f7e6c2d1cb4c9c9f55ea6107f3a3985 refs/remotes/origin/const-fix
-0b757e8a49480a88f5e051f6590f25e6c4de3288 refs/remotes/origin/control
-ef424df677eb545ba5277649ee99fbea7e38bb55 refs/remotes/origin/control-director
-5e5dd797c2307b40a11409df806f07a427b3cd57 refs/remotes/origin/control-redirect
-b07e0e2dee3a2019dc2be34591b1c4e27730b2a0 refs/remotes/origin/dash
-e8081fd94f1d7ae4483f0a5ca002af8a79d447eb refs/remotes/origin/dash-discont
-fe4877f2168e7e62d6a45cb26708d662f0416961 refs/remotes/origin/dash-timeline
-39717828d67359329797d0ab5f297162b5d5e248 refs/remotes/origin/default-buflen
-90f985fa2f015e8bdfe92a9b57a5d04b779d7be1 refs/remotes/origin/defclose
-63d19ada51b6a1932e1cd73d9895a08cb1ae7827 refs/remotes/origin/drop-old-publisher
-6c79085d5c4203d11d9aa53d456ef7195de8cdc4 refs/remotes/origin/drop-restart
-fe8bf2d6974834ab346b82533151bc953fdfaa7b refs/remotes/origin/drop-restart-mstat
-52c2ef3f91569c3b1c10a40fd1bf56bb4dc1d9de refs/remotes/origin/enotify
-57a96ac2bc1812188aa81237ad582ca115f4391f refs/remotes/origin/envivo-fix
-87686029aa2cfddfea765c626be7161981583482 refs/remotes/origin/exec-fix
-67aa7d5d0da67a43683e8b05467afbdff5622532 refs/remotes/origin/exec-init
-f79aa206ec572c225c8bd32b5c2b1d7cc5ede692 refs/remotes/origin/exec-logging
-b62651efbdcaa77f7836ef5c52ddccfdf9ca473f refs/remotes/origin/exec-pull
-a6913ea68ad017eff14d098f4086c5dafae12af6 refs/remotes/origin/exec-pull-ext
-8c39b37131d150f152aa21a03f076501f39bf4a1 refs/remotes/origin/exec-static
-5e55f62b88f439dc1fbe311060bef53dfcfbc42e refs/remotes/origin/fast-start
-0210f7ca83f8fd65261c4b9040743edf30a258fc refs/remotes/origin/flv-append-fix
-fac68de376a2e20aed5627681ffc90d6374bf295 refs/remotes/origin/flv-header-mask
-b31539ce95d2f84ce8be22b9d11cb4abcd3cb90a refs/remotes/origin/fmle-reset-byte-counter
-990222d643b30a3c9e0db31209416ae9b47e16d3 refs/remotes/origin/fmle-time-fix
-cbccd06babfc66ab920e7e2331d125516715f709 refs/remotes/origin/freebsd-auto-push
-6f2808c7d11564e2269e9f64b9671f8c080c893d refs/remotes/origin/get-notify
-12a0d39bed54bfb3c30272d8d1328d74378853ce refs/remotes/origin/gh-pages
-76211a4bd254e5145d38c0275ad790dc9fac8fd4 refs/remotes/origin/good-logger
-ec282438514e88f7267653728b42c77e3df23bc3 refs/remotes/origin/handshakefix
-d34c6393f6ff22ef6cff6cb2c4ef7c1fe6cd35fa refs/remotes/origin/hls-async-delete
-49a3ee0dc6d5b85fe1164995c8d94424a0971838 refs/remotes/origin/hls-base-url
-4906e816bec876e3e81b129622de3f5e430dcc32 refs/remotes/origin/hls-continuous
-764a039c5856bb8bfb251ff15f4c95cf1c82e54b refs/remotes/origin/hls-debug
-a43bafe3de4641268d04f9105f6ef409abb8ede2 refs/remotes/origin/hls-discont-fix
-8acacd0d7906820039bc5e1e22a4ba332caada3e refs/remotes/origin/hls-encrypt
-7500b4bd90fc942468f94dd3a12dbcdf9c3199a6 refs/remotes/origin/hls-encrypt-auto
-78dcfbcc359f8275a55b7a14d6228e9928c75816 refs/remotes/origin/hls-ensure-directory
-737ea5ce34c8270479811acfacba02112e202625 refs/remotes/origin/hls-event
-546c42efeb910fb6b7b592293f5737324ddd606a refs/remotes/origin/hls-granularity
-2ed36a2611c1674d495f754ef3066c4a8bf98aa3 refs/remotes/origin/hls-nocache
-21174b2ee743c9ea1a0bccb46436c56c871febd3 refs/remotes/origin/hls-nocrackle
-6298aa7e1d95df8b806a262196a6589159284c74 refs/remotes/origin/hls-offset-fix
-059dba448ddeed901d06f825ed84e5e85c0f64cc refs/remotes/origin/hls-read-playlist
-0aaf2a625903ba6d4d9e1e761a0e866215149994 refs/remotes/origin/hls-restart
-2bb16425da9b593f5f9568f7c91bf06a5a1012f1 refs/remotes/origin/hls-restart-on-audio
-3d54d69e252bb537dc8fb03cc96ada084bd5da8d refs/remotes/origin/hls-trailer
-4ff1bd09fcbd8a77618bd528fd8d32fb72bd2661 refs/remotes/origin/hls-ts-discont
-2f1091679b60b8741e59f257ac2c59905cec8206 refs/remotes/origin/hls-variant
-dc698edf242a1ba6d806571e2b32e50fb4d6fcae refs/remotes/origin/hlslight
-7b88858b44371ae03d29052fe6d398750fba851e refs/remotes/origin/http
-050a4e7586552003baff9dd920d28d51eaf8ab22 refs/remotes/origin/idle-streams
-3fc1598db94b234b2ec5f368c34c5d3e877040a0 refs/remotes/origin/init_queue
-d9d749af5b156ea2b4623f7e8d0efa5139885924 refs/remotes/origin/interleave
-5150993accb5edefa61d71e1c81ad8c02f515428 refs/remotes/origin/master
-67443c28b4aff60023ce143475c2d287c264f2f7 refs/remotes/origin/meta-copy
-266e206afcda93cf2880e660fb796eb99fb6df6c refs/remotes/origin/mixed-codecs
-58491f8feddbe801557704dd1d1ac9d0950cdf3f refs/remotes/origin/mp4
-af5703b35756667eb008bdffb22626616bbae020 refs/remotes/origin/mp4-choose-track
-3f9451fdfd2707e91536bb3b942cd0a8202ebc31 refs/remotes/origin/mpeg-dash
-05a23dbc8b8a23bcb49ea71978239ab1e2e79d5d refs/remotes/origin/mstat
-cbe760aa8ad43d3908b7c9408d7f3946747981b1 refs/remotes/origin/msvc-fix1
-4ec43349ad5e16a9216844430695a3479ff6d558 refs/remotes/origin/multi-pull
-004accda9aef265eb1b4df39846156e6892d6a30 refs/remotes/origin/multi-record
-41515325899813d996e092ce4219204cec56ae3a refs/remotes/origin/multiplay
-4ec43349ad5e16a9216844430695a3479ff6d558 refs/remotes/origin/multipull
-1894d333aa9fd76e857532efe6c64d343df137e7 refs/remotes/origin/native-hls
-e22ca286044d343745a4a28b15c6298f80a9fb61 refs/remotes/origin/native-hls-rr
-b5461f61c6833aee803b5134f2285aa652978e09 refs/remotes/origin/new-live
-903abb6646153c9eca2697727231d46804a0c1b7 refs/remotes/origin/new-live2
-02dd440a25097e8528d9cdfa85132b6920649547 refs/remotes/origin/new-live3
-22de95e634b92e23eae85134c05e54c98404e34f refs/remotes/origin/new-relay
-7b5c5e99327c19600ab2bab89960ba217be52949 refs/remotes/origin/new-stat
-591d7f5f3f0a2381f466f578a768ff19344cfbb0 refs/remotes/origin/newhandshake
-cbaff8f1df7c7eabc9474909104f8f4f05324930 refs/remotes/origin/notify-addr
-7f7fcc8d5c0e8468db2b37de9a4ef3ec392c52a7 refs/remotes/origin/notify-redirect
-8d28f7f1de08a81ce356f55c6e29141369bf7aec refs/remotes/origin/notify-redirect-md5
-58bd6029463c79347d45be4488a3786abe5cebb8 refs/remotes/origin/notify-relay
-f89bbae2354ea09cb5d8b04d24ba4df8415e7f09 refs/remotes/origin/on-connect
-62e03d710cd02043156ac86da3b07e5186c78e11 refs/remotes/origin/on-update
-15405e8edde4db9e3c6b56c3a17edbf7dcd974f0 refs/remotes/origin/optsend
-9788b1a5309d40809df6832e81593392f3b381a2 refs/remotes/origin/out-metadata
-2fdec454604b76b40d322b83106ec1a35b98dfce refs/remotes/origin/out-queue-settings
-0478c4445f26f55d33e360a91a7ab4cd57f44f3b refs/remotes/origin/pause
-940ff260099958edf27eb11fe0b959e881fd5dfa refs/remotes/origin/peer-timestamp
-067c73710d15f046945ada24d5ca25d50b2751c7 refs/remotes/origin/play-publish-done
-5d3189ad97c87bbdac9fb455f7505d0d4d5eb058 refs/remotes/origin/play-seek
-8a8f28f3b67d0177f79e754c478e845bac70eb58 refs/remotes/origin/play2
-521f8998b0cf1e197152655b214285ebde974fd3 refs/remotes/origin/play2-continue
-3e25f91004b83c1a1fa25a8993cdd691f65bf658 refs/remotes/origin/postconf-handler-init
-4ec43349ad5e16a9216844430695a3479ff6d558 refs/remotes/origin/preemption
-a72e33ea411ed5f55df04ea9ab9dfceb09137642 refs/remotes/origin/proxy-protocol
-6ab14605ba4a410b39916543302a9a9eb4d19698 refs/remotes/origin/publish-optional-type
-1c2470975e4f23742d3e468649c2ad2bbfb77e7f refs/remotes/origin/publish-time-fix2
-dbc3ac2438757b23a65e1612c36b5691e7173585 refs/remotes/origin/push-reconnect
-0b6a84b0b829c6794c0635dd30a2aa6712417c8f refs/remotes/origin/record-append
-abc2704db1193bd993b886463063059d1ff5050e refs/remotes/origin/record-done
-8658d99529384a487113bb9b80aaffd7714f16a7 refs/remotes/origin/record-keyframes
-9b3471d79f43382db134b407cfce4f5b4ee24ae0 refs/remotes/origin/record-lock
-f79aa206ec572c225c8bd32b5c2b1d7cc5ede692 refs/remotes/origin/record-name-format
-bff1c355ec7db875972da6682e2553d65ac847ad refs/remotes/origin/record-notify
-b69efd3e94113f627f25d0ab67fcd1036eab5fb1 refs/remotes/origin/reentrant-relay
-1f9072bbe69e015021a31784b3ac66f0b296c911 refs/remotes/origin/relay
-c9973fc68a91284c632f3afb736303d6402f6c4e refs/remotes/origin/relay-vars
-7aa513cfcd5fd345ea477ea582faa8858628974d refs/remotes/origin/reltime
-de2a4258d77aecdc2fab34b5857ca4529b1fe0ba refs/remotes/origin/remote-redirect
-60038b6ea15ae34dc1f177625adc73ddb39eb984 refs/remotes/origin/rooms
-35753c5f6221c31edad65a2f70802b856e642fe3 refs/remotes/origin/rooms2
-4a1358723a7ce288aeec9583da97166c260b38dd refs/remotes/origin/rtmp-ads
-71f92aca8d631cbc800c8eed235535e0b0a52991 refs/remotes/origin/safe-amf-parser
-87d1cebfe2822d75f9c97fe2487723029abc272a refs/remotes/origin/sample-access
-57dd1406bd59224eea4e0aabf9dbfe4c82e6be9a refs/remotes/origin/session-relay
-22de95e634b92e23eae85134c05e54c98404e34f refs/remotes/origin/shared-live-streams
-5d7a5ea535ed40e7a9459967dc607bb52b10db12 refs/remotes/origin/shared_record
-18e4762db29139ada9c8be4b36070005e8d01efc refs/remotes/origin/smart-drop
-a8d148473db0fe5fb17e5e7527a3cafcfafb1fff refs/remotes/origin/smartos-compilation-fix
-2cff2a58210c2f964f4d2ee76a8461fb81e28610 refs/remotes/origin/stat-no-underline
-e3be78bc6b6f91fea27ba235a6393dee50817bcf refs/remotes/origin/stat-redesign
-3bd60857bd5ea2f3024e7de248bdc3d64b58859d refs/remotes/origin/static-relay
-7a35372e30dca2a10c843219597bc4bc481fdda0 refs/remotes/origin/static-relay-cleanup
-882b4f15b287b3e313088a67b2a4a543fbb6511d refs/remotes/origin/static-relay2
-ac13bbf1af345532a009a88d93ac4b7869ffe456 refs/remotes/origin/sync
-9b4725a01a9615dfa7133d659ff936bd69e91345 refs/remotes/origin/sync-atc
-7fbfb36440d99786f3c4ecc723ae61fcdedc3ce5 refs/remotes/origin/sync-atc-fmle
-466c1fdf168646d57f0f43c463ad524143917e01 refs/remotes/origin/sync-atc-fmle2
-93b669273561ebd80fbf106b8b482d28a4377b81 refs/remotes/origin/sync-enotify
-c8ad56e2d232933453d54767db55e96e00dd3d6c refs/remotes/origin/video-key
-6ad152ee4c43238bd6a9f71f36b8e5a1757909a0 refs/remotes/origin/video-on-demand
-b6194ed6e6a01ce14026c1778148db61a9a6765e refs/remotes/origin/virtual
-4adc5f7487b0bb27cf027c3e792b00821ad30ada refs/remotes/origin/vod-http
-0f337fe9a482e3da10ca7e8055ae1d8a2ccb9037 refs/remotes/origin/vod-sample-access
-98d959ac5374bd14123f53318e6c8a8d481ffd92 refs/remotes/origin/vod-seek
-770e67b1f33134c7db41e99f27ef167b16be8032 refs/remotes/origin/vod-stat
-5db5d5af24af798f698fcc0f6eeecbac52932139 refs/remotes/origin/vod-stat2
-658f5ec639e290476f19eb91f371e2bf453616c0 refs/remotes/origin/win
-289ee42c53f49728eb134f2226a2ef9ca7a32414 refs/remotes/origin/win1
-92d4c071d91b9de67e7293efcb72ad97c28285a7 refs/tags/freebsd-native-hls
-^1894d333aa9fd76e857532efe6c64d343df137e7
-316b05d54e7e290546872cb26ad5b431b2a935af refs/tags/v0.0.1
-^eda826a386f10109816c57db9ed0908bdca92330
-2ba5b409dfac19e28befd698e0e03ea8f3799517 refs/tags/v0.0.10
-^d943d519754d1c08073298114807a8afb154d07f
-f00415d4264d303b1a2771a3c6a36c026217e000 refs/tags/v0.0.11
-^bcd601832a0a2dc968621e065f1dbeaa14b77bb6
-3080d5f1e2f6e7b4da23585fb538152cbe91bf77 refs/tags/v0.0.12
-^caec91b85772dc5e078a3152cb6ed436c26bfbc3
-740f8034ec343eeab3c19c5e777fc1af05af12e5 refs/tags/v0.0.13
-^d3c5ad11969c6bfba083a33c5c7540d79692ab0a
-18719a9ae0332480c80acac56b54e87b6131f46c refs/tags/v0.0.14
-^cf1976cd05a6e73cdf5fb1506f84508a297688b6
-903e750ce238efa3cde37a40a00c83d0efa7190b refs/tags/v0.0.15
-^6295147db1d44c9e8430b09cf2bf3d0a43c16b56
-93cd6b10d401382dfc8f740dd8e995fc5241eacc refs/tags/v0.0.16
-^359c346d3516403f5545dac0e9d8fe57ff09238e
-88536319dc71fa9e8202eb000dcce7f1aa864321 refs/tags/v0.0.17
-^15405e8edde4db9e3c6b56c3a17edbf7dcd974f0
-6eba477d8578b5c488e034ab25d45e34e30636f5 refs/tags/v0.0.2
-^8204245eb223290cfed21f6748860a4bec510ed1
-4793210ff635d428fc37692d88a1107e32f3839e refs/tags/v0.0.3
-^96ebed857347b368cb78749de3515797eb0d9364
-110118d72aa68bced1a7da6d427c4a1473153f8b refs/tags/v0.0.4
-^b9ee8dbe097b2ab9cd60786c1cfa9a48237c51dd
-49d4548bbc229885290915256d3b75f5d0b2863e refs/tags/v0.0.5
-^1e9a7e6efcd6990662f41e54587f27ab3f28ba87
-1c620f4121a3c4c64ccc71ca9a3aee100b702221 refs/tags/v0.0.6
-^3980a5923715131c8ac011410e63250ef5d13c93
-dbad1b31d510f290c5ebac4f073f5b7c3ef97e04 refs/tags/v0.0.7
-^7b70e9241327b93d04554cd7b8d2eeadb2acc4e6
-41ca3077bdbd20c2ddefdcc5f03a26b9ab6c358b refs/tags/v0.0.8
-^e563c3146e31eb8ce48634262435978bab26f7f0
-dc702ef73579582157563de257bf906d5ac77e18 refs/tags/v0.0.9
-^31d18ed4478684571476aed6125e942bfc738d77
-e2dcb0bea3859e6a66a7601356a7d90434d5ef4f refs/tags/v0.1.0
-^c61d7ac56f4895dc3f0513344b45d74943d4da19
-a0e0796bff7e6a33181d4cb6a1981a9889cf791c refs/tags/v0.1.1
-^f6ccfb6fa1d05d3babc1bb20ca7003802f85f2f0
-80db4c48b3cc30ad12112b5bde3831520c81a92a refs/tags/v0.1.10
-^88346934e51595118518957553316afda5a8b771
-b103795c7f1f41a51451dace848f8de085d59840 refs/tags/v0.1.11
-^45cd9825a2bb882c3b65a9c1139342bc59e40750
-8c8410a1def03c6f535110352398a0fc463d08f8 refs/tags/v0.1.12
-^63c4269a9146370db970894512523b9f3893ffad
-951872e641cbebbd925c17cb8e8cc8a0289fe9cd refs/tags/v0.1.13
-^1719ef4433de03e8d95be7838a933326d717f1ee
-6432ba9937589a7bbd58975d2e253a65e433e17b refs/tags/v0.1.14
-^fa3630d63d77ec4e6dcfa14a88afb5804b1b3596
-4b89a9819cc22c6ca1852613c518e0f400c6c048 refs/tags/v0.1.15
-^8def5f394543b822b6b450e79bdbf9a73f1d0a99
-40d6554b7196933e96aff91bba15f6b31c99dedb refs/tags/v0.1.2
-^4e713b75e8e3cd8f5456303e2f7f4803776f33de
-a33ca7451cbd32dc2f43e01b3b87552f055a56ae refs/tags/v0.1.3
-^d82c16499de14965ff1259c457b33b5a81614c40
-dd9683b203e09b13d08e717e20304060c1d320cb refs/tags/v0.1.4
-^a4f48c5baa427c9d9093c0ceee339820c2167624
-d216f3dd61f67da413503b492af4b1f5c3e58451 refs/tags/v0.1.5
-^32279ddf26a9d9e0f34ff62d460bf4c1b14e2088
-2dab9cce52024dbf7ae3273770e159e73db21618 refs/tags/v0.1.6
-^49382c826b041589badb32b5f5f512592405a736
-c83a64c91d926c1bc5ac35036d49c31f87165466 refs/tags/v0.1.7
-^63e19f8d67d4f442f2700103c4d8ee9d137c0116
-0ab4039b703078ddacd4e70adc67b99efd946de3 refs/tags/v0.1.8
-^4bb48483be9d91a74a2efd5cb80fa136918ae466
-c9d359554132dc807d599b8d28b3193c8e37d841 refs/tags/v0.1.9
-^6143abc41803be6da47bfc4e15bbfe1d315de832
-4d20bb15480652145358c20f444f77ddbe2eeac6 refs/tags/v0.2.0
-^eb4e9e8d9033cb7c1775eec114cd7b90af26b047
-9df13315600aa2752fc99e80fb8b73a78e0f0fbf refs/tags/v0.2.1
-^1a2a8e2867f4d1cd64853bc49af9e725ee7f8343
-7e8b090de600016d965d3080b0cd6bc81eb60f67 refs/tags/v0.2.2
-^4e475cccb507951e5091f0ff5f1d4ef1903fd439
-f7f24bade80cca3a09e7286f250bb464cfab2df1 refs/tags/v0.2.3
-^295551947a187a265e5c60e6cccdf4c894a21e24
-2bf2e04da1cd97187612ba73ce9010c96393b76a refs/tags/v0.3.0
-^58491f8feddbe801557704dd1d1ac9d0950cdf3f
-aded30326d7e233283346dab1258d4fdf69c31e7 refs/tags/v0.4.0
-^3c2e29f215fb09e5b4cb29040d1e5e092ce73849
-3381f10c50c161b0350ca8030535a97f43977940 refs/tags/v0.4.1
-^067c73710d15f046945ada24d5ca25d50b2751c7
-943ca88b8160225ef8decfab7aa3c6ba40c012a7 refs/tags/v0.4.2
-^ff247dafff1cab945c85ceefcf97d76fa1972c0e
-2864097d4bf7e81a95bc85d133121beaf8262fc9 refs/tags/v0.4.3
-^ed5f06db8a90746059730fe8b55cf9ddc64ca67e
-ed9bef4dc07d34078749b79d072cde59f385084a refs/tags/v0.5.0
-^abc2704db1193bd993b886463063059d1ff5050e
-eb94d37c69842eb563fa3e7c9cc286cc942fd2e8 refs/tags/v0.5.1
-^6485716fb4734d5fc25ba12d849e2dedab63707d
-0b020f1757f052a24a4d4c2061fcc4f8e1dbd440 refs/tags/v0.5.2
-^87686029aa2cfddfea765c626be7161981583482
-053bdc9277034a6db7edcc3d46c042ab8c62989b refs/tags/v0.5.3
-^cc632eb6b683eacdced09bfbe905e510779d5efc
-307f468efdffa4ad07e79c0e39eab9f9eb195307 refs/tags/v0.5.4
-^bff1c355ec7db875972da6682e2553d65ac847ad
-98438d54995ad4d11d7a020ff6b77919ca368448 refs/tags/v0.6.0
-^72d175ed7f5dfb4874ac6e002b737d866a0553d7
-f1eeb39f851366614b7dc1afa1fba21e1595475f refs/tags/v0.6.1
-^21174b2ee743c9ea1a0bccb46436c56c871febd3
-2b20008d1f3cb4b357d74ee288e2c00ac801d415 refs/tags/v0.6.2
-^795c1538a3602d5eedf7617c6d13c775721a66b9
-6b1f2547203b946cbac8c60bd86e5f04ad1a9a1d refs/tags/v0.6.3
-^c86e30fd270103b00c244f136c8780fb3a51b921
-d623935695e9ac6418a1baa24283bd35a42fef81 refs/tags/v0.6.4
-^f65f07deb32565b144e22faece57638f8961d62f
-d3a7be773484e670119dfa20ff56cb0a91a8554f refs/tags/v0.6.5
-^4adc5f7487b0bb27cf027c3e792b00821ad30ada
-293ebabd1220ec4615e2eb89d19ca3e7a381d1a3 refs/tags/v0.7.0
-^101b43a478bb44018733e75a3bf3b1f8adc5b2e5
-4b12afb07c889648864458c3a6096dc274c7420e refs/tags/v0.7.1
-^98d959ac5374bd14123f53318e6c8a8d481ffd92
-eb5ccb5fb1f735b82da3a43ee0d8d398bd932840 refs/tags/v0.7.2
-^6f2808c7d11564e2269e9f64b9671f8c080c893d
-23fe9e844ecafd18a5d713618a36fb68846db951 refs/tags/v0.7.3
-^62e03d710cd02043156ac86da3b07e5186c78e11
-09b1e2bab6467a8d50e37939b4d1fc0b9777adfd refs/tags/v0.7.4
-^696e488ecb089236a297939248d4616d4665d347
-fa8752466e94879be074386c2f0420640cec3b41 refs/tags/v0.8.0
-^02dd440a25097e8528d9cdfa85132b6920649547
-7c3df8e2c78a85ef7f5d2e8f100e5f54573c71c7 refs/tags/v0.8.1
-^9f4296c08382b1374018346cce3bb5d40036f47a
-f8899c67c2508ded911a93117b3186df6df631bd refs/tags/v0.8.2
-^ac924d7f940f05063d7ef0503aa7f3a1576bf380
-683a29d4d0a536b6a97c07d1deeacb8cc11a6af7 refs/tags/v0.8.3
-^3d54d69e252bb537dc8fb03cc96ada084bd5da8d
-2aeefa379b700de0c9c1b4ed94e186e0d1d1a580 refs/tags/v0.8.4
-^f2f28cbe487883caed333ffb4f5f7942bed64c09
-5ea2a003691a63630e6c1d492c96d6581338efb8 refs/tags/v0.8.5
-^bd562e4ff7c10cad71711828548cbb584bd4a80b
-11ee9f81e8b8a077113cdf96d655d7cf9961a03d refs/tags/v0.8.6
-^e5e5766ebb51e1c36b6804fe0ddc02ee8ca19cc6
-544c73b3b27c93df0d61172c62a7eee2e8252953 refs/tags/v0.8.7
-^3eaa43a7a327646acdebe87000422c6fd086adbe
-83055d17d104c267aeebda070246b0917dbfffb2 refs/tags/v0.9.0
-^406d3a9527e08ea148e7c10ffa4009e0e5070b11
-37a1511c0e7c6a1a522bab7355289a71a7876ad2 refs/tags/v0.9.1
-^ea65ac688cdd89dad65bcdc3b62d5e152b47f1ec
-ee0df070f78e83f3857301aa0e4340c15743403d refs/tags/v0.9.10
-^6923889e5386abad1aa07e2c29462fc469d3a5d4
-cb5e1df91a1b8d020de63d6cbbacd9f74097a375 refs/tags/v0.9.11
-^3aa528fccd2c3500b2eeafa6589c3f8f07564186
-6d328d3291833a9991cb27df45d1c82cfc3bc5fb refs/tags/v0.9.12
-^11e3f53fd259f0297a4d8f440afceb8395b45622
-b63100856c3a795440047324aaf863c6339e859f refs/tags/v0.9.13
-^0a8f0ee6c560edc032f66a25d527e9cd7ed6b62b
-e13bcdadf3b57f91e8eca678846480522eb214ba refs/tags/v0.9.14
-^612fc4dd7514b3da2ac774a6daeb7baa60314f36
-1c92b49d30e7215483d5c0c038da2d09d6ac1d16 refs/tags/v0.9.15
-^7b5c5e99327c19600ab2bab89960ba217be52949
-bc3fe7a8ebf166e5187f7bac00c70e40a9b192fe refs/tags/v0.9.16
-^c0fc4bbdccf1d328eaa098f3287e427e369517c0
-d5288d89f8c1e1c8c82218a23deedfabb845fa1c refs/tags/v0.9.17
-^f79aa206ec572c225c8bd32b5c2b1d7cc5ede692
-bce7ea3e62682b29d61d56cc6bcc0e794857d557 refs/tags/v0.9.18
-^c61e99a36878fc618e29633db0e9652be13f6284
-39cb7ca0a51e7e4bfc400b285141a71ac7b565c7 refs/tags/v0.9.19
-^a47b23204b43d5b823feeb52b0c868b2c96847ca
-43dd6489282d965072eb48479af5e8d90ac6ad38 refs/tags/v0.9.2
-^af5703b35756667eb008bdffb22626616bbae020
-73e60038c62b281fd0e4ff5565f35797fed46a1a refs/tags/v0.9.20
-^e29e64ed7d262904d22ce0a708e67cc02115f497
-828fcd80c23df5caf0b7fdbf897ba45a92f3dce7 refs/tags/v0.9.3
-^aeae84bf8babcd7130f71b5941834eeb4fafa61a
-31f684d189aec37550e82e4c7cf3ac751a781ade refs/tags/v0.9.4
-^f358a2e8f9269afef85d82549de4945942b39d6c
-63540cc06386523c08857cf435ad9c2f6daaef8a refs/tags/v0.9.5
-^c0ad999f37675dd1bbed11d901f34259827bb405
-e7fe15e6ca0cb0f81ec42b5b309ce6f720525193 refs/tags/v0.9.6
-^5325df0135c467d21cf93cd5c5df6af60a87a9e8
-0dda255fe75318707bb20e0078ace6da1f160cd2 refs/tags/v0.9.7
-^138c330da2ace7617af3c6b671fbee049f387fb7
-568ce8f0a850d3d7e00c33247edffe366cff0d51 refs/tags/v0.9.8
-^6903ac23e430b4170b108bb2f631562560c37fe0
-2d5bc52527e46171d2e2a7c4d9c87fa2a4e39fee refs/tags/v0.9.9
-^af8446a0985ba76873c25a6aae5125e47c7a3194
-d27f964d1f45d546419795b058fea60f3f1f21ab refs/tags/v1.0.0
-^613234b866fd08ea2221d183edfd9eb6d8a8bf4d
-421d9ff41f699cc344845df9869dccff0ce4ad86 refs/tags/v1.0.1
-^cbe760aa8ad43d3908b7c9408d7f3946747981b1
-e1ec6d2f08937878a985bfa7d4f49e93312dc7e0 refs/tags/v1.0.2
-^6b92cd6b29ddeea5a113b6e5d8d854b6986e3fd1
-7749d54fb000641dfa6c8eebfb8765175f187a13 refs/tags/v1.0.3
-^7b4df729c1c4d86589f8ccadc0bd20ee733416f9
-aaeca4ff01f858cd719ea5b86eef7dcc3ba259ca refs/tags/v1.0.4
-^67443c28b4aff60023ce143475c2d287c264f2f7
-d7e1af79c4d152d16bcacfcd2ca18d58e6b3201b refs/tags/v1.0.5
-^737ea5ce34c8270479811acfacba02112e202625
-0acf1123a044c8afd68112387712abd59e45a2eb refs/tags/v1.0.6
-^1cfb7aeb582789f3b15a03da5b662d1811e2a3f1
-bd4f1b4cf7c58e55298c326184e5ad1a15c3aff0 refs/tags/v1.0.7
-^995688b9cfea4fb01a5b8ad0e110fec0866e501c
-5beda43a6b388af5e7c1bcc55384163d97dcf836 refs/tags/v1.0.8
-^d01ffc0c88d9ce736be3dee99b4f9d3fcc07b685
-f792dab070dbdedc3b968483287fa59e6ae48a03 refs/tags/v1.0.9
-^471d299f5d5348dfbba6132779587553c3a709a7
-a08c7835b05e2bd816efb1f8036cb7c9bf59b906 refs/tags/v1.1.0
-^8542e21e17587ee2e928cdfedc1cb82996df7719
-e9d11158cb1b18a0631a94c4e8599c0f8c64adb7 refs/tags/v1.1.1
-^8608faad1e0b25c80b1f9b93439d6fd450db5c15
-cf710155b2666d2456a58a49dac1af4d93b215ce refs/tags/v1.1.10
-^5150993accb5edefa61d71e1c81ad8c02f515428
-2a721794867c76e9ac9e653e76da9503cbc9d60f refs/tags/v1.1.2
-^65cd61e43350c0de0a69103aed1ecf7f2b081ab8
-c130de320738a9ae084ba3d54f033c98e6e82d65 refs/tags/v1.1.3
-^6f768dc4eb2a2cb7798e31c7465af77b94ca2733
-3fdbbcc01249d7a3f0559192debfe09f844aef6e refs/tags/v1.1.4
-^8c2229cce5d4d4574e8fb7b130281497f746f0fa
-28618cde22c864eef6ecdba9da636a2f2f611b20 refs/tags/v1.1.5
-^7500b4bd90fc942468f94dd3a12dbcdf9c3199a6
-1706bc84f5b0882dec6f1854d9054be7e3d12ab2 refs/tags/v1.1.6
-^7a35372e30dca2a10c843219597bc4bc481fdda0
-c0a5fb42c214d585a84967b2e172889d9278d325 refs/tags/v1.1.7
-^f62a0838064baf089ad9fe3c8f6f2ffe0775afb2
-1fe006d50fbca7537984fc080dd32906b9cb5455 refs/tags/v1.1.8
-^cb54ed4ac0994e36b92d21a51313af44ecdfdadd
-c7447b49ee18232dab330fadf6c2dfb5fa2bbfb2 refs/tags/v1.1.9
-^c0bf381d10de05c135f913921c58272838d5e1ee
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/refs
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/refs/heads
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/refs/heads/master
^
|
@@ -1 +0,0 @@
-5150993accb5edefa61d71e1c81ad8c02f515428
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/refs/remotes
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/refs/remotes/origin
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/refs/remotes/origin/HEAD
^
|
@@ -1 +0,0 @@
-ref: refs/remotes/origin/master
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/.git/refs/tags
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/ngx_rtmp_proxy_protocol.c
^
|
@@ -1,197 +0,0 @@
-
-/*
- * Copyright (C) Roman Arutyunyan
- */
-
-
-#include <ngx_config.h>
-#include <ngx_core.h>
-#include <nginx.h>
-#include "ngx_rtmp_proxy_protocol.h"
-
-
-static void ngx_rtmp_proxy_protocol_recv(ngx_event_t *rev);
-
-
-void
-ngx_rtmp_proxy_protocol(ngx_rtmp_session_t *s)
-{
- ngx_event_t *rev;
- ngx_connection_t *c;
-
- c = s->connection;
- rev = c->read;
- rev->handler = ngx_rtmp_proxy_protocol_recv;
-
- ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "proxy_protocol: start");
-
- if (rev->ready) {
- /* the deferred accept(), rtsig, aio, iocp */
-
- if (ngx_use_accept_mutex) {
- ngx_post_event(rev, &ngx_posted_events);
- return;
- }
-
- rev->handler(rev);
- return;
- }
-
- ngx_add_timer(rev, s->timeout);
-
- if (ngx_handle_read_event(rev, 0) != NGX_OK) {
- ngx_rtmp_finalize_session(s);
- return;
- }
-}
-
-
-static void
-ngx_rtmp_proxy_protocol_recv(ngx_event_t *rev)
-{
- u_char buf[107], *p, *pp, *text;
- size_t len;
- ssize_t n;
- ngx_err_t err;
- ngx_int_t i;
- ngx_addr_t addr;
- ngx_connection_t *c;
- ngx_rtmp_session_t *s;
-
- c = rev->data;
- s = c->data;
-
- if (c->destroyed) {
- return;
- }
-
- if (rev->timedout) {
- ngx_log_error(NGX_LOG_INFO, c->log, NGX_ETIMEDOUT,
- "proxy_protocol: recv: client timed out");
- c->timedout = 1;
- ngx_rtmp_finalize_session(s);
- return;
- }
-
- if (rev->timer_set) {
- ngx_del_timer(rev);
- }
-
- n = recv(c->fd, (char *) buf, sizeof(buf), MSG_PEEK);
-
- err = ngx_socket_errno;
-
- ngx_log_debug1(NGX_LOG_DEBUG_RTMP, c->log, 0, "recv(): %d", n);
-
- if (n == -1) {
-
- if (err == NGX_EAGAIN) {
- ngx_add_timer(rev, s->timeout);
-
- if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
- ngx_rtmp_finalize_session(s);
- }
-
- return;
- }
-
- ngx_rtmp_finalize_session(s);
-
- return;
- }
-
- p = buf;
-
- if (n <= 8 && ngx_strncmp(p, "PROXY ", 6) != 0) {
- goto bad_header;
- }
-
- n -= 6;
- p += 6;
-
- ngx_memzero(&addr, sizeof(ngx_addr_t));
-
- if (n >= 7 && ngx_strncmp(p, "UNKNOWN", 7) == 0) {
- n -= 7;
- p += 7;
- goto skip;
- }
-
- if (n < 5 || ngx_strncmp(p, "TCP", 3) != 0
- || (p[3] != '4' && p[3] != '6') || p[4] != ' ')
- {
- goto bad_header;
- }
-
- n -= 5;
- p += 5;
-
- pp = ngx_strlchr(p, p + n, ' ');
-
- if (pp == NULL) {
- goto bad_header;
- }
-
- if (ngx_parse_addr(s->connection->pool, &addr, p, pp - p) != NGX_OK) {
- goto bad_header;
- }
-
- n -= pp - p;
- p = pp;
-
-skip:
-
- for (i = 0; i + 1 < n; i++) {
- if (p[i] == CR && p[i + 1] == LF) {
- break;
- }
- }
-
- if (i + 1 >= n) {
- goto bad_header;
- }
-
- n = p - buf + i + 2;
-
- if (c->recv(c, buf, n) != n) {
- goto failed;
- }
-
- if (addr.socklen) {
- text = ngx_palloc(s->connection->pool, NGX_SOCKADDR_STRLEN);
-
- if (text == NULL) {
- goto failed;
- }
-
- len = ngx_sock_ntop(addr.sockaddr,
-#if (nginx_version >= 1005003)
- addr.socklen,
-#endif
- text, NGX_SOCKADDR_STRLEN, 0);
- if (len == 0) {
- goto failed;
- }
-
- c->sockaddr = addr.sockaddr;
- c->socklen = addr.socklen;
- c->addr_text.data = text;
- c->addr_text.len = len;
-
- ngx_log_debug1(NGX_LOG_DEBUG_RTMP, c->log, 0,
- "proxy_protocol: remote_addr:'%V'", &c->addr_text);
- }
-
- ngx_rtmp_handshake(s);
-
- return;
-
-bad_header:
-
- ngx_log_error(NGX_LOG_INFO, c->log, 0, "proxy_protocol: bad header");
-
-failed:
-
- ngx_rtmp_finalize_session(s);
-}
|
[-]
[+]
|
Deleted |
nginx-rtmp-module-1.1.15.tar.gz/ngx_rtmp_proxy_protocol.h
^
|
@@ -1,19 +0,0 @@
-
-/*
- * Copyright (C) Roman Arutyunyan
- */
-
-
-#ifndef _NGX_RTMP_PROXY_PROTOCOL_H_INCLUDED_
-#define _NGX_RTMP_PROXY_PROTOCOL_H_INCLUDED_
-
-
-#include <ngx_config.h>
-#include <ngx_core.h>
-#include "ngx_rtmp.h"
-
-
-void ngx_rtmp_proxy_protocol(ngx_rtmp_session_t *c);
-
-
-#endif /* _NGX_RTMP_PROXY_PROTOCOL_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/LICENSE
^
|
@@ -1,4 +1,4 @@
-Copyright (c) 2012-2014, Roman Arutyunyan
+Copyright (c) 2012-2013, Roman Arutyunyan
All rights reserved.
Redistribution and use in source and binary forms, with or without
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/README.md
^
|
@@ -245,7 +245,7 @@
# HLS
- # For HLS to work please create a directory in tmpfs (/tmp/hls here)
+ # For HLS to work please create a directory in tmpfs (/tmp/app here)
# for the fragments. The directory contents is served via HTTP (see
# http{} section in config)
#
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/config
^
|
@@ -1,6 +1,6 @@
ngx_addon_name="ngx_rtmp_module"
-RTMP_CORE_MODULES=" \
+CORE_MODULES="$CORE_MODULES
ngx_rtmp_module \
ngx_rtmp_core_module \
ngx_rtmp_cmd_module \
@@ -15,7 +15,6 @@
ngx_rtmp_relay_module \
ngx_rtmp_exec_module \
ngx_rtmp_auto_push_module \
- ngx_rtmp_auto_push_index_module \
ngx_rtmp_notify_module \
ngx_rtmp_log_module \
ngx_rtmp_limit_module \
@@ -24,13 +23,13 @@
"
-RTMP_HTTP_MODULES=" \
+HTTP_MODULES="$HTTP_MODULES \
ngx_rtmp_stat_module \
ngx_rtmp_control_module \
"
-RTMP_DEPS=" \
+NGX_ADDON_DEPS="$NGX_ADDON_DEPS \
$ngx_addon_dir/ngx_rtmp_amf.h \
$ngx_addon_dir/ngx_rtmp_bandwidth.h \
$ngx_addon_dir/ngx_rtmp_cmd_module.h \
@@ -45,13 +44,12 @@
$ngx_addon_dir/ngx_rtmp_relay_module.h \
$ngx_addon_dir/ngx_rtmp_streams.h \
$ngx_addon_dir/ngx_rtmp_bitop.h \
- $ngx_addon_dir/ngx_rtmp_proxy_protocol.h \
$ngx_addon_dir/hls/ngx_rtmp_mpegts.h \
$ngx_addon_dir/dash/ngx_rtmp_mp4.h \
"
-RTMP_CORE_SRCS=" \
+NGX_ADDON_SRCS="$NGX_ADDON_SRCS \
$ngx_addon_dir/ngx_rtmp.c \
$ngx_addon_dir/ngx_rtmp_init.c \
$ngx_addon_dir/ngx_rtmp_handshake.c \
@@ -71,6 +69,8 @@
$ngx_addon_dir/ngx_rtmp_flv_module.c \
$ngx_addon_dir/ngx_rtmp_mp4_module.c \
$ngx_addon_dir/ngx_rtmp_netcall_module.c \
+ $ngx_addon_dir/ngx_rtmp_stat_module.c \
+ $ngx_addon_dir/ngx_rtmp_control_module.c \
$ngx_addon_dir/ngx_rtmp_relay_module.c \
$ngx_addon_dir/ngx_rtmp_bandwidth.c \
$ngx_addon_dir/ngx_rtmp_exec_module.c \
@@ -79,55 +79,12 @@
$ngx_addon_dir/ngx_rtmp_log_module.c \
$ngx_addon_dir/ngx_rtmp_limit_module.c \
$ngx_addon_dir/ngx_rtmp_bitop.c \
- $ngx_addon_dir/ngx_rtmp_proxy_protocol.c \
$ngx_addon_dir/hls/ngx_rtmp_hls_module.c \
$ngx_addon_dir/dash/ngx_rtmp_dash_module.c \
$ngx_addon_dir/hls/ngx_rtmp_mpegts.c \
$ngx_addon_dir/dash/ngx_rtmp_mp4.c \
"
-
-
-RTMP_HTTP_SRCS=" \
- $ngx_addon_dir/ngx_rtmp_stat_module.c \
- $ngx_addon_dir/ngx_rtmp_control_module.c \
- "
-
-if [ -f auto/module ] ; then
- ngx_module_incs=$ngx_addon_dir
- ngx_module_deps=$RTMP_DEPS
-
- if [ $ngx_module_link = DYNAMIC ] ; then
- ngx_module_name="$RTMP_CORE_MODULES $RTMP_HTTP_MODULES"
- ngx_module_srcs="$RTMP_CORE_SRCS $RTMP_HTTP_SRCS"
-
- . auto/module
-
- else
- ngx_module_type=CORE
- ngx_module_name=$RTMP_CORE_MODULES
- ngx_module_srcs=$RTMP_CORE_SRCS
-
- . auto/module
-
-
- ngx_module_type=HTTP
- ngx_module_name=$RTMP_HTTP_MODULES
- ngx_module_incs=
- ngx_module_deps=
- ngx_module_srcs=$RTMP_HTTP_SRCS
-
- . auto/module
- fi
-
-else
- CORE_MODULES="$CORE_MODULES $RTMP_CORE_MODULES"
- HTTP_MODULES="$HTTP_MODULES $RTMP_HTTP_MODULES"
-
- NGX_ADDON_DEPS="$NGX_ADDON_DEPS $RTMP_DEPS"
- NGX_ADDON_SRCS="$NGX_ADDON_SRCS $RTMP_CORE_SRCS $RTMP_HTTP_SRCS"
-
- CFLAGS="$CFLAGS -I$ngx_addon_dir"
-fi
+CFLAGS="$CFLAGS -I$ngx_addon_dir"
USE_OPENSSL=YES
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/dash/ngx_rtmp_dash_module.c
^
|
@@ -412,7 +412,7 @@
p = ngx_slprintf(buffer, last, NGX_RTMP_DASH_MANIFEST_AUDIO,
&ctx->name,
codec_ctx->audio_codec_id == NGX_RTMP_AUDIO_AAC ?
- (codec_ctx->aac_sbr ? "40.5" : "40.2") : "6b",
+ "40.2" : "6b",
codec_ctx->sample_rate,
(ngx_uint_t) (codec_ctx->audio_data_rate * 1000),
name, sep,
@@ -1413,22 +1413,14 @@
}
-#if (nginx_version >= 1011005)
-static ngx_msec_t
-#else
static time_t
-#endif
ngx_rtmp_dash_cleanup(void *data)
{
ngx_rtmp_dash_cleanup_t *cleanup = data;
ngx_rtmp_dash_cleanup_dir(&cleanup->path, cleanup->playlen);
-#if (nginx_version >= 1011005)
- return cleanup->playlen * 2;
-#else
return cleanup->playlen / 500;
-#endif
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/hls/ngx_rtmp_hls_module.c
^
|
@@ -25,8 +25,6 @@
static char * ngx_rtmp_hls_merge_app_conf(ngx_conf_t *cf,
void *parent, void *child);
static ngx_int_t ngx_rtmp_hls_flush_audio(ngx_rtmp_session_t *s);
-static ngx_int_t ngx_rtmp_hls_ensure_directory(ngx_rtmp_session_t *s,
- ngx_str_t *path);
#define NGX_RTMP_HLS_BUFSIZE (1024*1024)
@@ -35,7 +33,6 @@
typedef struct {
uint64_t id;
- uint64_t key_id;
double duration;
unsigned active:1;
unsigned discont:1; /* before */
@@ -51,26 +48,22 @@
typedef struct {
unsigned opened:1;
- ngx_rtmp_mpegts_file_t file;
+ ngx_file_t file;
ngx_str_t playlist;
ngx_str_t playlist_bak;
ngx_str_t var_playlist;
ngx_str_t var_playlist_bak;
ngx_str_t stream;
- ngx_str_t keyfile;
ngx_str_t name;
- u_char key[16];
uint64_t frag;
uint64_t frag_ts;
- uint64_t key_id;
ngx_uint_t nfrags;
ngx_rtmp_hls_frag_t *frags; /* circular 2 * winfrags + 1 */
ngx_uint_t audio_cc;
ngx_uint_t video_cc;
- ngx_uint_t key_frags;
uint64_t aframe_base;
uint64_t aframe_num;
@@ -85,7 +78,6 @@
typedef struct {
ngx_str_t path;
ngx_msec_t playlen;
- ngx_uint_t frags_per_key;
} ngx_rtmp_hls_cleanup_t;
@@ -109,11 +101,6 @@
ngx_flag_t cleanup;
ngx_array_t *variant;
ngx_str_t base_url;
- ngx_int_t granularity;
- ngx_flag_t keys;
- ngx_str_t key_path;
- ngx_str_t key_url;
- ngx_uint_t frags_per_key;
} ngx_rtmp_hls_app_conf_t;
@@ -273,41 +260,6 @@
offsetof(ngx_rtmp_hls_app_conf_t, base_url),
NULL },
- { ngx_string("hls_fragment_naming_granularity"),
- NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_num_slot,
- NGX_RTMP_APP_CONF_OFFSET,
- offsetof(ngx_rtmp_hls_app_conf_t, granularity),
- NULL },
-
- { ngx_string("hls_keys"),
- NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_flag_slot,
- NGX_RTMP_APP_CONF_OFFSET,
- offsetof(ngx_rtmp_hls_app_conf_t, keys),
- NULL },
-
- { ngx_string("hls_key_path"),
- NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_slot,
- NGX_RTMP_APP_CONF_OFFSET,
- offsetof(ngx_rtmp_hls_app_conf_t, key_path),
- NULL },
-
- { ngx_string("hls_key_url"),
- NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_str_slot,
- NGX_RTMP_APP_CONF_OFFSET,
- offsetof(ngx_rtmp_hls_app_conf_t, key_url),
- NULL },
-
- { ngx_string("hls_fragments_per_key"),
- NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_num_slot,
- NGX_RTMP_APP_CONF_OFFSET,
- offsetof(ngx_rtmp_hls_app_conf_t, frags_per_key),
- NULL },
-
ngx_null_command
};
@@ -484,15 +436,14 @@
{
static u_char buffer[1024];
ngx_fd_t fd;
- u_char *p, *end;
+ u_char *p;
ngx_rtmp_hls_ctx_t *ctx;
ssize_t n;
ngx_rtmp_hls_app_conf_t *hacf;
ngx_rtmp_hls_frag_t *f;
ngx_uint_t i, max_frag;
- ngx_str_t name_part, key_name_part;
- uint64_t prev_key_id;
- const char *sep, *key_sep;
+ ngx_str_t name_part;
+ const char *sep;
hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
@@ -517,19 +468,15 @@
}
}
- p = buffer;
- end = p + sizeof(buffer);
-
- p = ngx_slprintf(p, end,
+ p = ngx_snprintf(buffer, sizeof(buffer),
"#EXTM3U\n"
"#EXT-X-VERSION:3\n"
"#EXT-X-MEDIA-SEQUENCE:%uL\n"
- "#EXT-X-TARGETDURATION:%ui\n",
- ctx->frag, max_frag);
-
- if (hacf->type == NGX_RTMP_HLS_TYPE_EVENT) {
- p = ngx_slprintf(p, end, "#EXT-X-PLAYLIST-TYPE: EVENT\n");
- }
+ "#EXT-X-TARGETDURATION:%ui\n"
+ "%s",
+ ctx->frag, max_frag,
+ hacf->type == NGX_RTMP_HLS_TYPE_EVENT ?
+ "#EXT-X-PLAYLIST-TYPE: EVENT\n" : "");
n = ngx_write_fd(fd, buffer, p - buffer);
if (n < 0) {
@@ -541,42 +488,20 @@
}
sep = hacf->nested ? (hacf->base_url.len ? "/" : "") : "-";
- key_sep = hacf->nested ? (hacf->key_url.len ? "/" : "") : "-";
name_part.len = 0;
if (!hacf->nested || hacf->base_url.len) {
name_part = ctx->name;
}
- key_name_part.len = 0;
- if (!hacf->nested || hacf->key_url.len) {
- key_name_part = ctx->name;
- }
-
- prev_key_id = 0;
-
for (i = 0; i < ctx->nfrags; i++) {
f = ngx_rtmp_hls_get_frag(s, i);
- p = buffer;
- end = p + sizeof(buffer);
-
- if (f->discont) {
- p = ngx_slprintf(p, end, "#EXT-X-DISCONTINUITY\n");
- }
-
- if (hacf->keys && (i == 0 || f->key_id != prev_key_id)) {
- p = ngx_slprintf(p, end, "#EXT-X-KEY:METHOD=AES-128,"
- "URI=\"%V%V%s%uL.key\",IV=0x%032XL\n",
- &hacf->key_url, &key_name_part,
- key_sep, f->key_id, f->key_id);
- }
-
- prev_key_id = f->key_id;
-
- p = ngx_slprintf(p, end,
+ p = ngx_snprintf(buffer, sizeof(buffer),
+ "%s"
"#EXTINF:%.3f,\n"
"%V%V%s%uL.ts\n",
+ f->discont ? "#EXT-X-DISCONTINUITY\n" : "",
f->duration, &hacf->base_url, &name_part, sep, f->id);
ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@@ -821,16 +746,17 @@
ngx_rtmp_hls_ctx_t *ctx;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
- if (ctx == NULL || !ctx->opened) {
+ if (!ctx->opened) {
return NGX_OK;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
"hls: close fragment n=%uL", ctx->frag);
- ngx_rtmp_mpegts_close_file(&ctx->file);
+ ngx_close_file(ctx->file.fd);
ctx->opened = 0;
+ ctx->file.fd = NGX_INVALID_FILE;
ngx_rtmp_hls_next_frag(s);
@@ -844,109 +770,43 @@
ngx_rtmp_hls_open_fragment(ngx_rtmp_session_t *s, uint64_t ts,
ngx_int_t discont)
{
- uint64_t id;
- ngx_fd_t fd;
- ngx_uint_t g;
- ngx_rtmp_hls_ctx_t *ctx;
- ngx_rtmp_hls_frag_t *f;
- ngx_rtmp_hls_app_conf_t *hacf;
+ ngx_rtmp_hls_ctx_t *ctx;
+ ngx_rtmp_hls_frag_t *f;
+ uint64_t id;
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
-
if (ctx->opened) {
return NGX_OK;
}
- hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
-
- if (ngx_rtmp_hls_ensure_directory(s, &hacf->path) != NGX_OK) {
- return NGX_ERROR;
- }
-
- if (hacf->keys &&
- ngx_rtmp_hls_ensure_directory(s, &hacf->key_path) != NGX_OK)
- {
- return NGX_ERROR;
- }
-
id = ngx_rtmp_hls_get_fragment_id(s, ts);
- if (hacf->granularity) {
- g = (ngx_uint_t) hacf->granularity;
- id = (uint64_t) (id / g) * g;
- }
+ *ngx_sprintf(ctx->stream.data + ctx->stream.len, "%uL.ts", id) = 0;
- ngx_sprintf(ctx->stream.data + ctx->stream.len, "%uL.ts%Z", id);
+ ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
+ "hls: open fragment file='%s', frag=%uL, n=%ui, time=%uL, "
+ "discont=%i",
+ ctx->stream.data, ctx->frag, ctx->nfrags, ts, discont);
- if (hacf->keys) {
- if (ctx->key_frags == 0) {
+ ngx_memzero(&ctx->file, sizeof(ctx->file));
- ctx->key_frags = hacf->frags_per_key - 1;
- ctx->key_id = id;
+ ctx->file.log = s->connection->log;
- if (RAND_bytes(ctx->key, 16) < 0) {
- ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
- "hls: failed to create key");
- return NGX_ERROR;
- }
-
- ngx_sprintf(ctx->keyfile.data + ctx->keyfile.len, "%uL.key%Z", id);
-
- fd = ngx_open_file(ctx->keyfile.data, NGX_FILE_WRONLY,
- NGX_FILE_TRUNCATE, NGX_FILE_DEFAULT_ACCESS);
+ ngx_str_set(&ctx->file.name, "hls");
- if (fd == NGX_INVALID_FILE) {
- ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: failed to open key file '%s'",
- ctx->keyfile.data);
- return NGX_ERROR;
- }
-
- if (ngx_write_fd(fd, ctx->key, 16) != 16) {
- ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: failed to write key file '%s'",
- ctx->keyfile.data);
- ngx_close_file(fd);
- return NGX_ERROR;
- }
+ ctx->file.fd = ngx_open_file(ctx->stream.data, NGX_FILE_WRONLY,
+ NGX_FILE_TRUNCATE, NGX_FILE_DEFAULT_ACCESS);
- ngx_close_file(fd);
-
- } else {
- if (hacf->frags_per_key) {
- ctx->key_frags--;
- }
-
- if (ngx_set_file_time(ctx->keyfile.data, 0, ngx_cached_time->sec)
- != NGX_OK)
- {
- ngx_log_error(NGX_LOG_ALERT, s->connection->log, ngx_errno,
- ngx_set_file_time_n " '%s' failed",
- ctx->keyfile.data);
- }
- }
- }
-
- ngx_log_debug6(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "hls: open fragment file='%s', keyfile='%s', "
- "frag=%uL, n=%ui, time=%uL, discont=%i",
- ctx->stream.data,
- ctx->keyfile.data ? ctx->keyfile.data : (u_char *) "",
- ctx->frag, ctx->nfrags, ts, discont);
-
- if (hacf->keys &&
- ngx_rtmp_mpegts_init_encryption(&ctx->file, ctx->key, 16, ctx->key_id)
- != NGX_OK)
- {
- ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
- "hls: failed to initialize hls encryption");
+ if (ctx->file.fd == NGX_INVALID_FILE) {
+ ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
+ "hls: error creating fragment file");
return NGX_ERROR;
}
- if (ngx_rtmp_mpegts_open_file(&ctx->file, ctx->stream.data,
- s->connection->log)
- != NGX_OK)
- {
+ if (ngx_rtmp_mpegts_write_header(&ctx->file) != NGX_OK) {
+ ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
+ "hls: error writing fragment header");
+ ngx_close_file(ctx->file.fd);
return NGX_ERROR;
}
@@ -959,7 +819,6 @@
f->active = 1;
f->discont = discont;
f->id = id;
- f->key_id = ctx->key_id;
ctx->frag_ts = ts;
@@ -978,11 +837,11 @@
ngx_file_t file;
ssize_t ret;
off_t offset;
- u_char *p, *last, *end, *next, *pa, *pp, c;
+ u_char *p, *last, *end, *next, *pa;
ngx_rtmp_hls_frag_t *f;
double duration;
ngx_int_t discont;
- uint64_t mag, key_id, base;
+ uint64_t mag;
static u_char buffer[4096];
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
@@ -1004,7 +863,6 @@
f = NULL;
duration = 0;
discont = 0;
- key_id = 0;
for ( ;; ) {
@@ -1048,54 +906,6 @@
}
-#define NGX_RTMP_XKEY "#EXT-X-KEY:"
-#define NGX_RTMP_XKEY_LEN (sizeof(NGX_RTMP_XKEY) - 1)
-
- if (ngx_memcmp(p, NGX_RTMP_XKEY, NGX_RTMP_XKEY_LEN) == 0) {
-
- /* recover key id from initialization vector */
-
- key_id = 0;
- base = 1;
- pp = last - 1;
-
- for ( ;; ) {
- if (pp < p) {
- ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
- "hls: failed to read key id");
- break;
- }
-
- c = *pp;
- if (c == 'x') {
- break;
- }
-
- if (c >= '0' && c <= '9') {
- c -= '0';
- goto next;
- }
-
- c |= 0x20;
-
- if (c >= 'a' && c <= 'f') {
- c -= 'a' - 10;
- goto next;
- }
-
- ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
- "hls: bad character in key id");
- break;
-
- next:
-
- key_id += base * c;
- base *= 0x10;
- pp--;
- }
- }
-
-
#define NGX_RTMP_EXTINF "#EXTINF:"
#define NGX_RTMP_EXTINF_LEN (sizeof(NGX_RTMP_EXTINF) - 1)
@@ -1146,8 +956,6 @@
mag *= 10;
}
- f->key_id = key_id;
-
ngx_rtmp_hls_next_frag(s);
ngx_log_debug6(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
@@ -1167,53 +975,51 @@
static ngx_int_t
-ngx_rtmp_hls_ensure_directory(ngx_rtmp_session_t *s, ngx_str_t *path)
+ngx_rtmp_hls_ensure_directory(ngx_rtmp_session_t *s)
{
size_t len;
ngx_file_info_t fi;
ngx_rtmp_hls_ctx_t *ctx;
ngx_rtmp_hls_app_conf_t *hacf;
- static u_char zpath[NGX_MAX_PATH + 1];
+ static u_char path[NGX_MAX_PATH + 1];
hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
- if (path->len + 1 > sizeof(zpath)) {
- ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, "hls: too long path");
- return NGX_ERROR;
- }
-
- ngx_snprintf(zpath, sizeof(zpath), "%V%Z", path);
+ *ngx_snprintf(path, sizeof(path) - 1, "%V", &hacf->path) = 0;
- if (ngx_file_info(zpath, &fi) == NGX_FILE_ERROR) {
+ if (ngx_file_info(path, &fi) == NGX_FILE_ERROR) {
if (ngx_errno != NGX_ENOENT) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: " ngx_file_info_n " failed on '%V'", path);
+ "hls: " ngx_file_info_n " failed on '%V'",
+ &hacf->path);
return NGX_ERROR;
}
/* ENOENT */
- if (ngx_create_dir(zpath, NGX_RTMP_HLS_DIR_ACCESS) == NGX_FILE_ERROR) {
+ if (ngx_create_dir(path, NGX_RTMP_HLS_DIR_ACCESS) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: " ngx_create_dir_n " failed on '%V'", path);
+ "hls: " ngx_create_dir_n " failed on '%V'",
+ &hacf->path);
return NGX_ERROR;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "hls: directory '%V' created", path);
+ "hls: directory '%V' created", &hacf->path);
} else {
if (!ngx_is_dir(&fi)) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
- "hls: '%V' exists and is not a directory", path);
+ "hls: '%V' exists and is not a directory",
+ &hacf->path);
return NGX_ERROR;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "hls: directory '%V' exists", path);
+ "hls: directory '%V' exists", &hacf->path);
}
if (!hacf->nested) {
@@ -1222,49 +1028,44 @@
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
- len = path->len;
- if (path->data[len - 1] == '/') {
+ len = hacf->path.len;
+ if (hacf->path.data[len - 1] == '/') {
len--;
}
- if (len + 1 + ctx->name.len + 1 > sizeof(zpath)) {
- ngx_log_error(NGX_LOG_ERR, s->connection->log, 0, "hls: too long path");
- return NGX_ERROR;
- }
-
- ngx_snprintf(zpath, sizeof(zpath) - 1, "%*s/%V%Z", len, path->data,
- &ctx->name);
+ *ngx_snprintf(path, sizeof(path) - 1, "%*s/%V", len, hacf->path.data,
+ &ctx->name) = 0;
- if (ngx_file_info(zpath, &fi) != NGX_FILE_ERROR) {
+ if (ngx_file_info(path, &fi) != NGX_FILE_ERROR) {
if (ngx_is_dir(&fi)) {
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "hls: directory '%s' exists", zpath);
+ "hls: directory '%s' exists", path);
return NGX_OK;
}
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
- "hls: '%s' exists and is not a directory", zpath);
+ "hls: '%s' exists and is not a directory", path);
return NGX_ERROR;
}
if (ngx_errno != NGX_ENOENT) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: " ngx_file_info_n " failed on '%s'", zpath);
+ "hls: " ngx_file_info_n " failed on '%s'", path);
return NGX_ERROR;
}
/* NGX_ENOENT */
- if (ngx_create_dir(zpath, NGX_RTMP_HLS_DIR_ACCESS) == NGX_FILE_ERROR) {
+ if (ngx_create_dir(path, NGX_RTMP_HLS_DIR_ACCESS) == NGX_FILE_ERROR) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, ngx_errno,
- "hls: " ngx_create_dir_n " failed on '%s'", zpath);
+ "hls: " ngx_create_dir_n " failed on '%s'", path);
return NGX_ERROR;
}
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "hls: directory '%s' created", zpath);
+ "hls: directory '%s' created", path);
return NGX_OK;
}
@@ -1435,40 +1236,18 @@
*p = 0;
- /* key path */
-
- if (hacf->keys) {
- len = hacf->key_path.len + 1 + ctx->name.len + 1 + NGX_INT64_LEN
- + sizeof(".key");
-
- ctx->keyfile.data = ngx_palloc(s->connection->pool, len);
- if (ctx->keyfile.data == NULL) {
- return NGX_ERROR;
- }
-
- p = ngx_cpymem(ctx->keyfile.data, hacf->key_path.data,
- hacf->key_path.len);
-
- if (p[-1] != '/') {
- *p++ = '/';
- }
-
- p = ngx_cpymem(p, ctx->name.data, ctx->name.len);
- *p++ = (hacf->nested ? '/' : '-');
-
- ctx->keyfile.len = p - ctx->keyfile.data;
- }
-
- ngx_log_debug4(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "hls: playlist='%V' playlist_bak='%V' "
- "stream_pattern='%V' keyfile_pattern='%V'",
- &ctx->playlist, &ctx->playlist_bak,
- &ctx->stream, &ctx->keyfile);
+ ngx_log_debug3(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
+ "hls: playlist='%V' playlist_bak='%V' stream_pattern='%V'",
+ &ctx->playlist, &ctx->playlist_bak, &ctx->stream);
if (hacf->continuous) {
ngx_rtmp_hls_restore_stream(s);
}
+ if (ngx_rtmp_hls_ensure_directory(s) != NGX_OK) {
+ return NGX_ERROR;
+ }
+
next:
return next_publish(s, v);
}
@@ -1566,15 +1345,13 @@
ngx_rtmp_hls_app_conf_t *hacf;
ngx_rtmp_hls_frag_t *f;
ngx_msec_t ts_frag_len;
- ngx_int_t same_frag, force,discont;
+ ngx_int_t same_frag;
ngx_buf_t *b;
int64_t d;
hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
f = NULL;
- force = 0;
- discont = 1;
if (ctx->opened) {
f = ngx_rtmp_hls_get_frag(s, ctx->nfrags);
@@ -1582,12 +1359,12 @@
if (d > (int64_t) hacf->max_fraglen * 90 || d < -90000) {
ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
- "hls: force fragment split: %.3f sec, ", d / 90000.);
- force = 1;
+ "hls: max fragment length reached: %.3f sec, ",
+ f->duration);
+ boundary = 1;
} else {
f->duration = (ts - ctx->frag_ts) / 90000.;
- discont = 0;
}
}
@@ -1615,9 +1392,9 @@
break;
}
- if (boundary || force) {
+ if (boundary) {
ngx_rtmp_hls_close_fragment(s);
- ngx_rtmp_hls_open_fragment(s, ts, discont);
+ ngx_rtmp_hls_open_fragment(s, ts, !f);
}
b = ctx->aframe;
@@ -1640,7 +1417,7 @@
ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);
- if (ctx == NULL || !ctx->opened) {
+ if (!ctx->opened) {
return NGX_OK;
}
@@ -2176,13 +1953,6 @@
{
max_age = playlen / 1000;
- } else if (name.len >= 4 && name.data[name.len - 4] == '.' &&
- name.data[name.len - 3] == 'k' &&
- name.data[name.len - 2] == 'e' &&
- name.data[name.len - 1] == 'y')
- {
- max_age = playlen / 500;
-
} else {
ngx_log_debug1(NGX_LOG_DEBUG_RTMP, ngx_cycle->log, 0,
"hls: cleanup skip unknown file type '%V'", &name);
@@ -2210,22 +1980,14 @@
}
-#if (nginx_version >= 1011005)
-static ngx_msec_t
-#else
static time_t
-#endif
ngx_rtmp_hls_cleanup(void *data)
{
ngx_rtmp_hls_cleanup_t *cleanup = data;
ngx_rtmp_hls_cleanup_dir(&cleanup->path, cleanup->playlen);
-#if (nginx_version >= 1011005)
- return cleanup->playlen * 2;
-#else
return cleanup->playlen / 500;
-#endif
}
@@ -2305,9 +2067,6 @@
conf->max_audio_delay = NGX_CONF_UNSET_MSEC;
conf->audio_buffer_size = NGX_CONF_UNSET_SIZE;
conf->cleanup = NGX_CONF_UNSET;
- conf->granularity = NGX_CONF_UNSET;
- conf->keys = NGX_CONF_UNSET;
- conf->frags_per_key = NGX_CONF_UNSET_UINT;
return conf;
}
@@ -2341,11 +2100,6 @@
NGX_RTMP_HLS_BUFSIZE);
ngx_conf_merge_value(conf->cleanup, prev->cleanup, 1);
ngx_conf_merge_str_value(conf->base_url, prev->base_url, "");
- ngx_conf_merge_value(conf->granularity, prev->granularity, 0);
- ngx_conf_merge_value(conf->keys, prev->keys, 0);
- ngx_conf_merge_str_value(conf->key_path, prev->key_path, "");
- ngx_conf_merge_str_value(conf->key_url, prev->key_url, "");
- ngx_conf_merge_uint_value(conf->frags_per_key, prev->frags_per_key, 0);
if (conf->fraglen) {
conf->winfrags = conf->playlen / conf->fraglen;
@@ -2386,44 +2140,6 @@
ngx_conf_merge_str_value(conf->path, prev->path, "");
- if (conf->keys && conf->cleanup && conf->key_path.len &&
- ngx_strcmp(conf->key_path.data, conf->path.data) != 0 &&
- conf->type != NGX_RTMP_HLS_TYPE_EVENT)
- {
- if (conf->key_path.data[conf->key_path.len - 1] == '/') {
- conf->key_path.len--;
- }
-
- cleanup = ngx_pcalloc(cf->pool, sizeof(*cleanup));
- if (cleanup == NULL) {
- return NGX_CONF_ERROR;
- }
-
- cleanup->path = conf->key_path;
- cleanup->playlen = conf->playlen;
-
- conf->slot = ngx_pcalloc(cf->pool, sizeof(*conf->slot));
- if (conf->slot == NULL) {
- return NGX_CONF_ERROR;
- }
-
- conf->slot->manager = ngx_rtmp_hls_cleanup;
- conf->slot->name = conf->key_path;
- conf->slot->data = cleanup;
- conf->slot->conf_file = cf->conf_file->file.name.data;
- conf->slot->line = cf->conf_file->line;
-
- if (ngx_add_path(cf, &conf->slot) != NGX_OK) {
- return NGX_CONF_ERROR;
- }
- }
-
- ngx_conf_merge_str_value(conf->key_path, prev->key_path, "");
-
- if (conf->key_path.len == 0) {
- conf->key_path = conf->path;
- }
-
return NGX_CONF_OK;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/hls/ngx_rtmp_mpegts.c
^
|
@@ -75,90 +75,15 @@
#define NGX_RTMP_HLS_DELAY 63000
-static ngx_int_t
-ngx_rtmp_mpegts_write_file(ngx_rtmp_mpegts_file_t *file, u_char *in,
- size_t in_size)
+ngx_int_t
+ngx_rtmp_mpegts_write_header(ngx_file_t *file)
{
- u_char *out;
- size_t out_size, n;
- ssize_t rc;
-
- static u_char buf[1024];
-
- if (!file->encrypt) {
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
- "mpegts: write %uz bytes", in_size);
-
- rc = ngx_write_fd(file->fd, in, in_size);
- if (rc < 0) {
- return NGX_ERROR;
- }
-
- return NGX_OK;
- }
-
- /* encrypt */
-
- ngx_log_debug1(NGX_LOG_DEBUG_CORE, file->log, 0,
- "mpegts: write %uz encrypted bytes", in_size);
+ ssize_t rc;
- out = buf;
- out_size = sizeof(buf);
-
- if (file->size > 0 && file->size + in_size >= 16) {
- ngx_memcpy(file->buf + file->size, in, 16 - file->size);
-
- in += 16 - file->size;
- in_size -= 16 - file->size;
-
- AES_cbc_encrypt(file->buf, out, 16, &file->key, file->iv, AES_ENCRYPT);
-
- out += 16;
- out_size -= 16;
-
- file->size = 0;
- }
-
- for ( ;; ) {
- n = in_size & ~0x0f;
-
- if (n > 0) {
- if (n > out_size) {
- n = out_size;
- }
+ rc = ngx_write_file(file, ngx_rtmp_mpegts_header,
+ sizeof(ngx_rtmp_mpegts_header), 0);
- AES_cbc_encrypt(in, out, n, &file->key, file->iv, AES_ENCRYPT);
-
- in += n;
- in_size -= n;
-
- } else if (out == buf) {
- break;
- }
-
- rc = ngx_write_fd(file->fd, buf, out - buf + n);
- if (rc < 0) {
- return NGX_ERROR;
- }
-
- out = buf;
- out_size = sizeof(buf);
- }
-
- if (in_size) {
- ngx_memcpy(file->buf + file->size, in, in_size);
- file->size += in_size;
- }
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_rtmp_mpegts_write_header(ngx_rtmp_mpegts_file_t *file)
-{
- return ngx_rtmp_mpegts_write_file(file, ngx_rtmp_mpegts_header,
- sizeof(ngx_rtmp_mpegts_header));
+ return rc > 0 ? NGX_OK : rc;
}
@@ -197,14 +122,14 @@
ngx_int_t
-ngx_rtmp_mpegts_write_frame(ngx_rtmp_mpegts_file_t *file,
- ngx_rtmp_mpegts_frame_t *f, ngx_buf_t *b)
+ngx_rtmp_mpegts_write_frame(ngx_file_t *file, ngx_rtmp_mpegts_frame_t *f,
+ ngx_buf_t *b)
{
ngx_uint_t pes_size, header_size, body_size, in_size, stuff_size, flags;
u_char packet[188], *p, *base;
ngx_int_t first, rc;
- ngx_log_debug6(NGX_LOG_DEBUG_CORE, file->log, 0,
+ ngx_log_debug6(NGX_LOG_DEBUG_HTTP, file->log, 0,
"mpegts: pid=%ui, sid=%ui, pts=%uL, "
"dts=%uL, key=%ui, size=%ui",
f->pid, f->sid, f->pts, f->dts,
@@ -313,87 +238,11 @@
b->pos = b->last;
}
- rc = ngx_rtmp_mpegts_write_file(file, packet, sizeof(packet));
- if (rc != NGX_OK) {
- return rc;
- }
- }
-
- return NGX_OK;
-}
-
-
-ngx_int_t
-ngx_rtmp_mpegts_init_encryption(ngx_rtmp_mpegts_file_t *file,
- u_char *key, size_t key_len, uint64_t iv)
-{
- if (AES_set_encrypt_key(key, key_len * 8, &file->key)) {
- return NGX_ERROR;
- }
-
- ngx_memzero(file->iv, 8);
-
- file->iv[8] = (u_char) (iv >> 56);
- file->iv[9] = (u_char) (iv >> 48);
- file->iv[10] = (u_char) (iv >> 40);
- file->iv[11] = (u_char) (iv >> 32);
- file->iv[12] = (u_char) (iv >> 24);
- file->iv[13] = (u_char) (iv >> 16);
- file->iv[14] = (u_char) (iv >> 8);
- file->iv[15] = (u_char) (iv);
-
- file->encrypt = 1;
-
- return NGX_OK;
-}
-
-
-ngx_int_t
-ngx_rtmp_mpegts_open_file(ngx_rtmp_mpegts_file_t *file, u_char *path,
- ngx_log_t *log)
-{
- file->log = log;
-
- file->fd = ngx_open_file(path, NGX_FILE_WRONLY, NGX_FILE_TRUNCATE,
- NGX_FILE_DEFAULT_ACCESS);
-
- if (file->fd == NGX_INVALID_FILE) {
- ngx_log_error(NGX_LOG_ERR, log, ngx_errno,
- "hls: error creating fragment file");
- return NGX_ERROR;
- }
-
- file->size = 0;
-
- if (ngx_rtmp_mpegts_write_header(file) != NGX_OK) {
- ngx_log_error(NGX_LOG_ERR, log, ngx_errno,
- "hls: error writing fragment header");
- ngx_close_file(file->fd);
- return NGX_ERROR;
- }
-
- return NGX_OK;
-}
-
-
-ngx_int_t
-ngx_rtmp_mpegts_close_file(ngx_rtmp_mpegts_file_t *file)
-{
- u_char buf[16];
- ssize_t rc;
-
- if (file->encrypt) {
- ngx_memset(file->buf + file->size, 16 - file->size, 16 - file->size);
-
- AES_cbc_encrypt(file->buf, buf, 16, &file->key, file->iv, AES_ENCRYPT);
-
- rc = ngx_write_fd(file->fd, buf, 16);
+ rc = ngx_write_file(file, packet, sizeof(packet), file->offset);
if (rc < 0) {
- return NGX_ERROR;
+ return rc;
}
}
- ngx_close_file(file->fd);
-
return NGX_OK;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/hls/ngx_rtmp_mpegts.h
^
|
@@ -10,18 +10,6 @@
#include <ngx_config.h>
#include <ngx_core.h>
-#include <openssl/aes.h>
-
-
-typedef struct {
- ngx_fd_t fd;
- ngx_log_t *log;
- unsigned encrypt:1;
- unsigned size:4;
- u_char buf[16];
- u_char iv[16];
- AES_KEY key;
-} ngx_rtmp_mpegts_file_t;
typedef struct {
@@ -34,13 +22,9 @@
} ngx_rtmp_mpegts_frame_t;
-ngx_int_t ngx_rtmp_mpegts_init_encryption(ngx_rtmp_mpegts_file_t *file,
- u_char *key, size_t key_len, uint64_t iv);
-ngx_int_t ngx_rtmp_mpegts_open_file(ngx_rtmp_mpegts_file_t *file, u_char *path,
- ngx_log_t *log);
-ngx_int_t ngx_rtmp_mpegts_close_file(ngx_rtmp_mpegts_file_t *file);
-ngx_int_t ngx_rtmp_mpegts_write_frame(ngx_rtmp_mpegts_file_t *file,
- ngx_rtmp_mpegts_frame_t *f, ngx_buf_t *b);
+ngx_int_t ngx_rtmp_mpegts_write_header(ngx_file_t *file);
+ngx_int_t ngx_rtmp_mpegts_write_frame(ngx_file_t *file,
+ ngx_rtmp_mpegts_frame_t *f, ngx_buf_t *b);
#endif /* _NGX_RTMP_MPEGTS_H_INCLUDED_ */
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp.c
^
|
@@ -29,16 +29,9 @@
static char * ngx_rtmp_merge_applications(ngx_conf_t *cf,
ngx_array_t *applications, void **app_conf, ngx_rtmp_module_t *module,
ngx_uint_t ctx_index);
-static ngx_int_t ngx_rtmp_init_process(ngx_cycle_t *cycle);
-#if (nginx_version >= 1007011)
-ngx_queue_t ngx_rtmp_init_queue;
-#elif (nginx_version >= 1007005)
-ngx_thread_volatile ngx_queue_t ngx_rtmp_init_queue;
-#else
ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue;
-#endif
ngx_uint_t ngx_rtmp_max_module;
@@ -71,7 +64,7 @@
NGX_CORE_MODULE, /* module type */
NULL, /* init master */
NULL, /* init module */
- ngx_rtmp_init_process, /* init process */
+ NULL, /* init process */
NULL, /* init thread */
NULL, /* exit thread */
NULL, /* exit process */
@@ -87,7 +80,6 @@
ngx_uint_t i, m, mi, s;
ngx_conf_t pcf;
ngx_array_t ports;
- ngx_module_t **modules;
ngx_rtmp_listen_t *listen;
ngx_rtmp_module_t *module;
ngx_rtmp_conf_ctx_t *ctx;
@@ -103,12 +95,6 @@
/* count the number of the rtmp modules and set up their indices */
-#if (nginx_version >= 1009011)
-
- ngx_rtmp_max_module = ngx_count_modules(cf->cycle, NGX_RTMP_MODULE);
-
-#else
-
ngx_rtmp_max_module = 0;
for (m = 0; ngx_modules[m]; m++) {
if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
@@ -118,8 +104,6 @@
ngx_modules[m]->ctx_index = ngx_rtmp_max_module++;
}
-#endif
-
/* the rtmp main_conf context, it is the same in the all rtmp contexts */
@@ -157,19 +141,13 @@
* of the all rtmp modules
*/
-#if (nginx_version >= 1009011)
- modules = cf->cycle->modules;
-#else
- modules = ngx_modules;
-#endif
-
- for (m = 0; modules[m]; m++) {
- if (modules[m]->type != NGX_RTMP_MODULE) {
+ for (m = 0; ngx_modules[m]; m++) {
+ if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
continue;
}
- module = modules[m]->ctx;
- mi = modules[m]->ctx_index;
+ module = ngx_modules[m]->ctx;
+ mi = ngx_modules[m]->ctx_index;
if (module->create_main_conf) {
ctx->main_conf[mi] = module->create_main_conf(cf);
@@ -196,12 +174,12 @@
pcf = *cf;
cf->ctx = ctx;
- for (m = 0; modules[m]; m++) {
- if (modules[m]->type != NGX_RTMP_MODULE) {
+ for (m = 0; ngx_modules[m]; m++) {
+ if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
continue;
}
- module = modules[m]->ctx;
+ module = ngx_modules[m]->ctx;
if (module->preconfiguration) {
if (module->preconfiguration(cf) != NGX_OK) {
@@ -227,13 +205,13 @@
cmcf = ctx->main_conf[ngx_rtmp_core_module.ctx_index];
cscfp = cmcf->servers.elts;
- for (m = 0; modules[m]; m++) {
- if (modules[m]->type != NGX_RTMP_MODULE) {
+ for (m = 0; ngx_modules[m]; m++) {
+ if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
continue;
}
- module = modules[m]->ctx;
- mi = modules[m]->ctx_index;
+ module = ngx_modules[m]->ctx;
+ mi = ngx_modules[m]->ctx_index;
/* init rtmp{} main_conf's */
@@ -298,12 +276,12 @@
return NGX_CONF_ERROR;
}
- for (m = 0; modules[m]; m++) {
- if (modules[m]->type != NGX_RTMP_MODULE) {
+ for (m = 0; ngx_modules[m]; m++) {
+ if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
continue;
}
- module = modules[m]->ctx;
+ module = ngx_modules[m]->ctx;
if (module->postconfiguration) {
if (module->postconfiguration(cf) != NGX_OK) {
@@ -566,7 +544,6 @@
addr->bind = listen->bind;
addr->wildcard = listen->wildcard;
addr->so_keepalive = listen->so_keepalive;
- addr->proxy_protocol = listen->proxy_protocol;
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
addr->tcp_keepidle = listen->tcp_keepidle;
addr->tcp_keepintvl = listen->tcp_keepintvl;
@@ -725,7 +702,6 @@
addrs[i].conf.addr_text.len = len;
addrs[i].conf.addr_text.data = p;
- addrs[i].conf.proxy_protocol = addr->proxy_protocol;
}
return NGX_OK;
@@ -775,7 +751,6 @@
addrs6[i].conf.addr_text.len = len;
addrs6[i].conf.addr_text.data = p;
- addrs6[i].conf.proxy_protocol = addr->proxy_protocol;
}
return NGX_OK;
@@ -849,13 +824,3 @@
return dst;
}
-
-
-static ngx_int_t
-ngx_rtmp_init_process(ngx_cycle_t *cycle)
-{
-#if (nginx_version >= 1007005)
- ngx_queue_init(&ngx_rtmp_init_queue);
-#endif
- return NGX_OK;
-}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp.h
^
|
@@ -12,7 +12,6 @@
#include <ngx_core.h>
#include <ngx_event.h>
#include <ngx_event_connect.h>
-#include <nginx.h>
#include "ngx_rtmp_amf.h"
#include "ngx_rtmp_bandwidth.h"
@@ -44,7 +43,6 @@
unsigned ipv6only:2;
#endif
unsigned so_keepalive:2;
- unsigned proxy_protocol:1;
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
int tcp_keepidle;
int tcp_keepintvl;
@@ -56,7 +54,6 @@
typedef struct {
ngx_rtmp_conf_ctx_t *ctx;
ngx_str_t addr_text;
- unsigned proxy_protocol:1;
} ngx_rtmp_addr_conf_t;
typedef struct {
@@ -100,7 +97,6 @@
unsigned ipv6only:2;
#endif
unsigned so_keepalive:2;
- unsigned proxy_protocol:1;
#if (NGX_HAVE_KEEPALIVE_TUNABLE)
int tcp_keepidle;
int tcp_keepintvl;
@@ -199,11 +195,7 @@
ngx_str_t *addr_text;
int connected;
-#if (nginx_version >= 1007005)
- ngx_queue_t posted_dry_events;
-#else
ngx_event_t *posted_dry_events;
-#endif
/* client buffer time in msec */
uint32_t buflen;
@@ -326,7 +318,6 @@
ngx_flag_t busy;
size_t out_queue;
size_t out_cork;
- ngx_msec_t buflen;
ngx_rtmp_conf_ctx_t *ctx;
} ngx_rtmp_core_srv_conf_t;
@@ -607,13 +598,7 @@
extern ngx_uint_t ngx_rtmp_naccepted;
-#if (nginx_version >= 1007011)
-extern ngx_queue_t ngx_rtmp_init_queue;
-#elif (nginx_version >= 1007005)
-extern ngx_thread_volatile ngx_queue_t ngx_rtmp_init_queue;
-#else
extern ngx_thread_volatile ngx_event_t *ngx_rtmp_init_queue;
-#endif
extern ngx_uint_t ngx_rtmp_max_module;
extern ngx_module_t ngx_rtmp_core_module;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_amf.c
^
|
@@ -197,15 +197,8 @@
}
#endif
/* read key */
- switch (ngx_rtmp_amf_get(ctx, buf, 2)) {
- case NGX_DONE:
- /* Envivio sends unfinalized arrays */
- return NGX_OK;
- case NGX_OK:
- break;
- default:
+ if (ngx_rtmp_amf_get(ctx, buf, 2) != NGX_OK)
return NGX_ERROR;
- }
ngx_rtmp_amf_reverse_copy(&len, buf, 2);
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_auto_push_module.c
^
|
@@ -93,34 +93,6 @@
};
-static ngx_rtmp_module_t ngx_rtmp_auto_push_index_module_ctx = {
- NULL, /* preconfiguration */
- NULL, /* postconfiguration */
- NULL, /* create main configuration */
- NULL, /* init main configuration */
- NULL, /* create server configuration */
- NULL, /* merge server configuration */
- NULL, /* create app configuration */
- NULL /* merge app configuration */
-};
-
-
-ngx_module_t ngx_rtmp_auto_push_index_module = {
- NGX_MODULE_V1,
- &ngx_rtmp_auto_push_index_module_ctx, /* module context */
- NULL, /* module directives */
- NGX_RTMP_MODULE, /* module type */
- NULL, /* init master */
- NULL, /* init module */
- NULL, /* init process */
- NULL, /* init thread */
- NULL, /* exit thread */
- NULL, /* exit process */
- NULL, /* exit master */
- NGX_MODULE_V1_PADDING
-};
-
-
#define NGX_RTMP_AUTO_PUSH_SOCKNAME "nginx-rtmp"
@@ -352,7 +324,7 @@
apcf = (ngx_rtmp_auto_push_conf_t *) ngx_get_conf(ngx_cycle->conf_ctx,
ngx_rtmp_auto_push_module);
- ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_index_module);
+ ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_module);
if (ctx == NULL) {
return;
}
@@ -489,14 +461,14 @@
goto next;
}
- ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_index_module);
+ ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_module);
if (ctx == NULL) {
ctx = ngx_palloc(s->connection->pool,
sizeof(ngx_rtmp_auto_push_ctx_t));
if (ctx == NULL) {
goto next;
}
- ngx_rtmp_set_ctx(s, ctx, ngx_rtmp_auto_push_index_module);
+ ngx_rtmp_set_ctx(s, ctx, ngx_rtmp_auto_push_module);
}
ngx_memzero(ctx, sizeof(*ctx));
@@ -536,7 +508,7 @@
goto next;
}
- ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_index_module);
+ ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_auto_push_module);
if (ctx) {
if (ctx->push_evt.timer_set) {
ngx_del_timer(&ctx->push_evt);
@@ -560,7 +532,7 @@
slot, &rctx->app, &rctx->name);
pctx = ngx_rtmp_get_module_ctx(rctx->publish->session,
- ngx_rtmp_auto_push_index_module);
+ ngx_rtmp_auto_push_module);
if (pctx == NULL) {
goto next;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_cmd_module.c
^
|
@@ -626,12 +626,6 @@
"play2: name='%s' args='%s' start=%i",
v.name, v.args, (ngx_int_t) v.start);
- /* continue from current timestamp */
-
- if (v.start < 0) {
- v.start = s->current_time;
- }
-
ngx_memzero(&vc, sizeof(vc));
/* close_stream should be synchronous */
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_control_module.c
^
|
@@ -102,6 +102,37 @@
};
+static ngx_int_t
+ngx_rtmp_control_output_error(ngx_http_request_t *r, const char *msg)
+{
+ size_t len;
+ ngx_buf_t *b;
+ ngx_chain_t cl;
+
+ len = ngx_strlen(msg);
+
+ r->headers_out.status = NGX_HTTP_BAD_REQUEST;
+ r->headers_out.content_length_n = len;
+
+ b = ngx_calloc_buf(r->pool);
+ if (b == NULL) {
+ return NGX_ERROR;
+ }
+
+ ngx_memzero(&cl, sizeof(cl));
+ cl.buf = b;
+
+ b->start = b->pos = (u_char *) msg;
+ b->end = b->last = (u_char *) msg + len;
+ b->memory = 1;
+ b->last_buf = 1;
+
+ ngx_http_send_header(r);
+
+ return ngx_http_output_filter(r, &cl);
+}
+
+
static const char *
ngx_rtmp_control_record_handler(ngx_http_request_t *r, ngx_rtmp_session_t *s)
{
@@ -153,7 +184,7 @@
{
ngx_rtmp_control_ctx_t *ctx;
- ctx = ngx_http_get_module_ctx(r, ngx_rtmp_control_module);
+ ctx = ngx_http_get_module_ctx(s, ngx_rtmp_control_module);
ngx_rtmp_finalize_session(s);
@@ -228,7 +259,7 @@
ngx_rtmp_control_walk_session(ngx_http_request_t *r,
ngx_rtmp_live_ctx_t *lctx)
{
- ngx_str_t addr, *paddr, clientid;
+ ngx_str_t addr, *paddr;
ngx_rtmp_session_t *s, **ss;
ngx_rtmp_control_ctx_t *ctx;
@@ -249,17 +280,6 @@
}
}
- if (ngx_http_arg(r, (u_char *) "clientid", sizeof("clientid") - 1,
- &clientid)
- == NGX_OK)
- {
- if (s->connection->number !=
- (ngx_uint_t) ngx_atoi(clientid.data, clientid.len))
- {
- return NGX_CONF_OK;
- }
- }
-
ctx = ngx_http_get_module_ctx(r, ngx_rtmp_control_module);
switch (ctx->filter) {
@@ -444,10 +464,6 @@
goto error;
}
- if (ctx->path.len == 0) {
- return NGX_HTTP_NO_CONTENT;
- }
-
/* output record path */
r->headers_out.status = NGX_HTTP_OK;
@@ -455,7 +471,7 @@
b = ngx_create_temp_buf(r->pool, ctx->path.len);
if (b == NULL) {
- goto error;
+ return NGX_ERROR;
}
ngx_memzero(&cl, sizeof(cl));
@@ -469,7 +485,7 @@
return ngx_http_output_filter(r, &cl);
error:
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ return ngx_rtmp_control_output_error(r, msg);
}
@@ -527,7 +543,7 @@
b = ngx_calloc_buf(r->pool);
if (b == NULL) {
- goto error;
+ return NGX_ERROR;
}
b->start = b->pos = p;
@@ -543,7 +559,7 @@
return ngx_http_output_filter(r, &cl);
error:
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ return ngx_rtmp_control_output_error(r, msg);
}
@@ -591,7 +607,7 @@
p = ngx_palloc(r->connection->pool, len);
if (p == NULL) {
- goto error;
+ return NGX_ERROR;
}
len = (size_t) (ngx_snprintf(p, len, "%ui", ctx->count) - p);
@@ -601,7 +617,7 @@
b = ngx_calloc_buf(r->pool);
if (b == NULL) {
- goto error;
+ return NGX_ERROR;
}
b->start = b->pos = p;
@@ -617,7 +633,7 @@
return ngx_http_output_filter(r, &cl);
error:
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ return ngx_rtmp_control_output_error(r, msg);
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_core_module.c
^
|
@@ -150,13 +150,6 @@
offsetof(ngx_rtmp_core_srv_conf_t, publish_time_fix),
NULL },
- { ngx_string("buflen"),
- NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_CONF_TAKE1,
- ngx_conf_set_msec_slot,
- NGX_RTMP_SRV_CONF_OFFSET,
- offsetof(ngx_rtmp_core_srv_conf_t, buflen),
- NULL },
-
ngx_null_command
};
@@ -247,7 +240,6 @@
conf->out_cork = NGX_CONF_UNSET_SIZE;
conf->play_time_fix = NGX_CONF_UNSET;
conf->publish_time_fix = NGX_CONF_UNSET;
- conf->buflen = NGX_CONF_UNSET_MSEC;
conf->busy = NGX_CONF_UNSET;
return conf;
@@ -275,7 +267,6 @@
conf->out_queue / 8);
ngx_conf_merge_value(conf->play_time_fix, prev->play_time_fix, 1);
ngx_conf_merge_value(conf->publish_time_fix, prev->publish_time_fix, 1);
- ngx_conf_merge_msec_value(conf->buflen, prev->buflen, 1000);
ngx_conf_merge_value(conf->busy, prev->busy, 0);
if (prev->pool == NULL) {
@@ -332,7 +323,6 @@
void *mconf;
ngx_uint_t m;
ngx_conf_t pcf;
- ngx_module_t **modules;
ngx_rtmp_module_t *module;
ngx_rtmp_conf_ctx_t *ctx, *rtmp_ctx;
ngx_rtmp_core_srv_conf_t *cscf, **cscfp;
@@ -358,18 +348,12 @@
return NGX_CONF_ERROR;
}
-#if (nginx_version >= 1009011)
- modules = cf->cycle->modules;
-#else
- modules = ngx_modules;
-#endif
-
- for (m = 0; modules[m]; m++) {
- if (modules[m]->type != NGX_RTMP_MODULE) {
+ for (m = 0; ngx_modules[m]; m++) {
+ if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
continue;
}
- module = modules[m]->ctx;
+ module = ngx_modules[m]->ctx;
if (module->create_srv_conf) {
mconf = module->create_srv_conf(cf);
@@ -377,7 +361,7 @@
return NGX_CONF_ERROR;
}
- ctx->srv_conf[modules[m]->ctx_index] = mconf;
+ ctx->srv_conf[ngx_modules[m]->ctx_index] = mconf;
}
if (module->create_app_conf) {
@@ -386,7 +370,7 @@
return NGX_CONF_ERROR;
}
- ctx->app_conf[modules[m]->ctx_index] = mconf;
+ ctx->app_conf[ngx_modules[m]->ctx_index] = mconf;
}
}
@@ -426,7 +410,6 @@
ngx_int_t i;
ngx_str_t *value;
ngx_conf_t save;
- ngx_module_t **modules;
ngx_rtmp_module_t *module;
ngx_rtmp_conf_ctx_t *ctx, *pctx;
ngx_rtmp_core_srv_conf_t *cscf;
@@ -446,22 +429,17 @@
return NGX_CONF_ERROR;
}
-#if (nginx_version >= 1009011)
- modules = cf->cycle->modules;
-#else
- modules = ngx_modules;
-#endif
-
- for (i = 0; modules[i]; i++) {
- if (modules[i]->type != NGX_RTMP_MODULE) {
+ for (i = 0; ngx_modules[i]; i++) {
+ if (ngx_modules[i]->type != NGX_RTMP_MODULE) {
continue;
}
- module = modules[i]->ctx;
+ module = ngx_modules[i]->ctx;
if (module->create_app_conf) {
- ctx->app_conf[modules[i]->ctx_index] = module->create_app_conf(cf);
- if (ctx->app_conf[modules[i]->ctx_index] == NULL) {
+ ctx->app_conf[ngx_modules[i]->ctx_index] =
+ module->create_app_conf(cf);
+ if (ctx->app_conf[ngx_modules[i]->ctx_index] == NULL) {
return NGX_CONF_ERROR;
}
}
@@ -502,7 +480,6 @@
ngx_str_t *value;
ngx_url_t u;
ngx_uint_t i, m;
- ngx_module_t **modules;
struct sockaddr *sa;
ngx_rtmp_listen_t *ls;
struct sockaddr_in *sin;
@@ -559,9 +536,7 @@
break;
}
- if (ngx_memcmp(ls[i].sockaddr + off, (u_char *) &u.sockaddr + off, len)
- != 0)
- {
+ if (ngx_memcmp(ls[i].sockaddr + off, u.sockaddr + off, len) != 0) {
continue;
}
@@ -581,20 +556,14 @@
ngx_memzero(ls, sizeof(ngx_rtmp_listen_t));
- ngx_memcpy(ls->sockaddr, (u_char *) &u.sockaddr, u.socklen);
+ ngx_memcpy(ls->sockaddr, u.sockaddr, u.socklen);
ls->socklen = u.socklen;
ls->wildcard = u.wildcard;
ls->ctx = cf->ctx;
-#if (nginx_version >= 1009011)
- modules = cf->cycle->modules;
-#else
- modules = ngx_modules;
-#endif
-
- for (m = 0; modules[m]; m++) {
- if (modules[m]->type != NGX_RTMP_MODULE) {
+ for (m = 0; ngx_modules[m]; m++) {
+ if (ngx_modules[m]->type != NGX_RTMP_MODULE) {
continue;
}
}
@@ -741,11 +710,6 @@
#endif
}
- if (ngx_strcmp(value[i].data, "proxy_protocol") == 0) {
- ls->proxy_protocol = 1;
- continue;
- }
-
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"the invalid \"%V\" parameter", &value[i]);
return NGX_CONF_ERROR;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_flv_module.c
^
|
@@ -47,6 +47,7 @@
#define NGX_RTMP_FLV_BUFFER (1024*1024)
+#define NGX_RTMP_FLV_DEFAULT_BUFLEN 1000
#define NGX_RTMP_FLV_BUFLEN_ADDON 1000
#define NGX_RTMP_FLV_TAG_HEADER 11
#define NGX_RTMP_FLV_DATA_OFFSET 13
@@ -530,8 +531,8 @@
return NGX_OK;
}
- buflen = s->buflen + NGX_RTMP_FLV_BUFLEN_ADDON;
-
+ buflen = (s->buflen ? s->buflen + NGX_RTMP_FLV_BUFLEN_ADDON:
+ NGX_RTMP_FLV_DEFAULT_BUFLEN);
end_timestamp = (ngx_current_msec - ctx->epoch) +
ctx->start_timestamp + buflen;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_handler.c
^
|
@@ -272,13 +272,6 @@
b->last += n;
s->in_bytes += n;
- if (s->in_bytes >= 0xf0000000) {
- ngx_log_debug0(NGX_LOG_DEBUG_RTMP, c->log, 0,
- "resetting byte counter");
- s->in_bytes = 0;
- s->in_last_ack = 0;
- }
-
if (s->ack_size && s->in_bytes - s->in_last_ack >= s->ack_size) {
s->in_last_ack = s->in_bytes;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_init.c
^
|
@@ -7,7 +7,6 @@
#include <ngx_config.h>
#include <ngx_core.h>
#include "ngx_rtmp.h"
-#include "ngx_rtmp_proxy_protocol.h"
static void ngx_rtmp_close_connection(ngx_connection_t *c);
@@ -131,12 +130,7 @@
s->auto_pushed = unix_socket;
- if (addr_conf->proxy_protocol) {
- ngx_rtmp_proxy_protocol(s);
-
- } else {
- ngx_rtmp_handshake(s);
- }
+ ngx_rtmp_handshake(s);
}
@@ -197,13 +191,8 @@
return NULL;
}
-#if (nginx_version >= 1007005)
- ngx_queue_init(&s->posted_dry_events);
-#endif
-
s->epoch = ngx_current_msec;
s->timeout = cscf->timeout;
- s->buflen = cscf->buflen;
ngx_rtmp_set_chunk_size(s, NGX_RTMP_DEFAULT_CHUNK_SIZE);
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_log_module.c
^
|
@@ -920,7 +920,7 @@
ngx_rtmp_log_app_conf_t *lacf;
ngx_rtmp_log_t *log;
ngx_rtmp_log_op_t *op;
- ngx_uint_t n, i;
+ ngx_uint_t n;
u_char *line, *p;
size_t len;
@@ -934,7 +934,7 @@
}
log = lacf->logs->elts;
- for (i = 0; i < lacf->logs->nelts; ++i, ++log) {
+ for (n = 0; n < lacf->logs->nelts; ++n, ++log) {
if (ngx_time() == log->disk_full_time) {
/* FreeBSD full disk protection;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_mp4_module.c
^
|
@@ -220,6 +220,7 @@
}
+#define NGX_RTMP_MP4_DEFAULT_BUFLEN 1000
#define NGX_RTMP_MP4_BUFLEN_ADDON 1000
@@ -2123,7 +2124,8 @@
return rc;
}
- buflen = s->buflen + NGX_RTMP_MP4_BUFLEN_ADDON;
+ buflen = (s->buflen ? s->buflen + NGX_RTMP_MP4_BUFLEN_ADDON:
+ NGX_RTMP_MP4_DEFAULT_BUFLEN);
counter = 0;
last_timestamp = 0;
@@ -2229,6 +2231,8 @@
}
t->header_sent = 1;
+
+ goto next;
}
ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_netcall_module.c
^
|
@@ -585,8 +585,7 @@
sizeof("&swfurl=") - 1 + s->swf_url.len * 3 +
sizeof("&tcurl=") - 1 + s->tc_url.len * 3 +
sizeof("&pageurl=") - 1 + s->page_url.len * 3 +
- sizeof("&addr=") - 1 + addr_text->len * 3 +
- sizeof("&clientid=") - 1 + NGX_INT_T_LEN
+ sizeof("&addr=") - 1 + addr_text->len * 3
);
if (b == NULL) {
@@ -620,14 +619,10 @@
b->last = (u_char*) ngx_escape_uri(b->last, s->page_url.data,
s->page_url.len, NGX_ESCAPE_ARGS);
- b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") - 1);
+ b->last = ngx_cpymem(b->last, (u_char*) "&addr=", sizeof("&addr=") -1);
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
addr_text->len, NGX_ESCAPE_ARGS);
- b->last = ngx_cpymem(b->last, (u_char*) "&clientid=",
- sizeof("&clientid=") - 1);
- b->last = ngx_sprintf(b->last, "%ui", (ngx_uint_t) s->connection->number);
-
return cl;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_notify_module.c
^
|
@@ -390,7 +390,6 @@
sizeof("&tcurl=") - 1 + tc_url_len * 3 +
sizeof("&pageurl=") - 1 + page_url_len * 3 +
sizeof("&addr=") - 1 + addr_text->len * 3 +
- sizeof("&epoch=") - 1 + NGX_INT32_LEN +
1 + args_len
);
@@ -429,9 +428,6 @@
b->last = (u_char*) ngx_escape_uri(b->last, addr_text->data,
addr_text->len, NGX_ESCAPE_ARGS);
- b->last = ngx_cpymem(b->last, (u_char*) "&epoch=", sizeof("&epoch=") -1);
- b->last = ngx_sprintf(b->last, "%uD", (uint32_t) s->epoch);
-
b->last = ngx_cpymem(b->last, (u_char*) "&call=connect",
sizeof("&call=connect") - 1);
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_play_module.c
^
|
@@ -6,7 +6,6 @@
#include <ngx_config.h>
#include <ngx_core.h>
-#include <nginx.h>
#include "ngx_rtmp_play_module.h"
#include "ngx_rtmp_cmd_module.h"
#include "ngx_rtmp_netcall_module.h"
@@ -431,12 +430,7 @@
ngx_del_timer(&ctx->send_evt);
}
-#if (nginx_version >= 1007005)
- if (ctx->send_evt.posted)
-#else
- if (ctx->send_evt.prev)
-#endif
- {
+ if (ctx->send_evt.prev) {
ngx_delete_posted_event((&ctx->send_evt));
}
@@ -867,7 +861,7 @@
NGX_FILE_DEFAULT_ACCESS);
if (ctx->file.fd == NGX_INVALID_FILE) {
- ngx_log_debug1(NGX_LOG_DEBUG_RTMP, s->connection->log, ngx_errno,
+ ngx_log_debug1(NGX_LOG_ERR, s->connection->log, ngx_errno,
"play: error opening file '%s'", path);
continue;
}
@@ -921,10 +915,6 @@
ngx_rtmp_send_recorded(s, 1);
- if (ngx_rtmp_send_sample_access(s) != NGX_OK) {
- return NGX_ERROR;
- }
-
if (ngx_rtmp_play_do_init(s) != NGX_OK) {
return NGX_ERROR;
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_record_module.c
^
|
@@ -790,7 +790,6 @@
void **app_conf;
ngx_int_t rc;
ngx_rtmp_record_done_t v;
- u_char av;
rracf = rctx->conf;
@@ -798,23 +797,6 @@
return NGX_AGAIN;
}
- if (rctx->initialized) {
- av = 0;
-
- if (rctx->video) {
- av |= 0x01;
- }
-
- if (rctx->audio) {
- av |= 0x04;
- }
-
- if (ngx_write_file(&rctx->file, &av, 1, 4) == NGX_ERROR) {
- ngx_log_error(NGX_LOG_CRIT, s->connection->log, ngx_errno,
- "record: %V error writing av mask", &rracf->id);
- }
- }
-
if (ngx_close_file(rctx->file.fd) == NGX_FILE_ERROR) {
err = ngx_errno;
ngx_log_error(NGX_LOG_CRIT, s->connection->log, err,
@@ -884,21 +866,8 @@
"record: %V frame: mlen=%uD",
&rracf->id, h->mlen);
- if (h->type == NGX_RTMP_MSG_VIDEO) {
- rctx->video = 1;
- } else {
- rctx->audio = 1;
- }
-
timestamp = h->timestamp - rctx->epoch;
- if ((int32_t) timestamp < 0) {
- ngx_log_debug2(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
- "record: %V cut timestamp=%D", &rracf->id, timestamp);
-
- timestamp = 0;
- }
-
/* write tag header */
ph = hdr;
@@ -1089,7 +1058,7 @@
if (!rctx->initialized) {
rctx->initialized = 1;
- rctx->epoch = h->timestamp - rctx->time_shift;
+ rctx->epoch = h->timestamp + rctx->time_shift;
if (rctx->file.offset == 0 &&
ngx_rtmp_record_write_header(&rctx->file) != NGX_OK)
@@ -1195,7 +1164,6 @@
ngx_int_t i;
ngx_str_t *value;
ngx_conf_t save;
- ngx_module_t **modules;
ngx_rtmp_module_t *module;
ngx_rtmp_core_app_conf_t *cacf, **pcacf, *rcacf;
ngx_rtmp_record_app_conf_t *racf, **pracf, *rracf;
@@ -1222,22 +1190,17 @@
return NGX_CONF_ERROR;
}
-#if (nginx_version >= 1009011)
- modules = cf->cycle->modules;
-#else
- modules = ngx_modules;
-#endif
-
- for (i = 0; modules[i]; i++) {
- if (modules[i]->type != NGX_RTMP_MODULE) {
+ for (i = 0; ngx_modules[i]; i++) {
+ if (ngx_modules[i]->type != NGX_RTMP_MODULE) {
continue;
}
- module = modules[i]->ctx;
+ module = ngx_modules[i]->ctx;
if (module->create_app_conf) {
- ctx->app_conf[modules[i]->ctx_index] = module->create_app_conf(cf);
- if (ctx->app_conf[modules[i]->ctx_index] == NULL) {
+ ctx->app_conf[ngx_modules[i]->ctx_index] =
+ module->create_app_conf(cf);
+ if (ctx->app_conf[ngx_modules[i]->ctx_index] == NULL) {
return NGX_CONF_ERROR;
}
}
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_record_module.h
^
|
@@ -51,8 +51,6 @@
unsigned aac_header_sent:1;
unsigned avc_header_sent:1;
unsigned video_key_sent:1;
- unsigned audio:1;
- unsigned video:1;
} ngx_rtmp_record_rec_ctx_t;
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_relay_module.c
^
|
@@ -1335,6 +1335,7 @@
if (s->static_relay) {
ngx_add_timer(ctx->static_evt, racf->pull_reconnect);
+ return;
}
if (ctx->publish == NULL) {
|
[-]
[+]
|
Changed |
nginx-rtmp-module-1.1.2.tar.bz2/ngx_rtmp_version.h
^
|
@@ -8,8 +8,8 @@
#define _NGX_RTMP_VERSION_H_INCLUDED_
-#define nginx_rtmp_version 1001004
-#define NGINX_RTMP_VERSION "1.1.4"
+#define nginx_rtmp_version 1001001
+#define NGINX_RTMP_VERSION "1.1.1"
#endif /* _NGX_RTMP_VERSION_H_INCLUDED_ */
|
|
Added |
nginx-rtmp-module-1.1.5.tar.bz2
^
|
[-]
[+]
|
Deleted |
nginx-statsd.conf-sample
^
|
@@ -1,39 +0,0 @@
-http {
-
- # Set the server that you want to send stats to.
- statsd_server your.statsd.server.com;
-
- # Randomly sample 10% of requests so that you do not overwhelm your statsd server.
- # Defaults to sending all statsd (100%).
- statsd_sample_rate 10; # 10% of requests
-
-
- server {
- listen 80;
- server_name www.your.domain.com;
-
- # Increment "your_product.requests" by 1 whenever any request hits this server.
- statsd_count "your_product.requests" 1;
-
- location / {
-
- # Increment the key by 1 when this location is hit.
- statsd_count "your_product.pages.index_requests" 1;
-
- # Increment the key by 1, but only if $request_completion is set to something.
- statsd_count "your_product.pages.index_responses" 1 "$request_completion";
-
- # Send a timing to "your_product.pages.index_response_time" equal to the value
- # returned from the upstream server. If this value evaluates to 0 or empty-string,
- # it will not be sent. Thus, there is no need to add a test.
- statsd_timing "your_product.pages.index_response_time" "$upstream_response_time";
-
- # Increment a key based on the value of a custom header. Only sends the value if
- # the custom header exists in the upstream response.
- statsd_count "your_product.custom_$upstream_http_x_some_custom_header" 1
- "$upstream_http_x_some_custom_header";
-
- proxy_pass http://some.other.domain.com;
- }
- }
-}
\ No newline at end of file
|
|
Deleted |
nginx-statsd.tar.gz
^
|
[-]
[+]
|
Added |
nginx.init.suse
^
|
@@ -0,0 +1,277 @@
+#!/bin/sh
+#
+# Copyright (C) 1995--2007 Marcus Rückert, SUSE / Novell Inc.
+#
+# This library is free software; you can redistribute it and/or modify it
+# under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 2.1 of the License, or (at
+# your option) any later version.
+#
+# This library is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307,
+# USA.
+#
+# /etc/init.d/nginx
+# and its symbolic link
+# /(usr/)sbin/rcnginx
+#
+# Template system startup script for some example service/daemon nginx
+#
+# LSB compatible service control script; see http://www.linuxbase.org/spec/
+#
+# Note: This template uses functions rc_XXX defined in /etc/rc.status on
+# UnitedLinux/SUSE/Novell based Linux distributions. If you want to base your
+# script on this template and ensure that it works on non UL based LSB
+# compliant Linux distributions, you either have to provide the rc.status
+# functions from UL or change the script to work without them.
+# See skeleton.compat for a template that works with other distros as well.
+#
+### BEGIN INIT INFO
+# Provides: nginx
+# Required-Start: $syslog $remote_fs
+# Should-Start: $time ypbind sendmail
+# Required-Stop: $syslog $remote_fs
+# Should-Stop: $time ypbind sendmail
+# Default-Start: 3 5
+# Default-Stop: 0 1 2 6
+# Short-Description: nginx
+# Description: nginx
+### END INIT INFO
+#
+# Any extensions to the keywords given above should be preceeded by
+# X-VendorTag- (X-UnitedLinux- X-SuSE- for us) according to LSB.
+#
+# Notes on Required-Start/Should-Start:
+# * There are two different issues that are solved by Required-Start
+# and Should-Start
+# (a) Hard dependencies: This is used by the runlevel editor to determine
+# which services absolutely need to be started to make the start of
+# this service make sense. Example: nfsserver should have
+# Required-Start: $portmap
+# Also, required services are started before the dependent ones.
+# The runlevel editor will warn about such missing hard dependencies
+# and suggest enabling. During system startup, you may expect an error,
+# if the dependency is not fulfilled.
+# (b) Specifying the init script ordering, not real (hard) dependencies.
+# This is needed by insserv to determine which service should be
+# started first (and at a later stage what services can be started
+# in parallel). The tag Should-Start: is used for this.
+# It tells, that if a service is available, it should be started
+# before. If not, never mind.
+# * When specifying hard dependencies or ordering requirements, you can
+# use names of services (contents of their Provides: section)
+# or pseudo names starting with a $. The following ones are available
+# according to LSB (1.1):
+# $local_fs all local file systems are mounted
+# (most services should need this!)
+# $remote_fs all remote file systems are mounted
+# (note that /usr may be remote, so
+# many services should Require this!)
+# $syslog system logging facility up
+# $network low level networking (eth card, ...)
+# $named hostname resolution available
+# $netdaemons all network daemons are running
+# The $netdaemons pseudo service has been removed in LSB 1.2.
+# For now, we still offer it for backward compatibility.
+# These are new (LSB 1.2):
+# $time the system time has been set correctly
+# $portmap SunRPC portmapping service available
+# UnitedLinux extensions:
+# $ALL indicates that a script should be inserted
+# at the end
+# * The services specified in the stop tags
+# (Required-Stop/Should-Stop)
+# specify which services need to be still running when this service
+# is shut down. Often the entries there are just copies or a subset
+# from the respective start tag.
+# * Should-Start/Stop are now part of LSB as of 2.0,
+# formerly SUSE/Unitedlinux used X-UnitedLinux-Should-Start/-Stop.
+# insserv does support both variants.
+# * X-UnitedLinux-Default-Enabled: yes/no is used at installation time
+# (%fillup_and_insserv macro in %post of many RPMs) to specify whether
+# a startup script should default to be enabled after installation.
+# It's not used by insserv.
+#
+# Note on runlevels:
+# 0 - halt/poweroff 6 - reboot
+# 1 - single user 2 - multiuser without network exported
+# 3 - multiuser w/ network (text mode) 5 - multiuser w/ network and X11 (xdm)
+#
+# Note on script names:
+# http://www.linuxbase.org/spec/refspecs/LSB_1.3.0/gLSB/gLSB/scrptnames.html
+# A registry has been set up to manage the init script namespace.
+# http://www.lanana.org/
+# Please use the names already registered or register one or use a
+# vendor prefix.
+
+
+# Check for missing binaries (stale symlinks should not happen)
+# Note: Special treatment of stop for LSB conformance
+NGINX_BIN=/usr/sbin/nginx
+test -x $NGINX_BIN || { echo "$NGINX_BIN not installed";
+ if [ "$1" = "stop" ]; then exit 0;
+ else exit 5; fi; }
+
+# Check for existence of needed config file and read it
+#NGINX_CONFIG=/etc/sysconfig/nginx
+#test -r $NGINX_CONFIG || { echo "$NGINX_CONFIG not existing";
+# if [ "$1" = "stop" ]; then exit 0;
+# else exit 6; fi; }
+#
+# Read config
+#. $NGINX_CONFIG
+
+# Source LSB init functions
+# providing start_daemon, killproc, pidofproc,
+# log_success_msg, log_failure_msg and log_warning_msg.
+# This is currently not used by UnitedLinux based distributions and
+# not needed for init scripts for UnitedLinux only. If it is used,
+# the functions from rc.status should not be sourced or used.
+#. /lib/lsb/init-functions
+
+# Shell functions sourced from /etc/rc.status:
+# rc_check check and set local and overall rc status
+# rc_status check and set local and overall rc status
+# rc_status -v be verbose in local rc status and clear it afterwards
+# rc_status -v -r ditto and clear both the local and overall rc status
+# rc_status -s display "skipped" and exit with status 3
+# rc_status -u display "unused" and exit with status 3
+# rc_failed set local and overall rc status to failed
+# rc_failed <num> set local and overall rc status to <num>
+# rc_reset clear both the local and overall rc status
+# rc_exit exit appropriate to overall rc status
+# rc_active checks whether a service is activated by symlinks
+. /etc/rc.status
+
+# Reset status of this service
+rc_reset
+
+# Return values acc. to LSB for all commands but status:
+# 0 - success
+# 1 - generic or unspecified error
+# 2 - invalid or excess argument(s)
+# 3 - unimplemented feature (e.g. "reload")
+# 4 - user had insufficient privileges
+# 5 - program is not installed
+# 6 - program is not configured
+# 7 - program is not running
+# 8--199 - reserved (8--99 LSB, 100--149 distrib, 150--199 appl)
+#
+# Note that starting an already running service, stopping
+# or restarting a not-running service as well as the restart
+# with force-reload (in case signaling is not supported) are
+# considered a success.
+
+case "$1" in
+ start)
+ echo -n "Starting nginx "
+ ## Start daemon with startproc(8). If this fails
+ ## the return value is set appropriately by startproc.
+ /sbin/startproc $NGINX_BIN
+
+ # Remember status and be verbose
+ rc_status -v
+ ;;
+ stop)
+ echo -n "Shutting down nginx "
+ ## Stop daemon with killproc(8) and if this fails
+ ## killproc sets the return value according to LSB.
+
+ /sbin/killproc -TERM $NGINX_BIN
+
+ # Remember status and be verbose
+ rc_status -v
+ ;;
+ try-restart|condrestart)
+ ## Do a restart only if the service was active before.
+ ## Note: try-restart is now part of LSB (as of 1.9).
+ ## RH has a similar command named condrestart.
+ if test "$1" = "condrestart"; then
+ echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
+ fi
+ $0 status
+ if test $? = 0; then
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/HEAD
^
|
@@ -1 +0,0 @@
-ref: refs/heads/master
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/config
^
|
@@ -1,12 +0,0 @@
-[core]
- repositoryformatversion = 0
- filemode = true
- bare = false
- logallrefupdates = true
- ignorecase = true
-[remote "origin"]
- fetch = +refs/heads/*:refs/remotes/origin/*
- url = https://github.com/yaoweibin/nginx_upstream_check_module.git
-[branch "master"]
- remote = origin
- merge = refs/heads/master
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/description
^
|
@@ -1 +0,0 @@
-Unnamed repository; edit this file 'description' to name the repository.
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks/applypatch-msg.sample
^
|
@@ -1,15 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to check the commit log message taken by
-# applypatch from an e-mail message.
-#
-# The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit. The hook is
-# allowed to edit the commit message file.
-#
-# To enable this hook, rename this file to "applypatch-msg".
-
-. git-sh-setup
-test -x "$GIT_DIR/hooks/commit-msg" &&
- exec "$GIT_DIR/hooks/commit-msg" ${1+"$@"}
-:
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks/commit-msg.sample
^
|
@@ -1,24 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to check the commit log message.
-# Called by "git commit" with one argument, the name of the file
-# that has the commit message. The hook should exit with non-zero
-# status after issuing an appropriate message if it wants to stop the
-# commit. The hook is allowed to edit the commit message file.
-#
-# To enable this hook, rename this file to "commit-msg".
-
-# Uncomment the below to add a Signed-off-by line to the message.
-# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
-# hook is more suited to it.
-#
-# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
-
-# This example catches duplicate Signed-off-by lines.
-
-test "" = "$(grep '^Signed-off-by: ' "$1" |
- sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
- echo >&2 Duplicate Signed-off-by lines.
- exit 1
-}
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks/post-update.sample
^
|
@@ -1,8 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to prepare a packed repository for use over
-# dumb transports.
-#
-# To enable this hook, rename this file to "post-update".
-
-exec git update-server-info
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks/pre-applypatch.sample
^
|
@@ -1,14 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed
-# by applypatch from an e-mail message.
-#
-# The hook should exit with non-zero status after issuing an
-# appropriate message if it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-applypatch".
-
-. git-sh-setup
-test -x "$GIT_DIR/hooks/pre-commit" &&
- exec "$GIT_DIR/hooks/pre-commit" ${1+"$@"}
-:
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks/pre-commit.sample
^
|
@@ -1,50 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to verify what is about to be committed.
-# Called by "git commit" with no arguments. The hook should
-# exit with non-zero status after issuing an appropriate message if
-# it wants to stop the commit.
-#
-# To enable this hook, rename this file to "pre-commit".
-
-if git rev-parse --verify HEAD >/dev/null 2>&1
-then
- against=HEAD
-else
- # Initial commit: diff against an empty tree object
- against=4b825dc642cb6eb9a060e54bf8d69288fbee4904
-fi
-
-# If you want to allow non-ascii filenames set this variable to true.
-allownonascii=$(git config hooks.allownonascii)
-
-# Redirect output to stderr.
-exec 1>&2
-
-# Cross platform projects tend to avoid non-ascii filenames; prevent
-# them from being added to the repository. We exploit the fact that the
-# printable range starts at the space character and ends with tilde.
-if [ "$allownonascii" != "true" ] &&
- # Note that the use of brackets around a tr range is ok here, (it's
- # even required, for portability to Solaris 10's /usr/bin/tr), since
- # the square bracket bytes happen to fall in the designated range.
- test $(git diff --cached --name-only --diff-filter=A -z $against |
- LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
-then
- echo "Error: Attempt to add a non-ascii file name."
- echo
- echo "This can cause problems if you want to work"
- echo "with people on other platforms."
- echo
- echo "To be portable it is advisable to rename the file ..."
- echo
- echo "If you know what you are doing you can disable this"
- echo "check using:"
- echo
- echo " git config hooks.allownonascii true"
- echo
- exit 1
-fi
-
-# If there are whitespace errors, print the offending file names and fail.
-exec git diff-index --check --cached $against --
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks/pre-rebase.sample
^
|
@@ -1,169 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2006, 2008 Junio C Hamano
-#
-# The "pre-rebase" hook is run just before "git rebase" starts doing
-# its job, and can prevent the command from running by exiting with
-# non-zero status.
-#
-# The hook is called with the following parameters:
-#
-# $1 -- the upstream the series was forked from.
-# $2 -- the branch being rebased (or empty when rebasing the current branch).
-#
-# This sample shows how to prevent topic branches that are already
-# merged to 'next' branch from getting rebased, because allowing it
-# would result in rebasing already published history.
-
-publish=next
-basebranch="$1"
-if test "$#" = 2
-then
- topic="refs/heads/$2"
-else
- topic=`git symbolic-ref HEAD` ||
- exit 0 ;# we do not interrupt rebasing detached HEAD
-fi
-
-case "$topic" in
-refs/heads/??/*)
- ;;
-*)
- exit 0 ;# we do not interrupt others.
- ;;
-esac
-
-# Now we are dealing with a topic branch being rebased
-# on top of master. Is it OK to rebase it?
-
-# Does the topic really exist?
-git show-ref -q "$topic" || {
- echo >&2 "No such branch $topic"
- exit 1
-}
-
-# Is topic fully merged to master?
-not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
-if test -z "$not_in_master"
-then
- echo >&2 "$topic is fully merged to master; better remove it."
- exit 1 ;# we could allow it, but there is no point.
-fi
-
-# Is topic ever merged to next? If so you should not be rebasing it.
-only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
-only_next_2=`git rev-list ^master ${publish} | sort`
-if test "$only_next_1" = "$only_next_2"
-then
- not_in_topic=`git rev-list "^$topic" master`
- if test -z "$not_in_topic"
- then
- echo >&2 "$topic is already up-to-date with master"
- exit 1 ;# we could allow it, but there is no point.
- else
- exit 0
- fi
-else
- not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
- /usr/bin/perl -e '
- my $topic = $ARGV[0];
- my $msg = "* $topic has commits already merged to public branch:\n";
- my (%not_in_next) = map {
- /^([0-9a-f]+) /;
- ($1 => 1);
- } split(/\n/, $ARGV[1]);
- for my $elem (map {
- /^([0-9a-f]+) (.*)$/;
- [$1 => $2];
- } split(/\n/, $ARGV[2])) {
- if (!exists $not_in_next{$elem->[0]}) {
- if ($msg) {
- print STDERR $msg;
- undef $msg;
- }
- print STDERR " $elem->[1]\n";
- }
- }
- ' "$topic" "$not_in_next" "$not_in_master"
- exit 1
-fi
-
-exit 0
-
-################################################################
-
-This sample hook safeguards topic branches that have been
-published from being rewound.
-
-The workflow assumed here is:
-
- * Once a topic branch forks from "master", "master" is never
- merged into it again (either directly or indirectly).
-
- * Once a topic branch is fully cooked and merged into "master",
- it is deleted. If you need to build on top of it to correct
- earlier mistakes, a new topic branch is created by forking at
- the tip of the "master". This is not strictly necessary, but
- it makes it easier to keep your history simple.
-
- * Whenever you need to test or publish your changes to topic
- branches, merge them into "next" branch.
-
-The script, being an example, hardcodes the publish branch name
-to be "next", but it is trivial to make it configurable via
-$GIT_DIR/config mechanism.
-
-With this workflow, you would want to know:
-
-(1) ... if a topic branch has ever been merged to "next". Young
- topic branches can have stupid mistakes you would rather
- clean up before publishing, and things that have not been
- merged into other branches can be easily rebased without
- affecting other people. But once it is published, you would
- not want to rewind it.
-
-(2) ... if a topic branch has been fully merged to "master".
- Then you can delete it. More importantly, you should not
- build on top of it -- other people may already want to
- change things related to the topic as patches against your
- "master", so if you need further changes, it is better to
- fork the topic (perhaps with the same name) afresh from the
- tip of "master".
-
-Let's look at this example:
-
- o---o---o---o---o---o---o---o---o---o "next"
- / / / /
- / a---a---b A / /
- / / / /
- / / c---c---c---c B /
- / / / \ /
- / / / b---b C \ /
- / / / / \ /
- ---o---o---o---o---o---o---o---o---o---o---o "master"
-
-
-A, B and C are topic branches.
-
- * A has one fix since it was merged up to "next".
-
- * B has finished. It has been fully merged up to "master" and "next",
- and is ready to be deleted.
-
- * C has not merged to "next" at all.
-
-We would want to allow C to be rebased, refuse A, and encourage
-B to be deleted.
-
-To compute (1):
-
- git rev-list ^master ^topic next
- git rev-list ^master next
-
- if these match, topic has not merged in next at all.
-
-To compute (2):
-
- git rev-list master..topic
-
- if this is empty, it is fully merged to "master".
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks/prepare-commit-msg.sample
^
|
@@ -1,36 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to prepare the commit log message.
-# Called by "git commit" with the name of the file that has the
-# commit message, followed by the description of the commit
-# message's source. The hook's purpose is to edit the commit
-# message file. If the hook fails with a non-zero status,
-# the commit is aborted.
-#
-# To enable this hook, rename this file to "prepare-commit-msg".
-
-# This hook includes three examples. The first comments out the
-# "Conflicts:" part of a merge commit.
-#
-# The second includes the output of "git diff --name-status -r"
-# into the message, just before the "git status" output. It is
-# commented because it doesn't cope with --amend or with squashed
-# commits.
-#
-# The third example adds a Signed-off-by line to the message, that can
-# still be edited. This is rarely a good idea.
-
-case "$2,$3" in
- merge,)
- /usr/bin/perl -i.bak -ne 's/^/# /, s/^# #/#/ if /^Conflicts/ .. /#/; print' "$1" ;;
-
-# ,|template,)
-# /usr/bin/perl -i.bak -pe '
-# print "\n" . `git diff --cached --name-status -r`
-# if /^#/ && $first++ == 0' "$1" ;;
-
- *) ;;
-esac
-
-# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
-# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/hooks/update.sample
^
|
@@ -1,128 +0,0 @@
-#!/bin/sh
-#
-# An example hook script to blocks unannotated tags from entering.
-# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
-#
-# To enable this hook, rename this file to "update".
-#
-# Config
-# ------
-# hooks.allowunannotated
-# This boolean sets whether unannotated tags will be allowed into the
-# repository. By default they won't be.
-# hooks.allowdeletetag
-# This boolean sets whether deleting tags will be allowed in the
-# repository. By default they won't be.
-# hooks.allowmodifytag
-# This boolean sets whether a tag may be modified after creation. By default
-# it won't be.
-# hooks.allowdeletebranch
-# This boolean sets whether deleting branches will be allowed in the
-# repository. By default they won't be.
-# hooks.denycreatebranch
-# This boolean sets whether remotely creating branches will be denied
-# in the repository. By default this is allowed.
-#
-
-# --- Command line
-refname="$1"
-oldrev="$2"
-newrev="$3"
-
-# --- Safety check
-if [ -z "$GIT_DIR" ]; then
- echo "Don't run this script from the command line." >&2
- echo " (if you want, you could supply GIT_DIR then run" >&2
- echo " $0 <ref> <oldrev> <newrev>)" >&2
- exit 1
-fi
-
-if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
- echo "Usage: $0 <ref> <oldrev> <newrev>" >&2
- exit 1
-fi
-
-# --- Config
-allowunannotated=$(git config --bool hooks.allowunannotated)
-allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
-denycreatebranch=$(git config --bool hooks.denycreatebranch)
-allowdeletetag=$(git config --bool hooks.allowdeletetag)
-allowmodifytag=$(git config --bool hooks.allowmodifytag)
-
-# check for no description
-projectdesc=$(sed -e '1q' "$GIT_DIR/description")
-case "$projectdesc" in
-"Unnamed repository"* | "")
- echo "*** Project description file hasn't been set" >&2
- exit 1
- ;;
-esac
-
-# --- Check types
-# if $newrev is 0000...0000, it's a commit to delete a ref.
-zero="0000000000000000000000000000000000000000"
-if [ "$newrev" = "$zero" ]; then
- newrev_type=delete
-else
- newrev_type=$(git cat-file -t $newrev)
-fi
-
-case "$refname","$newrev_type" in
- refs/tags/*,commit)
- # un-annotated tag
- short_refname=${refname##refs/tags/}
- if [ "$allowunannotated" != "true" ]; then
- echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
- echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
- exit 1
- fi
- ;;
- refs/tags/*,delete)
- # delete tag
- if [ "$allowdeletetag" != "true" ]; then
- echo "*** Deleting a tag is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/tags/*,tag)
- # annotated tag
- if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
- then
- echo "*** Tag '$refname' already exists." >&2
- echo "*** Modifying a tag is not allowed in this repository." >&2
- exit 1
- fi
- ;;
- refs/heads/*,commit)
- # branch
- if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
- echo "*** Creating a branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/heads/*,delete)
- # delete branch
- if [ "$allowdeletebranch" != "true" ]; then
- echo "*** Deleting a branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- refs/remotes/*,commit)
- # tracking branch
- ;;
- refs/remotes/*,delete)
- # delete tracking branch
- if [ "$allowdeletebranch" != "true" ]; then
- echo "*** Deleting a tracking branch is not allowed in this repository" >&2
- exit 1
- fi
- ;;
- *)
- # Anything else (is there anything else?)
- echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
- exit 1
- ;;
-esac
-
-# --- Finished
-exit 0
|
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/index
^
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/info
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/info/exclude
^
|
@@ -1,6 +0,0 @@
-# git ls-files --others --exclude-from=.git/info/exclude
-# Lines that start with '#' are comments.
-# For a project mostly in C, the following would be a good set of
-# exclude patterns (uncomment them if you want to use them):
-# *.[oa]
-# *~
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/logs
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/logs/HEAD
^
|
@@ -1 +0,0 @@
-0000000000000000000000000000000000000000 fdda58751149473cc32e4adc95dd2892c8a1bc49 U-arrakis\jg <jg@arrakis.(none)> 1420042220 +0100 clone: from https://github.com/yaoweibin/nginx_upstream_check_module.git
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/logs/refs
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/logs/refs/heads
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/logs/refs/heads/master
^
|
@@ -1 +0,0 @@
-0000000000000000000000000000000000000000 fdda58751149473cc32e4adc95dd2892c8a1bc49 U-arrakis\jg <jg@arrakis.(none)> 1420042220 +0100 clone: from https://github.com/yaoweibin/nginx_upstream_check_module.git
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/objects
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/objects/info
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/objects/pack
^
|
-(directory)
|
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/objects/pack/pack-94943f89e97721f966da20d991fa6f18b4d73510.idx
^
|
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/objects/pack/pack-94943f89e97721f966da20d991fa6f18b4d73510.pack
^
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/packed-refs
^
|
@@ -1,20 +0,0 @@
-# pack-refs with: peeled
-7d73c60f5ec51e55ad06a2eaec6f68829d3f5996 refs/remotes/origin/development
-b1cd212fc06c3e4decc73fe2e8f388b3956271c8 refs/remotes/origin/for_adam
-669f88ddc370ad170f622cdc32882e9922be25ea refs/remotes/origin/legacy
-fdda58751149473cc32e4adc95dd2892c8a1bc49 refs/remotes/origin/master
-0f5e85efc9424b64eea3ee3f22fa1e1c3b0a7055 refs/remotes/origin/pure_version
-4f1617f7193e435af9e880d8d065fc4350ff9141 refs/tags/0.1.8
-^99524efeb68a80f789827c35af654c16110f277d
-6bb3618fb6175b5e52a152b4f78fabc2021ac21c refs/tags/v0.1.4
-^4bd5f761c5f2f63053737e7e7d041acfe64ab72a
-e384764692d77f8e34631da700112388f71eb871 refs/tags/v0.1.5
-^63ca24bc040ca02fd3e3aa71eed65342b48c2fdc
-33328bb7768497cdf21135338f44f8ff94433e91 refs/tags/v0.1.6
-^0ee0616c1a6272b7c351b43fe20f221cd1c53ebd
-47f7a667fcf4a4f5c35c99f0367485e09a42e458 refs/tags/v0.1.9
-^2662fe4f2b6238364ca5457e3b8f28c261de6106
-0f52429f7eb7650876b086e9e16baae6bdb27803 refs/tags/v0.2.0
-^669f88ddc370ad170f622cdc32882e9922be25ea
-1e1a195e4b5c728417a7e19911773a4fe2eda95e refs/tags/v0.3.0
-^3dc59023c308b2ea6198fac987efa0f407b5aa81
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/refs
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/refs/heads
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/refs/heads/master
^
|
@@ -1 +0,0 @@
-fdda58751149473cc32e4adc95dd2892c8a1bc49
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/refs/remotes
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/refs/remotes/origin
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/refs/remotes/origin/HEAD
^
|
@@ -1 +0,0 @@
-ref: refs/remotes/origin/master
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/.git/refs/tags
^
|
-(directory)
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/README
^
|
@@ -1,6 +1,5 @@
Name
- nginx_http_upstream_check_module - support upstream health check with
- Nginx
+ nginx_http_upstream_check_module - support health check with Nginx
Synopsis
http {
@@ -11,12 +10,12 @@
server 192.168.0.1:80;
server 192.168.0.2:80;
- check interval=5000 rise=1 fall=3 timeout=4000;
+ check interval=3000 rise=2 fall=5 timeout=1000;
#check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello;
#check interval=3000 rise=2 fall=5 timeout=1000 type=http;
- #check_http_send "HEAD / HTTP/1.0\r\n\r\n";
+ #check_http_send "GET / HTTP/1.0\r\n\r\n";
#check_http_expect_alive http_2xx http_3xx;
}
@@ -45,7 +44,7 @@
check
syntax: *check interval=milliseconds [fall=count] [rise=count]
[timeout=milliseconds] [default_down=true|false]
- [type=tcp|http|ssl_hello|mysql|ajp|fastcgi]*
+ [type=tcp|http|ssl_hello|mysql|ajp]*
default: *none, if parameters omitted, default parameters are
interval=30000 fall=5 rise=2 timeout=1000 default_down=true type=tcp*
@@ -69,10 +68,6 @@
* *default_down*: set initial state of backend server, default is
down.
- * *port*: specify the check port in the backend servers. It can be
- different with the original servers port. Default the port is 0 and
- it means the same as the original backend server.
-
* *type*: the check protocol type:
1. *tcp* is a simple tcp socket connect and peek one byte.
@@ -89,9 +84,6 @@
5. *ajp* sends a AJP Cping packet, receives and parses the AJP
Cpong response to diagnose if the upstream server is alive.
- 6. *fastcgi* send a fastcgi request, receives and parses the
- fastcgi response to diagnose if the upstream server is alive.
-
check_http_send
syntax: *check_http_send http_packet*
@@ -113,36 +105,10 @@
description: These status codes indicate the upstream server's http
response is ok, the backend is alive.
- check_keepalive_requests
- syntax: *check_keepalive_requests num*
-
- default: *check_keepalive_requests 1*
-
- context: *upstream*
-
- description: The directive specifies the number of requests sent on a
- connection, the default vaule 1 indicates that nginx will certainly
- close the connection after a request.
-
- check_fastcgi_param
- Syntax: *check_fastcgi_params parameter value*
-
- default: see below
-
- context: *upstream*
-
- description: If you set the check type is fastcgi, then the check
- function will sends this fastcgi headers to check the upstream server.
- The default directive looks like:
-
- check_fastcgi_param "REQUEST_METHOD" "GET";
- check_fastcgi_param "REQUEST_URI" "/";
- check_fastcgi_param "SCRIPT_FILENAME" "index.php";
-
check_shm_size
syntax: *check_shm_size size*
- default: *1M*
+ default: *1m*
context: *http*
@@ -151,7 +117,7 @@
enlarge it with this directive.
check_status
- syntax: *check_status [html|csv|json]*
+ syntax: *check_status*
default: *none*
@@ -160,60 +126,6 @@
description: Display the health checking servers' status by HTTP. This
directive should be set in the http block.
- You can specify the default display format. The formats can be `html`,
- `csv` or `json`. The default type is `html`. It also supports to specify
- the format by the request argument. Suppose your `check_status` location
- is '/status', the argument of `format` can change the display page's
- format. You can do like this:
-
- /status?format=html
- /status?format=csv
- /status?format=json
-
- At present, you can fetch the list of servers with the same status by
- the argument of `status`. For example:
-
- /status?format=html&status=down
- /status?format=csv&status=up
-
- Below it's the sample html page:
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <title>Nginx http upstream check status</title>
- <h1>Nginx http upstream check status</h1>
- <h2>Check upstream server number: 1, generation: 3</h2>
- <th>Index</th>
- <th>Upstream</th>
- <th>Name</th>
- <th>Status</th>
- <th>Rise counts</th>
- <th>Fall counts</th>
- <th>Check type</th>
- <th>Check port</th>
- <td>0</td>
- <td>backend</td>
- <td>106.187.48.116:80</td>
- <td>up</td>
- <td>39</td>
- <td>0</td>
- <td>http</td>
- <td>80</td>
-
- Below it's the sample of csv page:
-
- 0,backend,106.187.48.116:80,up,46,0,http,80
-
- Below it's the sample of json page:
-
- {"servers": {
- "total": 1,
- "generation": 3,
- "server": [
- {"index": 0, "upstream": "backend", "name": "106.187.48.116:80", "status": "up", "rise": 58, "fall": 0, "type": "http", "port": 80}
- ]
- }}
-
Installation
Download the latest version of the release tarball of this module from
github (<http://github.com/yaoweibin/nginx_upstream_check_module>)
@@ -243,12 +155,6 @@
If you use nginx-1.2.6+ or nginx-1.3.9+, It adjusted the round robin
module. You should use the patch named 'check_1.2.6+.patch'.
- If you use nginx-1.5.12+, You should use the patch named
- 'check_1.5.12+.patch'.
-
- If you use nginx-1.7.2+, You should use the patch named
- 'check_1.7.2+.patch'.
-
The patch just adds the support for the official Round-Robin, Ip_hash
and least_conn upstream module. But it's easy to expand my module to
other upstream modules. See the patch for detail.
@@ -286,13 +192,6 @@
TODO
Known Issues
Changelogs
- v0.3
- * support keepalive check requests
-
- * fastcgi check requests
-
- * json/csv check status page support
-
v0.1
* first release
@@ -310,15 +209,9 @@
This module is licensed under the BSD license.
- Copyright (C) 2014 by Weibin Yao <yaoweibin@gmail.com>
-
- Copyright (C) 2010-2014 Alibaba Group Holding Limited
-
- Copyright (C) 2014 by LiangBin Li
-
- Copyright (C) 2014 by Zhuo Yuan
+ Copyright (C) 2012 by Weibin Yao <yaoweibin@gmail.com>.
- Copyright (C) 2012 by Matthieu Tourne
+ Copyright (C) 2012 by Matthieu Tourne.
All rights reserved.
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/check.patch
^
|
@@ -6,8 +6,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
@@ -17,11 +17,11 @@
if (!peer->down) {
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get ip_hash peer, check_index: %ui",
+ peer->check_index);
-+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (!ngx_http_check_peer_down(peer->check_index)) {
+#endif
if (peer->max_fails == 0 || peer->fails < peer->max_fails) {
break;
@@ -30,7 +30,7 @@
peer->fails = 0;
break;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ }
+#endif
}
@@ -44,8 +44,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
static ngx_int_t ngx_http_upstream_cmp_servers(const void *one,
@@ -55,10 +55,10 @@
peers->peer[n].weight = server[i].down ? 0 : server[i].weight;
peers->peer[n].current_weight = peers->peer[n].weight;
+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -73,10 +73,10 @@
backup->peer[n].fail_timeout = server[i].fail_timeout;
backup->peer[n].down = server[i].down;
+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -90,7 +90,7 @@
peers->peer[i].current_weight = 1;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -100,7 +100,7 @@
peers->peer[0].current_weight = 1;
peers->peer[0].max_fails = 1;
peers->peer[0].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
@@ -110,7 +110,7 @@
peers->peer[i].current_weight = 1;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -121,8 +121,8 @@
if (rrp->peers->single) {
peer = &rrp->peers->peer[0];
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ return NGX_BUSY;
+ }
+#endif
@@ -133,11 +133,11 @@
if (!peer->down) {
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get rr peer, check_index: %ui",
+ peer->check_index);
-+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (!ngx_http_check_peer_down(peer->check_index)) {
+#endif
if (peer->max_fails == 0
|| peer->fails < peer->max_fails)
@@ -146,7 +146,7 @@
peer->fails = 0;
break;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ }
+#endif
@@ -156,11 +156,11 @@
if (!peer->down) {
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get rr peer2, check_index: %ui",
+ peer->check_index);
-+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (!ngx_http_check_peer_down(peer->check_index)) {
+#endif
if (peer->max_fails == 0
|| peer->fails < peer->max_fails)
@@ -169,7 +169,7 @@
peer->fails = 0;
break;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ }
+#endif
@@ -183,7 +183,7 @@
ngx_uint_t max_fails;
time_t fail_timeout;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_uint_t check_index;
+#endif
+
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/check_1.2.1.patch
^
|
@@ -6,8 +6,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
@@ -17,11 +17,11 @@
if (!peer->down) {
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get ip_hash peer, check_index: %ui",
+ peer->check_index);
-+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (!ngx_http_check_peer_down(peer->check_index)) {
+#endif
if (peer->max_fails == 0 || peer->fails < peer->max_fails) {
break;
@@ -30,7 +30,7 @@
peer->checked = now;
break;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ }
+#endif
}
@@ -44,8 +44,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
static ngx_int_t ngx_http_upstream_cmp_servers(const void *one,
@@ -56,10 +56,10 @@
peers->peer[n].current_weight = 0;
- n++;
+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -74,10 +74,10 @@
backup->peer[n].fail_timeout = server[i].fail_timeout;
backup->peer[n].down = server[i].down;
+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -91,7 +91,7 @@
peers->peer[i].current_weight = 0;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -101,7 +101,7 @@
peers->peer[0].current_weight = 0;
peers->peer[0].max_fails = 1;
peers->peer[0].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
@@ -111,7 +111,7 @@
peers->peer[i].current_weight = 0;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -122,8 +122,8 @@
if (rrp->peers->single) {
peer = &rrp->peers->peer[0];
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ return NGX_BUSY;
+ }
+#endif
@@ -134,8 +134,8 @@
continue;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ continue;
+ }
+#endif
@@ -151,7 +151,7 @@
ngx_uint_t max_fails;
time_t fail_timeout;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_uint_t check_index;
+#endif
+
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/check_1.2.2+.patch
^
|
@@ -6,8 +6,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
@@ -17,11 +17,11 @@
if (!peer->down) {
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get ip_hash peer, check_index: %ui",
+ peer->check_index);
-+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (!ngx_http_check_peer_down(peer->check_index)) {
+#endif
if (peer->max_fails == 0 || peer->fails < peer->max_fails) {
break;
@@ -30,7 +30,7 @@
peer->checked = now;
break;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ }
+#endif
}
@@ -44,8 +44,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
@@ -55,12 +55,12 @@
continue;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get least_conn peer, check_index: %ui",
+ peer->check_index);
+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ continue;
+ }
+#endif
@@ -72,12 +72,12 @@
continue;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get least_conn peer, check_index: %ui",
+ peer->check_index);
+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ continue;
+ }
+#endif
@@ -93,8 +93,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
static ngx_int_t ngx_http_upstream_cmp_servers(const void *one,
@@ -105,10 +105,10 @@
peers->peer[n].current_weight = 0;
- n++;
+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -123,10 +123,10 @@
backup->peer[n].fail_timeout = server[i].fail_timeout;
backup->peer[n].down = server[i].down;
+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -140,7 +140,7 @@
peers->peer[i].current_weight = 0;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -150,7 +150,7 @@
peers->peer[0].current_weight = 0;
peers->peer[0].max_fails = 1;
peers->peer[0].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
@@ -160,7 +160,7 @@
peers->peer[i].current_weight = 0;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -171,8 +171,8 @@
if (rrp->peers->single) {
peer = &rrp->peers->peer[0];
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ return NGX_BUSY;
+ }
+#endif
@@ -183,8 +183,8 @@
continue;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ continue;
+ }
+#endif
@@ -200,7 +200,7 @@
ngx_uint_t max_fails;
time_t fail_timeout;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_uint_t check_index;
+#endif
+
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/check_1.2.6+.patch
^
|
@@ -6,8 +6,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
@@ -17,11 +17,11 @@
if (!peer->down) {
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get ip_hash peer, check_index: %ui",
+ peer->check_index);
-+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (!ngx_http_check_peer_down(peer->check_index)) {
+#endif
if (peer->max_fails == 0 || peer->fails < peer->max_fails) {
break;
@@ -30,7 +30,7 @@
peer->checked = now;
break;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ }
+#endif
}
@@ -44,8 +44,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
@@ -55,12 +55,12 @@
continue;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get least_conn peer, check_index: %ui",
+ peer->check_index);
+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ continue;
+ }
+#endif
@@ -72,12 +72,12 @@
continue;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get least_conn peer, check_index: %ui",
+ peer->check_index);
+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ continue;
+ }
+#endif
@@ -93,8 +93,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
static ngx_int_t ngx_http_upstream_cmp_servers(const void *one,
@@ -105,10 +105,10 @@
peers->peer[n].current_weight = 0;
- n++;
+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -123,10 +123,10 @@
backup->peer[n].fail_timeout = server[i].fail_timeout;
backup->peer[n].down = server[i].down;
+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -140,7 +140,7 @@
peers->peer[i].current_weight = 0;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -150,7 +150,7 @@
peers->peer[0].current_weight = 0;
peers->peer[0].max_fails = 1;
peers->peer[0].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
@@ -160,7 +160,7 @@
peers->peer[i].current_weight = 0;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -170,8 +170,8 @@
goto failed;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ goto failed;
+ }
+#endif
@@ -183,8 +183,8 @@
continue;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ continue;
+ }
+#endif
@@ -200,7 +200,7 @@
ngx_uint_t max_fails;
time_t fail_timeout;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_uint_t check_index;
+#endif
+
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/check_1.5.12+.patch
^
|
@@ -1,198 +0,0 @@
-diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c
-index 041883f..b1bc7d0 100644
---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
-+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
-@@ -9,6 +9,10 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-+
-
- typedef struct {
- /* the round robin data must be first */
-@@ -212,6 +216,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
- goto next_try;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get ip_hash peer, check_index: %ui",
-+ peer->check_index);
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ goto next_try;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c
-index dbef95d..dc9b518 100644
---- a/src/http/modules/ngx_http_upstream_least_conn_module.c
-+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c
-@@ -9,6 +9,10 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-+
-
- typedef struct {
- ngx_uint_t *conns;
-@@ -203,6 +207,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get least_conn peer, check_index: %ui",
-+ peer->check_index);
-+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-@@ -256,6 +270,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get least_conn peer, check_index: %ui",
-+ peer->check_index);
-+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
- continue;
- }
-diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
-index 85ff558..2fe9bb6 100644
---- a/src/http/ngx_http_upstream_round_robin.c
-+++ b/src/http/ngx_http_upstream_round_robin.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer(
- ngx_http_upstream_rr_peer_data_t *rrp);
-@@ -85,6 +88,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peers->peer[n].max_fails = server[i].max_fails;
- peers->peer[n].fail_timeout = server[i].fail_timeout;
- peers->peer[n].down = server[i].down;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (!server[i].down) {
-+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
-+ } else {
-+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
-+ }
-+#endif
- n++;
- }
- }
-@@ -139,6 +150,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- backup->peer[n].max_fails = server[i].max_fails;
- backup->peer[n].fail_timeout = server[i].fail_timeout;
- backup->peer[n].down = server[i].down;
-+
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (!server[i].down) {
-+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
-+ }
-+ else {
-+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
-+ }
-+#endif
-+
- n++;
- }
- }
-@@ -196,6 +218,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peers->peer[i].current_weight = 0;
- peers->peer[i].max_fails = 1;
- peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- }
-
- us->peer.data = peers;
-@@ -302,6 +327,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
- peers->peer[0].current_weight = 0;
- peers->peer[0].max_fails = 1;
- peers->peer[0].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
-
- } else {
-
-@@ -342,6 +370,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
- peers->peer[i].current_weight = 0;
- peers->peer[i].max_fails = 1;
- peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- }
- }
-
-@@ -399,6 +430,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
- goto failed;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ goto failed;
-+ }
-+#endif
-+
- } else {
-
- /* there are several peers */
-@@ -498,6 +535,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h
-index ea90ab9..a6fb33f 100644
---- a/src/http/ngx_http_upstream_round_robin.h
-+++ b/src/http/ngx_http_upstream_round_robin.h
-@@ -30,6 +30,10 @@ typedef struct {
- ngx_uint_t max_fails;
- time_t fail_timeout;
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_uint_t check_index;
-+#endif
-+
- ngx_uint_t down; /* unsigned down:1; */
-
- #if (NGX_HTTP_SSL)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/check_1.7.2+.patch
^
|
@@ -1,195 +0,0 @@
-diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c
-index 148d73a..913e395 100644
---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
-+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- typedef struct {
- /* the round robin data must be first */
-@@ -212,6 +215,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
- goto next_try;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get ip_hash peer, check_index: %ui",
-+ peer->check_index);
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ goto next_try;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c
-index dbef95d..bbabb68 100644
---- a/src/http/modules/ngx_http_upstream_least_conn_module.c
-+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- typedef struct {
- ngx_uint_t *conns;
-@@ -203,6 +206,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get least_conn peer, check_index: %ui",
-+ peer->check_index);
-+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-@@ -256,6 +269,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get least_conn peer, check_index: %ui",
-+ peer->check_index);
-+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
- continue;
- }
-diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
-index 37c835c..54aa44d 100644
---- a/src/http/ngx_http_upstream_round_robin.c
-+++ b/src/http/ngx_http_upstream_round_robin.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- static ngx_http_upstream_rr_peer_t *ngx_http_upstream_get_peer(
- ngx_http_upstream_rr_peer_data_t *rrp);
-@@ -88,6 +91,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[n].fail_timeout = server[i].fail_timeout;
- peer[n].down = server[i].down;
- peer[n].server = server[i].name;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (!server[i].down) {
-+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
-+ } else {
-+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
-+ }
-+#endif
- n++;
- }
- }
-@@ -144,6 +155,15 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[n].fail_timeout = server[i].fail_timeout;
- peer[n].down = server[i].down;
- peer[n].server = server[i].name;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (!server[i].down) {
-+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
-+ }
-+ else {
-+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
-+ }
-+#endif
- n++;
- }
- }
-@@ -203,6 +223,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[i].current_weight = 0;
- peer[i].max_fails = 1;
- peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- }
-
- us->peer.data = peers;
-@@ -312,7 +335,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
- peer[0].current_weight = 0;
- peer[0].max_fails = 1;
- peer[0].fail_timeout = 10;
--
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- } else {
-
- for (i = 0; i < ur->naddrs; i++) {
-@@ -352,6 +377,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
- peer[i].current_weight = 0;
- peer[i].max_fails = 1;
- peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- }
- }
-
-@@ -411,6 +439,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
- goto failed;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ goto failed;
-+ }
-+#endif
-+
- } else {
-
- /* there are several peers */
-@@ -508,6 +542,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h
-index 9db82a6..6e19a65 100644
---- a/src/http/ngx_http_upstream_round_robin.h
-+++ b/src/http/ngx_http_upstream_round_robin.h
-@@ -31,6 +31,10 @@ typedef struct {
- ngx_uint_t max_fails;
- time_t fail_timeout;
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_uint_t check_index;
-+#endif
-+
- ngx_uint_t down; /* unsigned down:1; */
-
- #if (NGX_HTTP_SSL)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/check_1.7.5+.patch
^
|
@@ -1,195 +0,0 @@
-diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c
-index 148d73a..913e395 100644
---- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
-+++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- typedef struct {
- /* the round robin data must be first */
-@@ -212,6 +215,15 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
- goto next_try;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get ip_hash peer, check_index: %ui",
-+ peer->check_index);
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ goto next_try;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c
-index 623bc9b..a223839 100644
---- a/src/http/modules/ngx_http_upstream_least_conn_module.c
-+++ b/src/http/modules/ngx_http_upstream_least_conn_module.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- typedef struct {
- ngx_uint_t *conns;
-@@ -203,6 +206,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get least_conn peer, check_index: %ui",
-+ peer->check_index);
-+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-@@ -256,6 +269,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "get least_conn peer, check_index: %ui",
-+ peer->check_index);
-+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
- continue;
- }
-diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
-index 2d0649b..b9789eb 100644
---- a/src/http/ngx_http_upstream_round_robin.c
-+++ b/src/http/ngx_http_upstream_round_robin.c
-@@ -9,6 +9,9 @@
- #include <ngx_core.h>
- #include <ngx_http.h>
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
-+#endif
-
- #define ngx_http_upstream_tries(p) ((p)->number \
- + ((p)->next ? (p)->next->number : 0))
-@@ -92,6 +95,14 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[n].fail_timeout = server[i].fail_timeout;
- peer[n].down = server[i].down;
- peer[n].server = server[i].name;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (!server[i].down) {
-+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
-+ } else {
-+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
-+ }
-+#endif
- n++;
- }
- }
-@@ -148,6 +159,15 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[n].fail_timeout = server[i].fail_timeout;
- peer[n].down = server[i].down;
- peer[n].server = server[i].name;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (!server[i].down) {
-+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
-+ }
-+ else {
-+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
-+ }
-+#endif
- n++;
- }
- }
-@@ -207,6 +227,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
- peer[i].current_weight = 0;
- peer[i].max_fails = 1;
- peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- }
-
- us->peer.data = peers;
-@@ -316,7 +339,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
- peer[0].current_weight = 0;
- peer[0].max_fails = 1;
- peer[0].fail_timeout = 10;
--
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- } else {
-
- for (i = 0; i < ur->naddrs; i++) {
-@@ -356,6 +381,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
- peer[i].current_weight = 0;
- peer[i].max_fails = 1;
- peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
-+#endif
- }
- }
-
-@@ -415,6 +443,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
- goto failed;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ goto failed;
-+ }
-+#endif
-+
- } else {
-
- /* there are several peers */
-@@ -507,6 +541,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp)
- continue;
- }
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
-+ continue;
-+ }
-+#endif
-+
- if (peer->max_fails
- && peer->fails >= peer->max_fails
- && now - peer->checked <= peer->fail_timeout)
-diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h
-index 9db82a6..6e19a65 100644
---- a/src/http/ngx_http_upstream_round_robin.h
-+++ b/src/http/ngx_http_upstream_round_robin.h
-@@ -31,6 +31,10 @@ typedef struct {
- ngx_uint_t max_fails;
- time_t fail_timeout;
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ ngx_uint_t check_index;
-+#endif
-+
- ngx_uint_t down; /* unsigned down:1; */
-
- #if (NGX_HTTP_SSL)
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/config
^
|
@@ -3,13 +3,13 @@
ngx_feature_run=no
ngx_feature_incs=
ngx_feature_path="$ngx_addon_dir"
-ngx_feature_deps="$ngx_addon_dir/ngx_http_upstream_check_module.h"
-ngx_check_src="$ngx_addon_dir/ngx_http_upstream_check_module.c"
+ngx_feature_deps="$ngx_addon_dir/ngx_http_upstream_check_module.h $ngx_addon_dir/ngx_http_upstream_check_handler.h"
+ngx_check_src="$ngx_addon_dir/ngx_http_upstream_check_module.c $ngx_addon_dir/ngx_http_upstream_check_handler.c"
ngx_feature_test="int a;"
. auto/feature
if [ $ngx_found = yes ]; then
- have=NGX_HTTP_UPSTREAM_CHECK . auto/have
+ have=NGX_UPSTREAM_CHECK_MODULE . auto/have
CORE_INCS="$CORE_INCS $ngx_feature_path"
ngx_addon_name=ngx_http_upstream_check_module
HTTP_MODULES="$HTTP_MODULES ngx_http_upstream_check_module"
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/doc/README.txt
^
|
@@ -1,6 +1,5 @@
Name
- nginx_http_upstream_check_module - support upstream health check with
- Nginx
+ nginx_http_upstream_check_module - support health check with Nginx
Synopsis
http {
@@ -11,12 +10,12 @@
server 192.168.0.1:80;
server 192.168.0.2:80;
- check interval=5000 rise=1 fall=3 timeout=4000;
+ check interval=3000 rise=2 fall=5 timeout=1000;
#check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello;
#check interval=3000 rise=2 fall=5 timeout=1000 type=http;
- #check_http_send "HEAD / HTTP/1.0\r\n\r\n";
+ #check_http_send "GET / HTTP/1.0\r\n\r\n";
#check_http_expect_alive http_2xx http_3xx;
}
@@ -45,7 +44,7 @@
check
syntax: *check interval=milliseconds [fall=count] [rise=count]
[timeout=milliseconds] [default_down=true|false]
- [type=tcp|http|ssl_hello|mysql|ajp|fastcgi]*
+ [type=tcp|http|ssl_hello|mysql|ajp]*
default: *none, if parameters omitted, default parameters are
interval=30000 fall=5 rise=2 timeout=1000 default_down=true type=tcp*
@@ -69,10 +68,6 @@
* *default_down*: set initial state of backend server, default is
down.
- * *port*: specify the check port in the backend servers. It can be
- different with the original servers port. Default the port is 0 and
- it means the same as the original backend server.
-
* *type*: the check protocol type:
1. *tcp* is a simple tcp socket connect and peek one byte.
@@ -89,9 +84,6 @@
5. *ajp* sends a AJP Cping packet, receives and parses the AJP
Cpong response to diagnose if the upstream server is alive.
- 6. *fastcgi* send a fastcgi request, receives and parses the
- fastcgi response to diagnose if the upstream server is alive.
-
check_http_send
syntax: *check_http_send http_packet*
@@ -113,36 +105,10 @@
description: These status codes indicate the upstream server's http
response is ok, the backend is alive.
- check_keepalive_requests
- syntax: *check_keepalive_requests num*
-
- default: *check_keepalive_requests 1*
-
- context: *upstream*
-
- description: The directive specifies the number of requests sent on a
- connection, the default vaule 1 indicates that nginx will certainly
- close the connection after a request.
-
- check_fastcgi_param
- Syntax: *check_fastcgi_params parameter value*
-
- default: see below
-
- context: *upstream*
-
- description: If you set the check type is fastcgi, then the check
- function will sends this fastcgi headers to check the upstream server.
- The default directive looks like:
-
- check_fastcgi_param "REQUEST_METHOD" "GET";
- check_fastcgi_param "REQUEST_URI" "/";
- check_fastcgi_param "SCRIPT_FILENAME" "index.php";
-
check_shm_size
syntax: *check_shm_size size*
- default: *1M*
+ default: *1m*
context: *http*
@@ -151,7 +117,7 @@
enlarge it with this directive.
check_status
- syntax: *check_status [html|csv|json]*
+ syntax: *check_status*
default: *none*
@@ -160,60 +126,6 @@
description: Display the health checking servers' status by HTTP. This
directive should be set in the http block.
- You can specify the default display format. The formats can be `html`,
- `csv` or `json`. The default type is `html`. It also supports to specify
- the format by the request argument. Suppose your `check_status` location
- is '/status', the argument of `format` can change the display page's
- format. You can do like this:
-
- /status?format=html
- /status?format=csv
- /status?format=json
-
- At present, you can fetch the list of servers with the same status by
- the argument of `status`. For example:
-
- /status?format=html&status=down
- /status?format=csv&status=up
-
- Below it's the sample html page:
-
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <title>Nginx http upstream check status</title>
- <h1>Nginx http upstream check status</h1>
- <h2>Check upstream server number: 1, generation: 3</h2>
- <th>Index</th>
- <th>Upstream</th>
- <th>Name</th>
- <th>Status</th>
- <th>Rise counts</th>
- <th>Fall counts</th>
- <th>Check type</th>
- <th>Check port</th>
- <td>0</td>
- <td>backend</td>
- <td>106.187.48.116:80</td>
- <td>up</td>
- <td>39</td>
- <td>0</td>
- <td>http</td>
- <td>80</td>
-
- Below it's the sample of csv page:
-
- 0,backend,106.187.48.116:80,up,46,0,http,80
-
- Below it's the sample of json page:
-
- {"servers": {
- "total": 1,
- "generation": 3,
- "server": [
- {"index": 0, "upstream": "backend", "name": "106.187.48.116:80", "status": "up", "rise": 58, "fall": 0, "type": "http", "port": 80}
- ]
- }}
-
Installation
Download the latest version of the release tarball of this module from
github (<http://github.com/yaoweibin/nginx_upstream_check_module>)
@@ -243,12 +155,6 @@
If you use nginx-1.2.6+ or nginx-1.3.9+, It adjusted the round robin
module. You should use the patch named 'check_1.2.6+.patch'.
- If you use nginx-1.5.12+, You should use the patch named
- 'check_1.5.12+.patch'.
-
- If you use nginx-1.7.2+, You should use the patch named
- 'check_1.7.2+.patch'.
-
The patch just adds the support for the official Round-Robin, Ip_hash
and least_conn upstream module. But it's easy to expand my module to
other upstream modules. See the patch for detail.
@@ -286,13 +192,6 @@
TODO
Known Issues
Changelogs
- v0.3
- * support keepalive check requests
-
- * fastcgi check requests
-
- * json/csv check status page support
-
v0.1
* first release
@@ -310,15 +209,9 @@
This module is licensed under the BSD license.
- Copyright (C) 2014 by Weibin Yao <yaoweibin@gmail.com>
-
- Copyright (C) 2010-2014 Alibaba Group Holding Limited
-
- Copyright (C) 2014 by LiangBin Li
-
- Copyright (C) 2014 by Zhuo Yuan
+ Copyright (C) 2012 by Weibin Yao <yaoweibin@gmail.com>.
- Copyright (C) 2012 by Matthieu Tourne
+ Copyright (C) 2012 by Matthieu Tourne.
All rights reserved.
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/doc/README.wiki
^
|
@@ -1,6 +1,6 @@
= Name =
-'''nginx_http_upstream_check_module''' - support upstream health check with Nginx
+'''nginx_http_upstream_check_module''' - support health check with Nginx
= Synopsis =
@@ -14,12 +14,12 @@
server 192.168.0.1:80;
server 192.168.0.2:80;
- check interval=5000 rise=1 fall=3 timeout=4000;
+ check interval=3000 rise=2 fall=5 timeout=1000;
#check interval=3000 rise=2 fall=5 timeout=1000 type=ssl_hello;
#check interval=3000 rise=2 fall=5 timeout=1000 type=http;
- #check_http_send "HEAD / HTTP/1.0\r\n\r\n";
+ #check_http_send "GET / HTTP/1.0\r\n\r\n";
#check_http_expect_alive http_2xx http_3xx;
}
@@ -50,29 +50,27 @@
== check ==
-'''syntax:''' ''check interval=milliseconds [fall=count] [rise=count] [timeout=milliseconds] [default_down=true|false] [type=tcp|http|ssl_hello|mysql|ajp|fastcgi]''
+'''syntax:''' ''check interval=milliseconds [fall=count] [rise=count] [timeout=milliseconds] [default_down=true|false] [type=tcp|http|ssl_hello|mysql|ajp]''
'''default:''' ''none, if parameters omitted, default parameters are interval=30000 fall=5 rise=2 timeout=1000 default_down=true type=tcp''
'''context:''' ''upstream''
-'''description:''' Add the health check for the upstream servers.
+'''description:''' Add the health check for the upstream servers.
The parameters' meanings are:
* ''interval'': the check request's interval time.
-* ''fall''(fall_count): After fall_count check failures, the server is marked down.
-* ''rise''(rise_count): After rise_count check success, the server is marked up.
+* ''fall''(fall_count): After fall_count check failures, the server is marked down.
+* ''rise''(rise_count): After rise_count check success, the server is marked up.
* ''timeout'': the check request's timeout.
* ''default_down'': set initial state of backend server, default is down.
-* ''port'': specify the check port in the backend servers. It can be different with the original servers port. Default the port is 0 and it means the same as the original backend server.
* ''type'': the check protocol type:
-# ''tcp'' is a simple tcp socket connect and peek one byte.
+# ''tcp'' is a simple tcp socket connect and peek one byte.
# ''ssl_hello'' sends a client ssl hello packet and receives the server ssl hello packet.
-# ''http'' sends a http request packet, receives and parses the http response to diagnose if the upstream server is alive.
-# ''mysql'' connects to the mysql server, receives the greeting response to diagnose if the upstream server is alive.
-# ''ajp'' sends a AJP Cping packet, receives and parses the AJP Cpong response to diagnose if the upstream server is alive.
-# ''fastcgi'' send a fastcgi request, receives and parses the fastcgi response to diagnose if the upstream server is alive.
+# ''http'' sends a http request packet, receives and parses the http response to diagnose if the upstream server is alive.
+# ''mysql'' connects to the mysql server, receives the greeting response to diagnose if the upstream server is alive.
+# ''ajp'' sends a AJP Cping packet, receives and parses the AJP Cpong response to diagnose if the upstream server is alive.
== check_http_send ==
@@ -94,37 +92,11 @@
'''description:''' These status codes indicate the upstream server's http response is ok, the backend is alive.
-== check_keepalive_requests ==
-
-'''syntax:''' ''check_keepalive_requests num''
-
-'''default:''' ''check_keepalive_requests 1''
-
-'''context:''' ''upstream''
-
-'''description:''' The directive specifies the number of requests sent on a connection, the default vaule 1 indicates that nginx will certainly close the connection after a request.
-
-== check_fastcgi_param ==
-
-'''Syntax:''' ''check_fastcgi_params parameter value''
-
-'''default:''' see below
-
-'''context:''' ''upstream''
-
-'''description:''' If you set the check type is fastcgi, then the check function will sends this fastcgi headers to check the upstream server. The default directive looks like:
-
-<geshi lang="nginx">
- check_fastcgi_param "REQUEST_METHOD" "GET";
- check_fastcgi_param "REQUEST_URI" "/";
- check_fastcgi_param "SCRIPT_FILENAME" "index.php";
-</geshi>
-
== check_shm_size ==
'''syntax:''' ''check_shm_size size''
-'''default:''' ''1M''
+'''default:''' ''1m''
'''context:''' ''http''
@@ -132,7 +104,7 @@
== check_status ==
-'''syntax:''' ''check_status [html|csv|json]''
+'''syntax:''' ''check_status''
'''default:''' ''none''
@@ -140,77 +112,6 @@
'''description:''' Display the health checking servers' status by HTTP. This directive should be set in the http block.
-You can specify the default display format. The formats can be `html`, `csv` or `json`. The default type is `html`. It also supports to specify the format by the request argument. Suppose your `check_status` location is '/status', the argument of `format` can change the display page's format. You can do like this:
-
-<geshi lang="bash">
- /status?format=html
- /status?format=csv
- /status?format=json
-</geshi>
-
-At present, you can fetch the list of servers with the same status by the argument of `status`. For example:
-
-<geshi lang="bash">
- /status?format=html&status=down
- /status?format=csv&status=up
-</geshi>
-
-Below it's the sample html page:
-
-<geshi lang="bash">
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <title>Nginx http upstream check status</title>
- </head>
- <body>
- <h1>Nginx http upstream check status</h1>
- <h2>Check upstream server number: 1, generation: 3</h2>
- <table style="background-color:white" cellspacing="0" cellpadding="3" border="1">
- <tr bgcolor="#C0C0C0">
- <th>Index</th>
- <th>Upstream</th>
- <th>Name</th>
- <th>Status</th>
- <th>Rise counts</th>
- <th>Fall counts</th>
- <th>Check type</th>
- <th>Check port</th>
- </tr>
- <tr>
- <td>0</td>
- <td>backend</td>
- <td>106.187.48.116:80</td>
- <td>up</td>
- <td>39</td>
- <td>0</td>
- <td>http</td>
- <td>80</td>
- </tr>
- </table>
- </body>
- </html>
-
-Below it's the sample of csv page:
-
-<geshi lang="bash">
- 0,backend,106.187.48.116:80,up,46,0,http,80
-</geshi>
-
-Below it's the sample of json page:
-
-<geshi lang="bash">
- {"servers": {
- "total": 1,
- "generation": 3,
- "server": [
- {"index": 0, "upstream": "backend", "name": "106.187.48.116:80", "status": "up", "rise": 58, "fall": 0, "type": "http", "port": 80}
- ]
- }}
-</geshi>
-
-
= Installation =
Download the latest version of the release tarball of this module from [http://github.com/yaoweibin/nginx_upstream_check_module github]
@@ -237,10 +138,6 @@
If you use nginx-1.2.6+ or nginx-1.3.9+, It adjusted the round robin module. You should use the patch named 'check_1.2.6+.patch'.
-If you use nginx-1.5.12+, You should use the patch named 'check_1.5.12+.patch'.
-
-If you use nginx-1.7.2+, You should use the patch named 'check_1.7.2+.patch'.
-
The patch just adds the support for the official Round-Robin, Ip_hash and least_conn upstream module. But it's easy to expand my module to other upstream modules. See the patch for detail.
If you want to add the support for upstream fair module, you can do it like this:
@@ -268,8 +165,8 @@
</geshi>
Note that, the nginx-sticky-module also needs the original check.patch.
-
-
+
+
= Compatibility =
* The module version 0.1.5 should be compatibility with 0.7.67+
@@ -283,11 +180,6 @@
= Changelogs =
-== v0.3 ==
-* support keepalive check requests
-* fastcgi check requests
-* json/csv check status page support
-
== v0.1 ==
* first release
@@ -295,7 +187,7 @@
Weibin Yao(姚伟斌) ''yaoweibin at gmail dot com''
-Matthieu Tourne
+Matthieu Tourne
= Copyright & License =
@@ -306,15 +198,9 @@
This module is licensed under the BSD license.
-Copyright (C) 2014 by Weibin Yao <yaoweibin@gmail.com>
-
-Copyright (C) 2010-2014 Alibaba Group Holding Limited
-
-Copyright (C) 2014 by LiangBin Li
-
-Copyright (C) 2014 by Zhuo Yuan
+Copyright (C) 2012 by Weibin Yao <yaoweibin@gmail.com>.
-Copyright (C) 2012 by Matthieu Tourne
+Copyright (C) 2012 by Matthieu Tourne.
All rights reserved.
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/nginx-sticky-module.patch
^
|
@@ -6,8 +6,8 @@
#include "ngx_http_sticky_misc.h"
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
+
@@ -18,12 +18,12 @@
return NGX_BUSY;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get sticky peer, check_index: %ui",
+ peer->check_index);
+
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ return NGX_BUSY;
+ }
+#endif
@@ -35,12 +35,12 @@
/* ensure the peer is not marked as down */
if (!peer->down) {
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
+ "get sticky peer, check_index: %ui",
+ peer->check_index);
+
-+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
++ if (!ngx_http_check_peer_down(peer->check_index)) {
+#endif
+
/* if it's not failedi, use it */
@@ -50,7 +50,7 @@
/* mark the peer as tried */
iphp->rrp.tried[n] |= m;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ }
+#endif
}
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/nginx-tests
^
|
-(directory)
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/nginx-tests/fastcgi_check.t
^
|
@@ -1,370 +0,0 @@
-#!/usr/bin/perl
-
-use warnings;
-use strict;
-
-use Test::More;
-
-BEGIN { use FindBin; chdir($FindBin::Bin); }
-
-use lib 'lib';
-use Test::Nginx;
-
-###############################################################################
-
-select STDERR; $| = 1;
-select STDOUT; $| = 1;
-
-eval { require FCGI; };
-plan(skip_all => 'FCGI not installed') if $@;
-plan(skip_all => 'win32') if $^O eq 'MSWin32';
-
-my $t = Test::Nginx->new()->has(qw/http fastcgi/)->plan(30)
- ->write_file_expand('nginx.conf', <<'EOF');
-
-%%TEST_GLOBALS%%
-
-daemon off;
-
-events {
-}
-
-http {
- %%TEST_GLOBALS_HTTP%%
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
-
- location / {
- fastcgi_pass 127.0.0.1:8081;
- fastcgi_param REQUEST_URI $request_uri;
- }
- }
-}
-
-EOF
-
-$t->run_daemon(\&fastcgi_daemon);
-$t->run();
-
-###############################################################################
-
-like(http_get('/'), qr/SEE-THIS/, 'fastcgi request');
-like(http_get('/redir'), qr/302/, 'fastcgi redirect');
-like(http_get('/'), qr/^3$/m, 'fastcgi third request');
-
-unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD');
-
-like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled');
-
-$t->stop();
-$t->stop_daemons();
-
-###############################################################################
-
-$t->write_file_expand('nginx.conf', <<'EOF');
-
-%%TEST_GLOBALS%%
-
-daemon off;
-
-worker_processes auto;
-
-events {
- accept_mutex off;
-}
-
-http {
- %%TEST_GLOBALS_HTTP%%
-
- upstream fastcgi {
- server 127.0.0.1:8081;
- check interval=3000 rise=2 fall=3 timeout=1000 type=fastcgi default_down=false;
- check_fastcgi_param "REQUEST_METHOD" "GET";
- check_fastcgi_param "REQUEST_URI" "/redir";
- check_http_expect_alive http_3xx;
- }
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
-
- location / {
- fastcgi_pass fastcgi;
- fastcgi_param REQUEST_URI $request_uri;
- }
- }
-}
-
-EOF
-
-$t->run();
-$t->run_daemon(\&fastcgi_daemon);
-
-###############################################################################
-
-like(http_get('/'), qr/SEE-THIS/, 'fastcgi request default_down=false');
-like(http_get('/redir'), qr/302/, 'fastcgi redirect default_down=false');
-like(http_get('/'), qr/^3$/m, 'fastcgi third request default_down=false');
-
-unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD default_down=false');
-
-like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled default_down=false');
-
-$t->stop();
-$t->stop_daemons();
-
-###############################################################################
-
-$t->write_file_expand('nginx.conf', <<'EOF');
-
-%%TEST_GLOBALS%%
-
-daemon off;
-
-worker_processes auto;
-
-events {
- accept_mutex off;
-}
-
-http {
- %%TEST_GLOBALS_HTTP%%
-
- upstream fastcgi {
- server 127.0.0.1:8081;
- check interval=3000 rise=2 fall=3 timeout=1000 type=fastcgi;
- check_fastcgi_param "REQUEST_METHOD" "GET";
- check_fastcgi_param "REQUEST_URI" "/redir";
- check_http_expect_alive http_3xx;
- }
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
-
- location / {
- fastcgi_pass fastcgi;
- fastcgi_param REQUEST_URI $request_uri;
- }
- }
-}
-
-EOF
-
-$t->run();
-$t->run_daemon(\&fastcgi_daemon);
-
-###############################################################################
-
-like(http_get('/'), qr/502/m, 'fastcgi request default_down=true');
-like(http_get('/redir'), qr/502/m, 'fastcgi redirect default_down=true');
-like(http_get('/'), qr/502/m, 'fastcgi third request default_down=true');
-like(http_head('/'), qr/502/m, 'no data in HEAD default_down=true');
-like(http_get('/stderr'), qr/502/m, 'large stderr handled default_down=true');
-
-$t->stop();
-$t->stop_daemons();
-
-###############################################################################
-
-$t->write_file_expand('nginx.conf', <<'EOF');
-
-%%TEST_GLOBALS%%
-
-daemon off;
-
-worker_processes auto;
-
-events {
- accept_mutex off;
-}
-
-http {
- %%TEST_GLOBALS_HTTP%%
-
- upstream fastcgi {
- server 127.0.0.1:8081;
- check interval=3000 rise=2 fall=3 timeout=1000 type=fastcgi;
- check_fastcgi_param "REQUEST_METHOD" "GET";
- check_fastcgi_param "REQUEST_URI" "/redir";
- check_http_expect_alive http_3xx;
- }
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
-
- location / {
- fastcgi_pass fastcgi;
- fastcgi_param REQUEST_URI $request_uri;
- }
- }
-}
-
-EOF
-
-$t->run();
-$t->run_daemon(\&fastcgi_daemon);
-
-###############################################################################
-
-sleep(5);
-
-like(http_get('/'), qr/SEE-THIS/, 'fastcgi request default_down=false check 302');
-like(http_get('/redir'), qr/302/, 'fastcgi redirect default_down=false check 302');
-like(http_get('/'), qr/^\d$/m, 'fastcgi third request default_down=false check 302');
-
-unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD default_down=false check 302');
-
-like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled default_down=false check 302');
-
-$t->stop();
-$t->stop_daemons();
-
-
-###############################################################################
-
-$t->write_file_expand('nginx.conf', <<'EOF');
-
-%%TEST_GLOBALS%%
-
-daemon off;
-
-worker_processes auto;
-
-events {
- accept_mutex off;
-}
-
-http {
- %%TEST_GLOBALS_HTTP%%
-
- upstream fastcgi {
- server 127.0.0.1:8081;
- check interval=1000 rise=1 fall=1 timeout=1000 type=fastcgi;
- check_fastcgi_param "REQUEST_METHOD" "GET";
- check_fastcgi_param "REQUEST_URI" "/404";
- check_http_expect_alive http_2xx;
- }
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
-
- location / {
- fastcgi_pass fastcgi;
- fastcgi_param REQUEST_URI $request_uri;
- }
- }
-}
-
-EOF
-
-$t->run();
-$t->run_daemon(\&fastcgi_daemon);
-
-###############################################################################
-
-sleep(5);
-
-like(http_get('/'), qr/502/m, 'fastcgi request default_down=true check status heaer');
-like(http_get('/redir'), qr/502/m, 'fastcgi redirect default_down=true check status heaer');
-like(http_get('/'), qr/502/m, 'fastcgi third request default_down=true check status heaer');
-like(http_head('/'), qr/502/m, 'no data in HEAD default_down=true check status heaer');
-like(http_get('/stderr'), qr/502/m, 'large stderr handled default_down=true check status heaer');
-
-$t->stop();
-$t->stop_daemons();
-
-
-###############################################################################
-
-$t->write_file_expand('nginx.conf', <<'EOF');
-
-%%TEST_GLOBALS%%
-
-daemon off;
-
-worker_processes auto;
-
-events {
- accept_mutex off;
-}
-
-http {
- %%TEST_GLOBALS_HTTP%%
-
- upstream fastcgi {
- server 127.0.0.1:8081;
- check interval=1000 rise=1 fall=1 timeout=1000 type=fastcgi;
- check_fastcgi_param "REQUEST_METHOD" "GET";
- check_fastcgi_param "REQUEST_URI" "/";
- check_http_expect_alive http_4xx;
- }
-
- server {
- listen 127.0.0.1:8080;
- server_name localhost;
-
- location / {
- fastcgi_pass fastcgi;
- fastcgi_param REQUEST_URI $request_uri;
- }
- }
-}
-
-EOF
-
-$t->run();
-$t->run_daemon(\&fastcgi_daemon);
-
-###############################################################################
-
-sleep(5);
-
-like(http_get('/'), qr/SEE-THIS/, 'fastcgi request default_down=false without status header');
-like(http_get('/redir'), qr/302/, 'fastcgi redirect default_down=false without status header');
-like(http_get('/'), qr/^\d$/m, 'fastcgi third request default_down=false without status header');
-
-unlike(http_head('/'), qr/SEE-THIS/, 'no data in HEAD default_down=false without status header');
-
-like(http_get('/stderr'), qr/SEE-THIS/, 'large stderr handled default_down=false without status header');
-
-$t->stop();
-$t->stop_daemons();
-
-
-###############################################################################
-
-sub fastcgi_daemon {
- my $socket = FCGI::OpenSocket('127.0.0.1:8081', 5);
- my $request = FCGI::Request(\*STDIN, \*STDOUT, \*STDERR, \%ENV,
- $socket);
-
- my $count;
- while ( $request->Accept() >= 0 ) {
- $count++;
-
- if ($ENV{REQUEST_URI} eq '/stderr') {
- warn "sample stderr text" x 512;
- }
-
- if ($ENV{REQUEST_URI} eq '/404') {
- print <<EOF;
-Status: 404
-EOF
- }
-
- print <<EOF;
-Location: http://127.0.0.1:8080/redirect
-Content-Type: text/html
-
-SEE-THIS
-$count
-EOF
- }
-
- FCGI::CloseSocket($socket);
-}
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/ngx_http_upstream_check_handler.c
^
|
@@ -55,9 +55,9 @@
static ngx_shm_zone_t * ngx_shared_memory_find(ngx_cycle_t *cycle,
ngx_str_t *name, void *tag);
static ngx_http_check_peer_shm_t * ngx_http_check_find_shm_peer(
- ngx_http_check_peers_shm_t *peers_shm, ngx_addr_t *addr,ngx_str_t *upstream_name);
+ ngx_http_check_peers_shm_t *peers_shm, ngx_addr_t *addr);
static void ngx_http_check_set_shm_peer(ngx_http_check_peer_shm_t *peer_shm,
- ngx_http_check_peer_shm_t *opeer_shm, ngx_uint_t init_down,ngx_str_t *upstream_name);
+ ngx_http_check_peer_shm_t *opeer_shm, ngx_uint_t init_down);
static ngx_int_t ngx_http_upstream_check_init_shm_zone(
ngx_shm_zone_t *shm_zone, void *data);
@@ -1443,19 +1443,21 @@
if (opeers_shm) {
- opeer_shm = ngx_http_check_find_shm_peer(opeers_shm,peer[i].peer_addr,peer[i].upstream_name);
+ opeer_shm = ngx_http_check_find_shm_peer(opeers_shm,
+ peer[i].peer_addr);
if (opeer_shm) {
ngx_log_debug1(NGX_LOG_DEBUG_HTTP, shm_zone->shm.log, 0,
"http upstream check: inherit opeer:%V",
&peer[i].peer_addr->name);
- ngx_http_check_set_shm_peer(peer_shm, opeer_shm, 0,peer[i].upstream_name);
+ ngx_http_check_set_shm_peer(peer_shm, opeer_shm, 0);
+
continue;
}
}
ucscf = peer[i].conf;
- ngx_http_check_set_shm_peer(peer_shm, NULL, ucscf->default_down,peer[i].upstream_name);
+ ngx_http_check_set_shm_peer(peer_shm, NULL, ucscf->default_down);
}
peers->peers_shm = peers_shm;
@@ -1473,8 +1475,7 @@
static ngx_http_check_peer_shm_t *
ngx_http_check_find_shm_peer(ngx_http_check_peers_shm_t *peers_shm,
- ngx_addr_t *addr,
- ngx_str_t *upstream_name)
+ ngx_addr_t *addr)
{
ngx_uint_t i;
ngx_http_check_peer_shm_t *peer_shm;
@@ -1483,12 +1484,11 @@
peer_shm = &peers_shm->peers[i];
- if (addr->socklen != peer_shm->socklen) {
- continue;
+ if (addr->socklen != peer_shm->socklen) {
+ continue;
}
-
- if (ngx_memcmp(addr->sockaddr, peer_shm->sockaddr, addr->socklen) == 0 && ngx_strcmp(upstream_name->data,peer_shm->upstream_name->data) == 0)
- {
+
+ if (ngx_memcmp(addr->sockaddr, peer_shm->sockaddr, addr->socklen) == 0) {
return peer_shm;
}
}
@@ -1500,8 +1500,7 @@
static void
ngx_http_check_set_shm_peer(ngx_http_check_peer_shm_t *peer_shm,
ngx_http_check_peer_shm_t *opeer_shm,
- ngx_uint_t init_down,
- ngx_str_t *upstream_name)
+ ngx_uint_t init_down)
{
if (opeer_shm) {
@@ -1524,7 +1523,6 @@
peer_shm->down = init_down;
}
- peer_shm->upstream_name = upstream_name;
}
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/ngx_http_upstream_check_handler.h
^
|
@@ -72,7 +72,6 @@
ngx_atomic_t down;
ngx_uint_t access_count;
- ngx_str_t *upstream_name;
struct sockaddr *sockaddr;
socklen_t socklen;
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/ngx_http_upstream_check_module.c
^
|
@@ -1,3067 +1,175 @@
-/*
- * Copyright (C) 2010-2014 Weibin Yao (yaoweibin@gmail.com)
- * Copyright (C) 2010-2014 Alibaba Group Holding Limited
- */
+#include <ngx_core.h>
+#include <ngx_http.h>
+#include <ngx_config.h>
+#include <ngx_murmurhash.h>
+#include <ngx_http_upstream.h>
+#include "ngx_http_upstream_check_module.h"
+#include "ngx_http_upstream_check_handler.h"
-#include <nginx.h>
-#include "ngx_http_upstream_check_module.h"
-
-
-typedef struct ngx_http_upstream_check_peer_s ngx_http_upstream_check_peer_t;
-typedef struct ngx_http_upstream_check_srv_conf_s
- ngx_http_upstream_check_srv_conf_t;
-
-
-#pragma pack(push, 1)
-
-typedef struct {
- u_char major;
- u_char minor;
-} ngx_ssl_protocol_version_t;
-
-
-typedef struct {
- u_char msg_type;
- ngx_ssl_protocol_version_t version;
- uint16_t length;
-
- u_char handshake_type;
- u_char handshake_length[3];
- ngx_ssl_protocol_version_t hello_version;
-
- time_t time;
- u_char random[28];
-
- u_char others[0];
-} ngx_ssl_server_hello_t;
-
-
-typedef struct {
- u_char packet_length[3];
- u_char packet_number;
-
- u_char protocol_version;
- u_char others[0];
-} ngx_mysql_handshake_init_t;
-
-
-typedef struct {
- uint16_t preamble;
- uint16_t length;
- u_char type;
-} ngx_ajp_raw_packet_t;
-
-#pragma pack()
-
-
-typedef struct {
- ngx_buf_t send;
- ngx_buf_t recv;
-
- ngx_uint_t state;
- ngx_http_status_t status;
-
- size_t padding;
- size_t length;
-} ngx_http_upstream_check_ctx_t;
-
-
-typedef struct {
- ngx_shmtx_t mutex;
-#if (nginx_version >= 1002000)
- ngx_shmtx_sh_t lock;
-#else
- ngx_atomic_t lock;
-#endif
-
- ngx_pid_t owner;
-
- ngx_msec_t access_time;
-
- ngx_uint_t fall_count;
- ngx_uint_t rise_count;
-
- ngx_uint_t busyness;
- ngx_uint_t access_count;
- ngx_str_t *upstream_name;
-
- struct sockaddr *sockaddr;
- socklen_t socklen;
-
- ngx_atomic_t down;
-
- u_char padding[64];
-} ngx_http_upstream_check_peer_shm_t;
-
-
-typedef struct {
- ngx_uint_t generation;
- ngx_uint_t checksum;
- ngx_uint_t number;
-
- /* ngx_http_upstream_check_status_peer_t */
- ngx_http_upstream_check_peer_shm_t peers[1];
-} ngx_http_upstream_check_peers_shm_t;
-
-
-#define NGX_HTTP_CHECK_CONNECT_DONE 0x0001
-#define NGX_HTTP_CHECK_SEND_DONE 0x0002
-#define NGX_HTTP_CHECK_RECV_DONE 0x0004
-#define NGX_HTTP_CHECK_ALL_DONE 0x0008
-
-
-typedef ngx_int_t (*ngx_http_upstream_check_packet_init_pt)
- (ngx_http_upstream_check_peer_t *peer);
-typedef ngx_int_t (*ngx_http_upstream_check_packet_parse_pt)
- (ngx_http_upstream_check_peer_t *peer);
-typedef void (*ngx_http_upstream_check_packet_clean_pt)
- (ngx_http_upstream_check_peer_t *peer);
-
-struct ngx_http_upstream_check_peer_s {
- ngx_flag_t state;
- ngx_pool_t *pool;
- ngx_uint_t index;
- ngx_uint_t max_busy;
- ngx_str_t *upstream_name;
- ngx_addr_t *check_peer_addr;
- ngx_addr_t *peer_addr;
- ngx_event_t check_ev;
- ngx_event_t check_timeout_ev;
- ngx_peer_connection_t pc;
-
- void *check_data;
- ngx_event_handler_pt send_handler;
- ngx_event_handler_pt recv_handler;
-
- ngx_http_upstream_check_packet_init_pt init;
- ngx_http_upstream_check_packet_parse_pt parse;
- ngx_http_upstream_check_packet_clean_pt reinit;
-
- ngx_http_upstream_check_peer_shm_t *shm;
- ngx_http_upstream_check_srv_conf_t *conf;
-};
-
-
-typedef struct {
- ngx_str_t check_shm_name;
- ngx_uint_t checksum;
- ngx_array_t peers;
-
- ngx_http_upstream_check_peers_shm_t *peers_shm;
-} ngx_http_upstream_check_peers_t;
-
-
-#define NGX_HTTP_CHECK_TCP 0x0001
-#define NGX_HTTP_CHECK_HTTP 0x0002
-#define NGX_HTTP_CHECK_SSL_HELLO 0x0004
-#define NGX_HTTP_CHECK_MYSQL 0x0008
-#define NGX_HTTP_CHECK_AJP 0x0010
-
-#define NGX_CHECK_HTTP_2XX 0x0002
-#define NGX_CHECK_HTTP_3XX 0x0004
-#define NGX_CHECK_HTTP_4XX 0x0008
-#define NGX_CHECK_HTTP_5XX 0x0010
-#define NGX_CHECK_HTTP_ERR 0x8000
-
-typedef struct {
- ngx_uint_t type;
-
- ngx_str_t name;
-
- ngx_str_t default_send;
-
- /* HTTP */
- ngx_uint_t default_status_alive;
-
- ngx_event_handler_pt send_handler;
- ngx_event_handler_pt recv_handler;
-
- ngx_http_upstream_check_packet_init_pt init;
- ngx_http_upstream_check_packet_parse_pt parse;
- ngx_http_upstream_check_packet_clean_pt reinit;
-
- unsigned need_pool;
- unsigned need_keepalive;
-} ngx_check_conf_t;
-
-
-typedef void (*ngx_http_upstream_check_status_format_pt) (ngx_buf_t *b,
- ngx_http_upstream_check_peers_t *peers, ngx_uint_t flag);
-
-typedef struct {
- ngx_str_t format;
- ngx_str_t content_type;
-
- ngx_http_upstream_check_status_format_pt output;
-} ngx_check_status_conf_t;
-
-
-#define NGX_CHECK_STATUS_DOWN 0x0001
-#define NGX_CHECK_STATUS_UP 0x0002
-
-typedef struct {
- ngx_check_status_conf_t *format;
- ngx_flag_t flag;
-} ngx_http_upstream_check_status_ctx_t;
-
-
-typedef ngx_int_t (*ngx_http_upstream_check_status_command_pt)
- (ngx_http_upstream_check_status_ctx_t *ctx, ngx_str_t *value);
-
-typedef struct {
- ngx_str_t name;
- ngx_http_upstream_check_status_command_pt handler;
-} ngx_check_status_command_t;
-
-
-typedef struct {
- ngx_uint_t check_shm_size;
- ngx_http_upstream_check_peers_t *peers;
-} ngx_http_upstream_check_main_conf_t;
-
-
-struct ngx_http_upstream_check_srv_conf_s {
- ngx_uint_t port;
- ngx_uint_t fall_count;
- ngx_uint_t rise_count;
- ngx_msec_t check_interval;
- ngx_msec_t check_timeout;
- ngx_uint_t check_keepalive_requests;
-
- ngx_check_conf_t *check_type_conf;
- ngx_str_t send;
-
- union {
- ngx_uint_t return_code;
- ngx_uint_t status_alive;
- } code;
-
- ngx_array_t *fastcgi_params;
-
- ngx_uint_t default_down;
-};
-
-
-typedef struct {
- ngx_check_status_conf_t *format;
-} ngx_http_upstream_check_loc_conf_t;
-
-
-typedef struct {
- u_char version;
- u_char type;
- u_char request_id_hi;
- u_char request_id_lo;
- u_char content_length_hi;
- u_char content_length_lo;
- u_char padding_length;
- u_char reserved;
-} ngx_http_fastcgi_header_t;
-
-
-typedef struct {
- u_char role_hi;
- u_char role_lo;
- u_char flags;
- u_char reserved[5];
-} ngx_http_fastcgi_begin_request_t;
-
-
-typedef struct {
- u_char version;
- u_char type;
- u_char request_id_hi;
- u_char request_id_lo;
-} ngx_http_fastcgi_header_small_t;
-
-
-typedef struct {
- ngx_http_fastcgi_header_t h0;
- ngx_http_fastcgi_begin_request_t br;
- ngx_http_fastcgi_header_small_t h1;
-} ngx_http_fastcgi_request_start_t;
-
-
-#define NGX_HTTP_FASTCGI_RESPONDER 1
-
-#define NGX_HTTP_FASTCGI_KEEP_CONN 1
-
-#define NGX_HTTP_FASTCGI_BEGIN_REQUEST 1
-#define NGX_HTTP_FASTCGI_ABORT_REQUEST 2
-#define NGX_HTTP_FASTCGI_END_REQUEST 3
-#define NGX_HTTP_FASTCGI_PARAMS 4
-#define NGX_HTTP_FASTCGI_STDIN 5
-#define NGX_HTTP_FASTCGI_STDOUT 6
-#define NGX_HTTP_FASTCGI_STDERR 7
-#define NGX_HTTP_FASTCGI_DATA 8
-
-
-typedef enum {
- ngx_http_fastcgi_st_version = 0,
- ngx_http_fastcgi_st_type,
- ngx_http_fastcgi_st_request_id_hi,
- ngx_http_fastcgi_st_request_id_lo,
- ngx_http_fastcgi_st_content_length_hi,
- ngx_http_fastcgi_st_content_length_lo,
- ngx_http_fastcgi_st_padding_length,
- ngx_http_fastcgi_st_reserved,
- ngx_http_fastcgi_st_data,
- ngx_http_fastcgi_st_padding
-} ngx_http_fastcgi_state_e;
-
-
-static ngx_http_fastcgi_request_start_t ngx_http_fastcgi_request_start = {
- { 1, /* version */
- NGX_HTTP_FASTCGI_BEGIN_REQUEST, /* type */
- 0, /* request_id_hi */
- 1, /* request_id_lo */
- 0, /* content_length_hi */
- sizeof(ngx_http_fastcgi_begin_request_t), /* content_length_lo */
- 0, /* padding_length */
- 0 }, /* reserved */
-
- { 0, /* role_hi */
- NGX_HTTP_FASTCGI_RESPONDER, /* role_lo */
- 0, /* NGX_HTTP_FASTCGI_KEEP_CONN */ /* flags */
- { 0, 0, 0, 0, 0 } }, /* reserved[5] */
-
- { 1, /* version */
- NGX_HTTP_FASTCGI_PARAMS, /* type */
- 0, /* request_id_hi */
- 1 }, /* request_id_lo */
-
-};
-
-
-static ngx_int_t ngx_http_upstream_check_add_timers(ngx_cycle_t *cycle);
-
-static ngx_int_t ngx_http_upstream_check_peek_one_byte(ngx_connection_t *c);
-
-static void ngx_http_upstream_check_begin_handler(ngx_event_t *event);
-static void ngx_http_upstream_check_connect_handler(ngx_event_t *event);
-
-static void ngx_http_upstream_check_peek_handler(ngx_event_t *event);
-
-static void ngx_http_upstream_check_send_handler(ngx_event_t *event);
-static void ngx_http_upstream_check_recv_handler(ngx_event_t *event);
-
-static void ngx_http_upstream_check_discard_handler(ngx_event_t *event);
-static void ngx_http_upstream_check_dummy_handler(ngx_event_t *event);
-
-static ngx_int_t ngx_http_upstream_check_http_init(
- ngx_http_upstream_check_peer_t *peer);
-static ngx_int_t ngx_http_upstream_check_http_parse(
- ngx_http_upstream_check_peer_t *peer);
-static ngx_int_t ngx_http_upstream_check_parse_status_line(
- ngx_http_upstream_check_ctx_t *ctx, ngx_buf_t *b,
- ngx_http_status_t *status);
-static void ngx_http_upstream_check_http_reinit(
- ngx_http_upstream_check_peer_t *peer);
-
-static ngx_buf_t *ngx_http_upstream_check_create_fastcgi_request(
- ngx_pool_t *pool, ngx_str_t *params, ngx_uint_t num);
-
-static ngx_int_t ngx_http_upstream_check_fastcgi_parse(
- ngx_http_upstream_check_peer_t *peer);
-static ngx_int_t ngx_http_upstream_check_fastcgi_process_record(
- ngx_http_upstream_check_ctx_t *ctx, ngx_buf_t *b,
- ngx_http_status_t *status);
-static ngx_int_t ngx_http_upstream_check_parse_fastcgi_status(
- ngx_http_upstream_check_ctx_t *ctx, ngx_buf_t *b,
- ngx_http_status_t *status);
-
-static ngx_int_t ngx_http_upstream_check_ssl_hello_init(
- ngx_http_upstream_check_peer_t *peer);
-static ngx_int_t ngx_http_upstream_check_ssl_hello_parse(
- ngx_http_upstream_check_peer_t *peer);
-static void ngx_http_upstream_check_ssl_hello_reinit(
- ngx_http_upstream_check_peer_t *peer);
-
-static ngx_int_t ngx_http_upstream_check_mysql_init(
- ngx_http_upstream_check_peer_t *peer);
-static ngx_int_t ngx_http_upstream_check_mysql_parse(
- ngx_http_upstream_check_peer_t *peer);
-static void ngx_http_upstream_check_mysql_reinit(
- ngx_http_upstream_check_peer_t *peer);
-
-static ngx_int_t ngx_http_upstream_check_ajp_init(
- ngx_http_upstream_check_peer_t *peer);
-static ngx_int_t ngx_http_upstream_check_ajp_parse(
- ngx_http_upstream_check_peer_t *peer);
-static void ngx_http_upstream_check_ajp_reinit(
- ngx_http_upstream_check_peer_t *peer);
-
-static void ngx_http_upstream_check_status_update(
- ngx_http_upstream_check_peer_t *peer,
- ngx_int_t result);
-
-static void ngx_http_upstream_check_clean_event(
- ngx_http_upstream_check_peer_t *peer);
-
-static void ngx_http_upstream_check_timeout_handler(ngx_event_t *event);
-static void ngx_http_upstream_check_finish_handler(ngx_event_t *event);
-
-static ngx_int_t ngx_http_upstream_check_need_exit();
-static void ngx_http_upstream_check_clear_all_events();
-
-static ngx_int_t ngx_http_upstream_check_status_handler(
- ngx_http_request_t *r);
-
-static void ngx_http_upstream_check_status_parse_args(ngx_http_request_t *r,
- ngx_http_upstream_check_status_ctx_t *ctx);
-
-static ngx_int_t ngx_http_upstream_check_status_command_format(
- ngx_http_upstream_check_status_ctx_t *ctx, ngx_str_t *value);
-static ngx_int_t ngx_http_upstream_check_status_command_status(
- ngx_http_upstream_check_status_ctx_t *ctx, ngx_str_t *value);
-
-static void ngx_http_upstream_check_status_html_format(ngx_buf_t *b,
- ngx_http_upstream_check_peers_t *peers, ngx_uint_t flag);
-static void ngx_http_upstream_check_status_csv_format(ngx_buf_t *b,
- ngx_http_upstream_check_peers_t *peers, ngx_uint_t flag);
-static void ngx_http_upstream_check_status_json_format(ngx_buf_t *b,
- ngx_http_upstream_check_peers_t *peers, ngx_uint_t flag);
-
-static ngx_int_t ngx_http_upstream_check_addr_change_port(ngx_pool_t *pool,
- ngx_addr_t *dst, ngx_addr_t *src, ngx_uint_t port);
-
-static ngx_check_conf_t *ngx_http_get_check_type_conf(ngx_str_t *str);
-
-static char *ngx_http_upstream_check(ngx_conf_t *cf,
- ngx_command_t *cmd, void *conf);
-static char *ngx_http_upstream_check_keepalive_requests(ngx_conf_t *cf,
- ngx_command_t *cmd, void *conf);
-static char *ngx_http_upstream_check_http_send(ngx_conf_t *cf,
- ngx_command_t *cmd, void *conf);
-static char *ngx_http_upstream_check_http_expect_alive(ngx_conf_t *cf,
- ngx_command_t *cmd, void *conf);
-
-static char *ngx_http_upstream_check_fastcgi_params(ngx_conf_t *cf,
- ngx_command_t *cmd, void *conf);
-
-static char *ngx_http_upstream_check_shm_size(ngx_conf_t *cf,
- ngx_command_t *cmd, void *conf);
-
-static ngx_check_status_conf_t *ngx_http_get_check_status_format_conf(
- ngx_str_t *str);
-static char *ngx_http_upstream_check_status(ngx_conf_t *cf,
- ngx_command_t *cmd, void *conf);
-
-static void *ngx_http_upstream_check_create_main_conf(ngx_conf_t *cf);
-static char *ngx_http_upstream_check_init_main_conf(ngx_conf_t *cf,
- void *conf);
-
-static void *ngx_http_upstream_check_create_srv_conf(ngx_conf_t *cf);
-static char *ngx_http_upstream_check_init_srv_conf(ngx_conf_t *cf, void *conf);
-
-static void *ngx_http_upstream_check_create_loc_conf(ngx_conf_t *cf);
-static char * ngx_http_upstream_check_merge_loc_conf(ngx_conf_t *cf,
- void *parent, void *child);
-
-#define SHM_NAME_LEN 256
-
-static char *ngx_http_upstream_check_init_shm(ngx_conf_t *cf, void *conf);
-
-static ngx_int_t ngx_http_upstream_check_get_shm_name(ngx_str_t *shm_name,
- ngx_pool_t *pool, ngx_uint_t generation);
-static ngx_shm_zone_t *ngx_shared_memory_find(ngx_cycle_t *cycle,
- ngx_str_t *name, void *tag);
-static ngx_http_upstream_check_peer_shm_t *
-ngx_http_upstream_check_find_shm_peer(ngx_http_upstream_check_peers_shm_t *peers_shm,
- ngx_addr_t *addr, ngx_str_t *upstream_name);
-
-static ngx_int_t ngx_http_upstream_check_init_shm_peer(
- ngx_http_upstream_check_peer_shm_t *peer_shm,
- ngx_http_upstream_check_peer_shm_t *opeer_shm,
- ngx_uint_t init_down, ngx_pool_t *pool, ngx_str_t *peer_name,
- ngx_str_t *upstream_name);
-
-static ngx_int_t ngx_http_upstream_check_init_shm_zone(
- ngx_shm_zone_t *shm_zone, void *data);
-
-
-static ngx_int_t ngx_http_upstream_check_init_process(ngx_cycle_t *cycle);
-
-
-static ngx_conf_bitmask_t ngx_check_http_expect_alive_masks[] = {
- { ngx_string("http_2xx"), NGX_CHECK_HTTP_2XX },
- { ngx_string("http_3xx"), NGX_CHECK_HTTP_3XX },
- { ngx_string("http_4xx"), NGX_CHECK_HTTP_4XX },
- { ngx_string("http_5xx"), NGX_CHECK_HTTP_5XX },
- { ngx_null_string, 0 }
-};
-
-
-static ngx_command_t ngx_http_upstream_check_commands[] = {
-
- { ngx_string("check"),
- NGX_HTTP_UPS_CONF|NGX_CONF_1MORE,
- ngx_http_upstream_check,
- 0,
- 0,
- NULL },
-
- { ngx_string("check_keepalive_requests"),
- NGX_HTTP_UPS_CONF|NGX_CONF_TAKE1,
- ngx_http_upstream_check_keepalive_requests,
- 0,
- 0,
- NULL },
-
- { ngx_string("check_http_send"),
- NGX_HTTP_UPS_CONF|NGX_CONF_TAKE1,
- ngx_http_upstream_check_http_send,
- 0,
- 0,
- NULL },
-
- { ngx_string("check_http_expect_alive"),
- NGX_HTTP_UPS_CONF|NGX_CONF_1MORE,
- ngx_http_upstream_check_http_expect_alive,
- 0,
- 0,
- NULL },
-
- { ngx_string("check_fastcgi_param"),
- NGX_HTTP_UPS_CONF|NGX_CONF_TAKE2,
- ngx_http_upstream_check_fastcgi_params,
- 0,
- 0,
- NULL },
-
- { ngx_string("check_shm_size"),
- NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
- ngx_http_upstream_check_shm_size,
- 0,
- 0,
- NULL },
-
- { ngx_string("check_status"),
- NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_TAKE1|NGX_CONF_NOARGS,
- ngx_http_upstream_check_status,
- 0,
- 0,
- NULL },
-
- ngx_null_command
-};
-
-
-static ngx_http_module_t ngx_http_upstream_check_module_ctx = {
- NULL, /* preconfiguration */
- NULL, /* postconfiguration */
-
- ngx_http_upstream_check_create_main_conf,/* create main configuration */
- ngx_http_upstream_check_init_main_conf, /* init main configuration */
-
- ngx_http_upstream_check_create_srv_conf, /* create server configuration */
- NULL, /* merge server configuration */
-
- ngx_http_upstream_check_create_loc_conf, /* create location configuration */
- ngx_http_upstream_check_merge_loc_conf /* merge location configuration */
-};
-
-
-ngx_module_t ngx_http_upstream_check_module = {
- NGX_MODULE_V1,
- &ngx_http_upstream_check_module_ctx, /* module context */
- ngx_http_upstream_check_commands, /* module directives */
- NGX_HTTP_MODULE, /* module type */
- NULL, /* init master */
- NULL, /* init module */
- ngx_http_upstream_check_init_process, /* init process */
- NULL, /* init thread */
- NULL, /* exit thread */
- NULL, /* exit process */
- NULL, /* exit master */
- NGX_MODULE_V1_PADDING
-};
-
-
-static ngx_str_t fastcgi_default_request;
-static ngx_str_t fastcgi_default_params[] = {
- ngx_string("REQUEST_METHOD"), ngx_string("GET"),
- ngx_string("REQUEST_URI"), ngx_string("/"),
- ngx_string("SCRIPT_FILENAME"), ngx_string("index.php"),
-};
-
-
-#define NGX_SSL_RANDOM "NGX_HTTP_CHECK_SSL_HELLO\n\n\n\n"
-
-/*
- * This is the SSLv3 CLIENT HELLO packet used in conjunction with the
- * check type of ssl_hello to ensure that the remote server speaks SSL.
- *
- * Check RFC 2246 (TLSv1.0) sections A.3 and A.4 for details.
- */
-static char sslv3_client_hello_pkt[] = {
- "\x16" /* ContentType : 0x16 = Hanshake */
- "\x03\x00" /* ProtocolVersion : 0x0300 = SSLv3 */
- "\x00\x79" /* ContentLength : 0x79 bytes after this one */
- "\x01" /* HanshakeType : 0x01 = CLIENT HELLO */
- "\x00\x00\x75" /* HandshakeLength : 0x75 bytes after this one */
- "\x03\x00" /* Hello Version : 0x0300 = v3 */
- "\x00\x00\x00\x00" /* Unix GMT Time (s) : filled with <now> (@0x0B) */
- NGX_SSL_RANDOM /* Random : must be exactly 28 bytes */
- "\x00" /* Session ID length : empty (no session ID) */
- "\x00\x4E" /* Cipher Suite Length : 78 bytes after this one */
- "\x00\x01" "\x00\x02" "\x00\x03" "\x00\x04" /* 39 most common ciphers : */
- "\x00\x05" "\x00\x06" "\x00\x07" "\x00\x08" /* 0x01...0x1B, 0x2F...0x3A */
- "\x00\x09" "\x00\x0A" "\x00\x0B" "\x00\x0C" /* This covers RSA/DH, */
- "\x00\x0D" "\x00\x0E" "\x00\x0F" "\x00\x10" /* various bit lengths, */
- "\x00\x11" "\x00\x12" "\x00\x13" "\x00\x14" /* SHA1/MD5, DES/3DES/AES... */
- "\x00\x15" "\x00\x16" "\x00\x17" "\x00\x18"
- "\x00\x19" "\x00\x1A" "\x00\x1B" "\x00\x2F"
- "\x00\x30" "\x00\x31" "\x00\x32" "\x00\x33"
- "\x00\x34" "\x00\x35" "\x00\x36" "\x00\x37"
- "\x00\x38" "\x00\x39" "\x00\x3A"
- "\x01" /* Compression Length : 0x01 = 1 byte for types */
- "\x00" /* Compression Type : 0x00 = NULL compression */
-};
-
-
-#define NGX_SSL_HANDSHAKE 0x16
-#define NGX_SSL_SERVER_HELLO 0x02
-
-
-#define NGX_AJP_CPING 0x0a
-#define NGX_AJP_CPONG 0x09
-
-
-static char ngx_ajp_cping_packet[] = {
- 0x12, 0x34, 0x00, 0x01, NGX_AJP_CPING, 0x00
-};
-
-static char ngx_ajp_cpong_packet[] = {
- 0x41, 0x42, 0x00, 0x01, NGX_AJP_CPONG
-};
-
-
-static ngx_check_conf_t ngx_check_types[] = {
-
- { NGX_HTTP_CHECK_TCP,
- ngx_string("tcp"),
- ngx_null_string,
- 0,
- ngx_http_upstream_check_peek_handler,
- ngx_http_upstream_check_peek_handler,
- NULL,
- NULL,
- NULL,
- 0,
- 1 },
-
- { NGX_HTTP_CHECK_HTTP,
- ngx_string("http"),
- ngx_string("GET / HTTP/1.0\r\n\r\n"),
- NGX_CONF_BITMASK_SET | NGX_CHECK_HTTP_2XX | NGX_CHECK_HTTP_3XX,
- ngx_http_upstream_check_send_handler,
- ngx_http_upstream_check_recv_handler,
- ngx_http_upstream_check_http_init,
- ngx_http_upstream_check_http_parse,
- ngx_http_upstream_check_http_reinit,
- 1,
- 1 },
-
- { NGX_HTTP_CHECK_HTTP,
- ngx_string("fastcgi"),
- ngx_null_string,
- 0,
- ngx_http_upstream_check_send_handler,
- ngx_http_upstream_check_recv_handler,
- ngx_http_upstream_check_http_init,
- ngx_http_upstream_check_fastcgi_parse,
- ngx_http_upstream_check_http_reinit,
- 1,
- 0 },
-
- { NGX_HTTP_CHECK_SSL_HELLO,
- ngx_string("ssl_hello"),
- ngx_string(sslv3_client_hello_pkt),
- 0,
- ngx_http_upstream_check_send_handler,
- ngx_http_upstream_check_recv_handler,
- ngx_http_upstream_check_ssl_hello_init,
- ngx_http_upstream_check_ssl_hello_parse,
- ngx_http_upstream_check_ssl_hello_reinit,
- 1,
- 0 },
-
- { NGX_HTTP_CHECK_MYSQL,
- ngx_string("mysql"),
- ngx_null_string,
- 0,
- ngx_http_upstream_check_send_handler,
- ngx_http_upstream_check_recv_handler,
- ngx_http_upstream_check_mysql_init,
- ngx_http_upstream_check_mysql_parse,
- ngx_http_upstream_check_mysql_reinit,
- 1,
- 0 },
-
- { NGX_HTTP_CHECK_AJP,
- ngx_string("ajp"),
- ngx_string(ngx_ajp_cping_packet),
- 0,
- ngx_http_upstream_check_send_handler,
- ngx_http_upstream_check_recv_handler,
- ngx_http_upstream_check_ajp_init,
- ngx_http_upstream_check_ajp_parse,
- ngx_http_upstream_check_ajp_reinit,
- 1,
- 0 },
-
- { 0,
- ngx_null_string,
- ngx_null_string,
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- 0,
- 0 }
-};
-
-
-static ngx_check_status_conf_t ngx_check_status_formats[] = {
-
- { ngx_string("html"),
- ngx_string("text/html"),
- ngx_http_upstream_check_status_html_format },
-
- { ngx_string("csv"),
- ngx_string("text/plain"),
- ngx_http_upstream_check_status_csv_format },
-
- { ngx_string("json"),
- ngx_string("application/json"), /* RFC 4627 */
- ngx_http_upstream_check_status_json_format },
-
- { ngx_null_string, ngx_null_string, NULL }
-};
-
-
-static ngx_check_status_command_t ngx_check_status_commands[] = {
-
- { ngx_string("format"),
- ngx_http_upstream_check_status_command_format },
-
- { ngx_string("status"),
- ngx_http_upstream_check_status_command_status },
-
- { ngx_null_string, NULL }
-};
-
-
-static ngx_uint_t ngx_http_upstream_check_shm_generation = 0;
-static ngx_http_upstream_check_peers_t *check_peers_ctx = NULL;
-
-
-ngx_uint_t
-ngx_http_upstream_check_add_peer(ngx_conf_t *cf,
- ngx_http_upstream_srv_conf_t *us, ngx_addr_t *peer_addr)
-{
- ngx_http_upstream_check_peer_t *peer;
- ngx_http_upstream_check_peers_t *peers;
- ngx_http_upstream_check_srv_conf_t *ucscf;
- ngx_http_upstream_check_main_conf_t *ucmcf;
-
- if (us->srv_conf == NULL) {
- return NGX_ERROR;
- }
-
- ucscf = ngx_http_conf_upstream_srv_conf(us, ngx_http_upstream_check_module);
-
- if(ucscf->check_interval == 0) {
- return NGX_ERROR;
- }
-
- ucmcf = ngx_http_conf_get_module_main_conf(cf,
- ngx_http_upstream_check_module);
- peers = ucmcf->peers;
-
- peer = ngx_array_push(&peers->peers);
- if (peer == NULL) {
- return NGX_ERROR;
- }
-
- ngx_memzero(peer, sizeof(ngx_http_upstream_check_peer_t));
-
- peer->index = peers->peers.nelts - 1;
- peer->conf = ucscf;
- peer->upstream_name = &us->host;
- peer->peer_addr = peer_addr;
-
- if (ucscf->port) {
- peer->check_peer_addr = ngx_pcalloc(cf->pool, sizeof(ngx_addr_t));
- if (peer->check_peer_addr == NULL) {
- return NGX_ERROR;
- }
-
- if (ngx_http_upstream_check_addr_change_port(cf->pool,
- peer->check_peer_addr, peer_addr, ucscf->port)
- != NGX_OK) {
-
- return NGX_ERROR;
- }
-
- } else {
- peer->check_peer_addr = peer->peer_addr;
- }
-
- peers->checksum +=
- ngx_murmur_hash2(peer_addr->name.data, peer_addr->name.len);
-
- return peer->index;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_addr_change_port(ngx_pool_t *pool, ngx_addr_t *dst,
- ngx_addr_t *src, ngx_uint_t port)
-{
- size_t len;
- u_char *p;
- struct sockaddr_in *sin;
-#if (NGX_HAVE_INET6)
- struct sockaddr_in6 *sin6;
-#endif
-
- dst->socklen = src->socklen;
- dst->sockaddr = ngx_palloc(pool, dst->socklen);
- if (dst->sockaddr == NULL) {
- return NGX_ERROR;
- }
-
- ngx_memcpy(dst->sockaddr, src->sockaddr, dst->socklen);
-
- switch (dst->sockaddr->sa_family) {
-
- case AF_INET:
-
- len = NGX_INET_ADDRSTRLEN + sizeof(":65535") - 1;
- sin = (struct sockaddr_in *) dst->sockaddr;
- sin->sin_port = htons(port);
-
- break;
-
-#if (NGX_HAVE_INET6)
- case AF_INET6:
-
- len = NGX_INET6_ADDRSTRLEN + sizeof(":65535") - 1;
- sin6 = (struct sockaddr_in6 *) dst->sockaddr;
- sin6->sin6_port = htons(port);
-
- break;
-#endif
-
- default:
- return NGX_ERROR;
- }
-
- p = ngx_pnalloc(pool, len);
- if (p == NULL) {
- return NGX_ERROR;
- }
-
-#if (nginx_version >= 1005012)
- len = ngx_sock_ntop(dst->sockaddr, dst->socklen, p, len, 1);
-#else
- len = ngx_sock_ntop(dst->sockaddr, p, len, 1);
-#endif
-
- dst->name.len = len;
- dst->name.data = p;
-
- return NGX_OK;
-}
-
-
-ngx_uint_t
-ngx_http_upstream_check_peer_down(ngx_uint_t index)
-{
- ngx_http_upstream_check_peer_t *peer;
-
- if (check_peers_ctx == NULL || index >= check_peers_ctx->peers.nelts) {
- return 0;
- }
-
- peer = check_peers_ctx->peers.elts;
-
- return (peer[index].shm->down);
-}
-
-
-/* TODO: this interface can count each peer's busyness */
-void
-ngx_http_upstream_check_get_peer(ngx_uint_t index)
-{
- ngx_http_upstream_check_peer_t *peer;
-
- if (check_peers_ctx == NULL || index >= check_peers_ctx->peers.nelts) {
- return;
- }
-
- peer = check_peers_ctx->peers.elts;
-
- ngx_shmtx_lock(&peer[index].shm->mutex);
-
- peer[index].shm->busyness++;
- peer[index].shm->access_count++;
-
- ngx_shmtx_unlock(&peer[index].shm->mutex);
-}
-
-
-void
-ngx_http_upstream_check_free_peer(ngx_uint_t index)
-{
- ngx_http_upstream_check_peer_t *peer;
-
- if (check_peers_ctx == NULL || index >= check_peers_ctx->peers.nelts) {
- return;
- }
-
- peer = check_peers_ctx->peers.elts;
-
- ngx_shmtx_lock(&peer[index].shm->mutex);
-
- if (peer[index].shm->busyness > 0) {
- peer[index].shm->busyness--;
- }
-
- ngx_shmtx_unlock(&peer[index].shm->mutex);
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_add_timers(ngx_cycle_t *cycle)
-{
- ngx_uint_t i;
- ngx_msec_t t, delay;
- ngx_check_conf_t *cf;
- ngx_http_upstream_check_peer_t *peer;
- ngx_http_upstream_check_peers_t *peers;
- ngx_http_upstream_check_srv_conf_t *ucscf;
- ngx_http_upstream_check_peer_shm_t *peer_shm;
- ngx_http_upstream_check_peers_shm_t *peers_shm;
-
- peers = check_peers_ctx;
- if (peers == NULL) {
- return NGX_OK;
- }
-
- peers_shm = peers->peers_shm;
- if (peers_shm == NULL) {
- return NGX_OK;
- }
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, cycle->log, 0,
- "http check upstream init_process, shm_name: %V, "
- "peer number: %ud",
- &peers->check_shm_name,
- peers->peers.nelts);
-
- srandom(ngx_pid);
-
- peer = peers->peers.elts;
- peer_shm = peers_shm->peers;
-
- for (i = 0; i < peers->peers.nelts; i++) {
- peer[i].shm = &peer_shm[i];
-
- peer[i].check_ev.handler = ngx_http_upstream_check_begin_handler;
- peer[i].check_ev.log = cycle->log;
- peer[i].check_ev.data = &peer[i];
- peer[i].check_ev.timer_set = 0;
-
- peer[i].check_timeout_ev.handler =
- ngx_http_upstream_check_timeout_handler;
- peer[i].check_timeout_ev.log = cycle->log;
- peer[i].check_timeout_ev.data = &peer[i];
- peer[i].check_timeout_ev.timer_set = 0;
-
- ucscf = peer[i].conf;
- cf = ucscf->check_type_conf;
-
- if (cf->need_pool) {
- peer[i].pool = ngx_create_pool(ngx_pagesize, cycle->log);
- if (peer[i].pool == NULL) {
- return NGX_ERROR;
- }
- }
-
- peer[i].send_handler = cf->send_handler;
- peer[i].recv_handler = cf->recv_handler;
-
- peer[i].init = cf->init;
- peer[i].parse = cf->parse;
- peer[i].reinit = cf->reinit;
-
- /*
- * We add a random start time here, since we don't want to trigger
- * the check events too close to each other at the beginning.
- */
- delay = ucscf->check_interval > 1000 ? ucscf->check_interval : 1000;
- t = ngx_random() % delay;
-
- ngx_add_timer(&peer[i].check_ev, t);
- }
-
- return NGX_OK;
-}
-
-
-static void
-ngx_http_upstream_check_begin_handler(ngx_event_t *event)
-{
- ngx_msec_t interval;
- ngx_http_upstream_check_peer_t *peer;
- ngx_http_upstream_check_peers_t *peers;
- ngx_http_upstream_check_srv_conf_t *ucscf;
- ngx_http_upstream_check_peers_shm_t *peers_shm;
-
- if (ngx_http_upstream_check_need_exit()) {
- return;
- }
-
- peers = check_peers_ctx;
- if (peers == NULL) {
- return;
- }
-
- peers_shm = peers->peers_shm;
- if (peers_shm == NULL) {
- return;
- }
-
- peer = event->data;
- ucscf = peer->conf;
-
- ngx_add_timer(event, ucscf->check_interval / 2);
-
- /* This process is processing this peer now. */
- if ((peer->shm->owner == ngx_pid ||
- (peer->pc.connection != NULL) ||
- peer->check_timeout_ev.timer_set)) {
- return;
- }
-
- interval = ngx_current_msec - peer->shm->access_time;
- ngx_log_debug5(NGX_LOG_DEBUG_HTTP, event->log, 0,
- "http check begin handler index: %ui, owner: %P, "
- "ngx_pid: %P, interval: %M, check_interval: %M",
- peer->index, peer->shm->owner,
- ngx_pid, interval,
- ucscf->check_interval);
-
- ngx_shmtx_lock(&peer->shm->mutex);
-
- if (peers_shm->generation != ngx_http_upstream_check_shm_generation) {
- ngx_shmtx_unlock(&peer->shm->mutex);
- return;
- }
-
- if ((interval >= ucscf->check_interval)
- && (peer->shm->owner == NGX_INVALID_PID))
- {
- peer->shm->owner = ngx_pid;
-
- } else if (interval >= (ucscf->check_interval << 4)) {
-
- /*
- * If the check peer has been untouched for 2^4 times of
- * the check interval, activate the current timer.
- * Sometimes, the checking process may disappear
- * in some circumstances, and the clean event will never
- * be triggered.
- */
- peer->shm->owner = ngx_pid;
- peer->shm->access_time = ngx_current_msec;
- }
-
- ngx_shmtx_unlock(&peer->shm->mutex);
-
- if (peer->shm->owner == ngx_pid) {
- ngx_http_upstream_check_connect_handler(event);
- }
-}
-
-
-static void
-ngx_http_upstream_check_connect_handler(ngx_event_t *event)
-{
- ngx_int_t rc;
- ngx_connection_t *c;
- ngx_http_upstream_check_peer_t *peer;
- ngx_http_upstream_check_srv_conf_t *ucscf;
-
- if (ngx_http_upstream_check_need_exit()) {
- return;
- }
-
- peer = event->data;
- ucscf = peer->conf;
-
- if (peer->pc.connection != NULL) {
- c = peer->pc.connection;
- if ((rc = ngx_http_upstream_check_peek_one_byte(c)) == NGX_OK) {
- goto upstream_check_connect_done;
- } else {
- ngx_close_connection(c);
- peer->pc.connection = NULL;
- }
- }
- ngx_memzero(&peer->pc, sizeof(ngx_peer_connection_t));
-
- peer->pc.sockaddr = peer->check_peer_addr->sockaddr;
- peer->pc.socklen = peer->check_peer_addr->socklen;
- peer->pc.name = &peer->check_peer_addr->name;
-
- peer->pc.get = ngx_event_get_peer;
- peer->pc.log = event->log;
- peer->pc.log_error = NGX_ERROR_ERR;
-
- peer->pc.cached = 0;
- peer->pc.connection = NULL;
-
- rc = ngx_event_connect_peer(&peer->pc);
-
- if (rc == NGX_ERROR || rc == NGX_DECLINED) {
- ngx_http_upstream_check_status_update(peer, 0);
- return;
- }
-
- /* NGX_OK or NGX_AGAIN */
- c = peer->pc.connection;
- c->data = peer;
- c->log = peer->pc.log;
- c->sendfile = 0;
- c->read->log = c->log;
- c->write->log = c->log;
- c->pool = peer->pool;
-
-upstream_check_connect_done:
- peer->state = NGX_HTTP_CHECK_CONNECT_DONE;
-
- c->write->handler = peer->send_handler;
- c->read->handler = peer->recv_handler;
-
- ngx_add_timer(&peer->check_timeout_ev, ucscf->check_timeout);
-
- /* The kqueue's loop interface needs it. */
- if (rc == NGX_OK) {
- c->write->handler(c->write);
- }
-}
-
-static ngx_int_t
-ngx_http_upstream_check_peek_one_byte(ngx_connection_t *c)
-{
- char buf[1];
- ngx_int_t n;
- ngx_err_t err;
-
- n = recv(c->fd, buf, 1, MSG_PEEK);
- err = ngx_socket_errno;
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, err,
- "http check upstream recv(): %i, fd: %d",
- n, c->fd);
-
- if (n == 1 || (n == -1 && err == NGX_EAGAIN)) {
- return NGX_OK;
- } else {
- return NGX_ERROR;
- }
-}
-
-static void
-ngx_http_upstream_check_peek_handler(ngx_event_t *event)
-{
- ngx_connection_t *c;
- ngx_http_upstream_check_peer_t *peer;
-
- if (ngx_http_upstream_check_need_exit()) {
- return;
- }
-
- c = event->data;
- peer = c->data;
-
- if (ngx_http_upstream_check_peek_one_byte(c) == NGX_OK) {
- ngx_http_upstream_check_status_update(peer, 1);
-
- } else {
- c->error = 1;
- ngx_http_upstream_check_status_update(peer, 0);
- }
-
- ngx_http_upstream_check_clean_event(peer);
-
- ngx_http_upstream_check_finish_handler(event);
-}
-
-
-static void
-ngx_http_upstream_check_discard_handler(ngx_event_t *event)
-{
- u_char buf[4096];
- ssize_t size;
- ngx_connection_t *c;
- ngx_http_upstream_check_peer_t *peer;
-
- c = event->data;
-
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "upstream check discard handler");
-
- if (ngx_http_upstream_check_need_exit()) {
- return;
- }
-
- peer = c->data;
-
- while (1) {
- size = c->recv(c, buf, 4096);
-
- if (size > 0) {
- continue;
-
- } else if (size == NGX_AGAIN) {
- break;
-
- } else {
- if (size == 0) {
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "peer closed its half side of the connection");
- }
-
- goto check_discard_fail;
- }
- }
-
- if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
- goto check_discard_fail;
- }
-
- return;
-
- check_discard_fail:
- c->error = 1;
- ngx_http_upstream_check_clean_event(peer);
-}
-
-
-static void
-ngx_http_upstream_check_dummy_handler(ngx_event_t *event)
-{
- return;
-}
-
-
-static void
-ngx_http_upstream_check_send_handler(ngx_event_t *event)
-{
- ssize_t size;
- ngx_connection_t *c;
- ngx_http_upstream_check_ctx_t *ctx;
- ngx_http_upstream_check_peer_t *peer;
-
- if (ngx_http_upstream_check_need_exit()) {
- return;
- }
-
- c = event->data;
- peer = c->data;
-
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http check send.");
-
- if (c->pool == NULL) {
- ngx_log_error(NGX_LOG_ERR, event->log, 0,
- "check pool NULL with peer: %V ",
- &peer->check_peer_addr->name);
-
- goto check_send_fail;
- }
-
- if (peer->state != NGX_HTTP_CHECK_CONNECT_DONE) {
- if (ngx_handle_write_event(c->write, 0) != NGX_OK) {
-
- ngx_log_error(NGX_LOG_ERR, event->log, 0,
- "check handle write event error with peer: %V ",
- &peer->check_peer_addr->name);
-
- goto check_send_fail;
- }
-
- return;
- }
-
- if (peer->check_data == NULL) {
-
- peer->check_data = ngx_pcalloc(peer->pool,
- sizeof(ngx_http_upstream_check_ctx_t));
- if (peer->check_data == NULL) {
- goto check_send_fail;
- }
-
- if (peer->init == NULL || peer->init(peer) != NGX_OK) {
-
- ngx_log_error(NGX_LOG_ERR, event->log, 0,
- "check init error with peer: %V ",
- &peer->check_peer_addr->name);
-
- goto check_send_fail;
- }
- }
-
- ctx = peer->check_data;
-
- while (ctx->send.pos < ctx->send.last) {
-
- size = c->send(c, ctx->send.pos, ctx->send.last - ctx->send.pos);
-
-#if (NGX_DEBUG)
- {
- ngx_err_t err;
-
- err = (size >=0) ? 0 : ngx_socket_errno;
- ngx_log_error(NGX_LOG_DEBUG, ngx_cycle->log, err,
- "http check send size: %z, total: %z",
- size, ctx->send.last - ctx->send.pos);
- }
-#endif
-
- if (size > 0) {
- ctx->send.pos += size;
- } else if (size == 0 || size == NGX_AGAIN) {
- return;
- } else {
- c->error = 1;
- goto check_send_fail;
- }
- }
-
- if (ctx->send.pos == ctx->send.last) {
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, c->log, 0, "http check send done.");
- peer->state = NGX_HTTP_CHECK_SEND_DONE;
- c->requests++;
- }
-
- return;
-
-check_send_fail:
- ngx_http_upstream_check_status_update(peer, 0);
- ngx_http_upstream_check_clean_event(peer);
-}
-
-
-static void
-ngx_http_upstream_check_recv_handler(ngx_event_t *event)
-{
- u_char *new_buf;
- ssize_t size, n;
- ngx_int_t rc;
- ngx_connection_t *c;
- ngx_http_upstream_check_ctx_t *ctx;
- ngx_http_upstream_check_peer_t *peer;
-
- if (ngx_http_upstream_check_need_exit()) {
- return;
- }
-
- c = event->data;
- peer = c->data;
-
- if (peer->state != NGX_HTTP_CHECK_SEND_DONE) {
-
- if (ngx_handle_read_event(c->read, 0) != NGX_OK) {
- goto check_recv_fail;
- }
-
- return;
- }
-
- ctx = peer->check_data;
-
- if (ctx->recv.start == NULL) {
- /* 1/2 of the page_size, is it enough? */
- ctx->recv.start = ngx_palloc(c->pool, ngx_pagesize / 2);
- if (ctx->recv.start == NULL) {
- goto check_recv_fail;
- }
-
- ctx->recv.last = ctx->recv.pos = ctx->recv.start;
- ctx->recv.end = ctx->recv.start + ngx_pagesize / 2;
- }
-
- while (1) {
- n = ctx->recv.end - ctx->recv.last;
-
- /* buffer not big enough? enlarge it by twice */
- if (n == 0) {
- size = ctx->recv.end - ctx->recv.start;
- new_buf = ngx_palloc(c->pool, size * 2);
- if (new_buf == NULL) {
- goto check_recv_fail;
- }
-
- ngx_memcpy(new_buf, ctx->recv.start, size);
-
- ctx->recv.pos = ctx->recv.start = new_buf;
- ctx->recv.last = new_buf + size;
- ctx->recv.end = new_buf + size * 2;
-
- n = ctx->recv.end - ctx->recv.last;
- }
-
- size = c->recv(c, ctx->recv.last, n);
-
-#if (NGX_DEBUG)
- {
- ngx_err_t err;
-
- err = (size >= 0) ? 0 : ngx_socket_errno;
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, err,
- "http check recv size: %z, peer: %V ",
- size, &peer->check_peer_addr->name);
- }
-#endif
-
- if (size > 0) {
- ctx->recv.last += size;
- continue;
- } else if (size == 0 || size == NGX_AGAIN) {
- break;
- } else {
- c->error = 1;
- goto check_recv_fail;
- }
- }
-
- rc = peer->parse(peer);
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http check parse rc: %i, peer: %V ",
- rc, &peer->check_peer_addr->name);
-
- switch (rc) {
-
- case NGX_AGAIN:
- /* The peer has closed its half side of the connection. */
- if (size == 0) {
- ngx_http_upstream_check_status_update(peer, 0);
- c->error = 1;
- break;
- }
-
- return;
-
- case NGX_ERROR:
- ngx_log_error(NGX_LOG_ERR, event->log, 0,
- "check protocol %V error with peer: %V ",
- &peer->conf->check_type_conf->name,
- &peer->check_peer_addr->name);
-
- ngx_http_upstream_check_status_update(peer, 0);
- break;
-
- case NGX_OK:
- /* fall through */
-
- default:
- ngx_http_upstream_check_status_update(peer, 1);
- break;
- }
-
- peer->state = NGX_HTTP_CHECK_RECV_DONE;
- ngx_http_upstream_check_clean_event(peer);
- return;
-
-check_recv_fail:
- ngx_http_upstream_check_status_update(peer, 0);
- ngx_http_upstream_check_clean_event(peer);
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_http_init(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_http_upstream_check_ctx_t *ctx;
- ngx_http_upstream_check_srv_conf_t *ucscf;
-
- ctx = peer->check_data;
- ucscf = peer->conf;
-
- ctx->send.start = ctx->send.pos = (u_char *)ucscf->send.data;
- ctx->send.end = ctx->send.last = ctx->send.start + ucscf->send.len;
-
- ctx->recv.start = ctx->recv.pos = NULL;
- ctx->recv.end = ctx->recv.last = NULL;
-
- ctx->state = 0;
-
- ngx_memzero(&ctx->status, sizeof(ngx_http_status_t));
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_http_parse(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_int_t rc;
- ngx_uint_t code, code_n;
- ngx_http_upstream_check_ctx_t *ctx;
- ngx_http_upstream_check_srv_conf_t *ucscf;
-
- ucscf = peer->conf;
- ctx = peer->check_data;
-
- if ((ctx->recv.last - ctx->recv.pos) > 0) {
-
- rc = ngx_http_upstream_check_parse_status_line(ctx,
- &ctx->recv,
- &ctx->status);
- if (rc == NGX_AGAIN) {
- return rc;
- }
-
- if (rc == NGX_ERROR) {
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "http parse status line error with peer: %V ",
- &peer->check_peer_addr->name);
- return rc;
- }
-
- code = ctx->status.code;
-
- if (code >= 200 && code < 300) {
- code_n = NGX_CHECK_HTTP_2XX;
- } else if (code >= 300 && code < 400) {
- code_n = NGX_CHECK_HTTP_3XX;
- } else if (code >= 400 && code < 500) {
- peer->pc.connection->error = 1;
- code_n = NGX_CHECK_HTTP_4XX;
- } else if (code >= 500 && code < 600) {
- peer->pc.connection->error = 1;
- code_n = NGX_CHECK_HTTP_5XX;
- } else {
- peer->pc.connection->error = 1;
- code_n = NGX_CHECK_HTTP_ERR;
- }
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "http_parse: code_n: %ui, conf: %ui",
- code_n, ucscf->code.status_alive);
-
- if (code_n & ucscf->code.status_alive) {
- return NGX_OK;
- } else {
- return NGX_ERROR;
- }
- } else {
- return NGX_AGAIN;
- }
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_fastcgi_process_record(
- ngx_http_upstream_check_ctx_t *ctx, ngx_buf_t *b, ngx_http_status_t *status)
-{
- u_char ch, *p;
- ngx_http_fastcgi_state_e state;
-
- state = ctx->state;
-
- for (p = b->pos; p < b->last; p++) {
-
- ch = *p;
-
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "http fastcgi record byte: %02Xd", ch);
-
- switch (state) {
-
- case ngx_http_fastcgi_st_version:
- if (ch != 1) {
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "upstream sent unsupported FastCGI "
- "protocol version: %d", ch);
- return NGX_ERROR;
- }
- state = ngx_http_fastcgi_st_type;
- break;
-
- case ngx_http_fastcgi_st_type:
- switch (ch) {
- case NGX_HTTP_FASTCGI_STDOUT:
- case NGX_HTTP_FASTCGI_STDERR:
- case NGX_HTTP_FASTCGI_END_REQUEST:
- status->code = (ngx_uint_t) ch;
- break;
- default:
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "upstream sent invalid FastCGI "
- "record type: %d", ch);
- return NGX_ERROR;
-
- }
- state = ngx_http_fastcgi_st_request_id_hi;
- break;
-
- /* we support the single request per connection */
-
- case ngx_http_fastcgi_st_request_id_hi:
- if (ch != 0) {
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "upstream sent unexpected FastCGI "
- "request id high byte: %d", ch);
- return NGX_ERROR;
- }
- state = ngx_http_fastcgi_st_request_id_lo;
- break;
-
- case ngx_http_fastcgi_st_request_id_lo:
- if (ch != 1) {
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "upstream sent unexpected FastCGI "
- "request id low byte: %d", ch);
- return NGX_ERROR;
- }
- state = ngx_http_fastcgi_st_content_length_hi;
- break;
-
- case ngx_http_fastcgi_st_content_length_hi:
- ctx->length = ch << 8;
- state = ngx_http_fastcgi_st_content_length_lo;
- break;
-
- case ngx_http_fastcgi_st_content_length_lo:
- ctx->length |= (size_t) ch;
- state = ngx_http_fastcgi_st_padding_length;
- break;
-
- case ngx_http_fastcgi_st_padding_length:
- ctx->padding = (size_t) ch;
- state = ngx_http_fastcgi_st_reserved;
- break;
-
- case ngx_http_fastcgi_st_reserved:
- state = ngx_http_fastcgi_st_data;
-
- b->pos = p + 1;
- ctx->state = state;
-
- return NGX_OK;
-
- /* suppress warning */
- case ngx_http_fastcgi_st_data:
- case ngx_http_fastcgi_st_padding:
- break;
- }
- }
-
- ctx->state = state;
-
- return NGX_AGAIN;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_fastcgi_parse(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_int_t rc;
- ngx_flag_t done;
- ngx_uint_t type, code, code_n;
- ngx_http_upstream_check_ctx_t *ctx;
- ngx_http_upstream_check_srv_conf_t *ucscf;
-
- ucscf = peer->conf;
- ctx = peer->check_data;
-
- if ((ctx->recv.last - ctx->recv.pos) <= 0) {
- return NGX_AGAIN;
- }
-
- done = 0;
-
- for ( ;; ) {
-
- if (ctx->state < ngx_http_fastcgi_st_data) {
- rc = ngx_http_upstream_check_fastcgi_process_record(ctx,
- &ctx->recv, &ctx->status);
-
- type = ctx->status.code;
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "fastcgi_parse rc: [%i], type: [%ui]", rc, type);
-
- if (rc == NGX_AGAIN) {
- return rc;
- }
-
- if (rc == NGX_ERROR) {
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "check fastcgi parse status line error with peer: %V",
- &peer->check_peer_addr->name);
-
- return rc;
- }
-
- if (type != NGX_HTTP_FASTCGI_STDOUT
- && type != NGX_HTTP_FASTCGI_STDERR)
- {
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "check fastcgi sent unexpected FastCGI record: %d", type);
-
- return NGX_ERROR;
- }
-
- if (type == NGX_HTTP_FASTCGI_STDOUT && ctx->length == 0) {
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "check fastcgi prematurely closed FastCGI stdout");
-
- return NGX_ERROR;
- }
- }
-
- if (ctx->state == ngx_http_fastcgi_st_padding) {
-
- if (ctx->recv.pos + ctx->padding < ctx->recv.last) {
- ctx->status.code = ngx_http_fastcgi_st_version;
- ctx->recv.pos += ctx->padding;
-
- continue;
- }
-
- if (ctx->recv.pos + ctx->padding == ctx->recv.last) {
- ctx->status.code = ngx_http_fastcgi_st_version;
- ctx->recv.pos = ctx->recv.last;
-
- return NGX_AGAIN;
- }
-
- ctx->padding -= ctx->recv.last - ctx->recv.pos;
- ctx->recv.pos = ctx->recv.last;
-
- return NGX_AGAIN;
- }
-
- if (ctx->status.code == NGX_HTTP_FASTCGI_STDERR) {
-
- ngx_log_error(NGX_LOG_WARN, ngx_cycle->log, 0,
- "fastcgi check error");
-
- return NGX_ERROR;
- }
-
- /* ctx->status.code == NGX_HTTP_FASTCGI_STDOUT */
-
- if (ctx->recv.pos + ctx->length < ctx->recv.last) {
- ctx->recv.last = ctx->recv.pos + ctx->length;
- } else {
- return NGX_ERROR;
- }
-
- ctx->status.code = 0;
-
- for ( ;; ) {
- rc = ngx_http_upstream_check_parse_fastcgi_status(ctx,
- &ctx->recv,
- &ctx->status);
- ngx_log_error(NGX_LOG_INFO, ngx_cycle->log, 0,
- "fastcgi http parse status line rc: %i ", rc);
-
- if (rc == NGX_ERROR) {
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "fastcgi http parse status line error with peer: %V ",
- &peer->check_peer_addr->name);
- return NGX_ERROR;
- }
-
- if (rc == NGX_AGAIN) {
- break;
- }
-
- if (rc == NGX_DONE) {
- done = 1;
- ngx_log_error(NGX_LOG_DEBUG, ngx_cycle->log, 0,
- "fastcgi http parse status: %i",
- ctx->status.code);
- break;
- }
-
- /* rc = NGX_OK */
- }
-
- if (ucscf->code.status_alive == 0 || done == 0) {
- return NGX_OK;
- }
-
- code = ctx->status.code;
-
- if (code >= 200 && code < 300) {
- code_n = NGX_CHECK_HTTP_2XX;
- } else if (code >= 300 && code < 400) {
- code_n = NGX_CHECK_HTTP_3XX;
- } else if (code >= 400 && code < 500) {
- code_n = NGX_CHECK_HTTP_4XX;
- } else if (code >= 500 && code < 600) {
- code_n = NGX_CHECK_HTTP_5XX;
- } else {
- code_n = NGX_CHECK_HTTP_ERR;
- }
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "fastcgi http_parse: code_n: %ui, conf: %ui",
- code_n, ucscf->code.status_alive);
-
- if (code_n & ucscf->code.status_alive) {
- return NGX_OK;
- } else {
- return NGX_ERROR;
- }
-
- }
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_parse_fastcgi_status(ngx_http_upstream_check_ctx_t *ctx,
- ngx_buf_t *b, ngx_http_status_t *status)
-{
- u_char c, ch, *p, *name_s, *name_e;
- ngx_flag_t find;
-
- enum {
- sw_start = 0,
- sw_name,
- sw_space_before_value,
- sw_value,
- sw_space_after_value,
- sw_ignore_line,
- sw_almost_done,
- sw_header_almost_done
- } state;
-
- /* the last '\0' is not needed because string is zero terminated */
-
- static u_char lowcase[] =
- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
- "\0\0\0\0\0\0\0\0\0\0\0\0\0-\0\0" "0123456789\0\0\0\0\0\0"
- "\0abcdefghijklmnopqrstuvwxyz\0\0\0\0\0"
- "\0abcdefghijklmnopqrstuvwxyz\0\0\0\0\0"
- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
- "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";
-
- status->count = 0;
- status->code = 0;
- find = 0;
- name_s = name_e = NULL;
- state = sw_start;
-
- for (p = b->pos; p < b->last; p++) {
- ch = *p;
-
- switch (state) {
-
- /* first char */
- case sw_start:
-
- switch (ch) {
- case CR:
- state = sw_header_almost_done;
- break;
- case LF:
- goto header_done;
- default:
- state = sw_name;
-
- c = lowcase[ch];
-
- if (c) {
- name_s = p;
- break;
- }
-
- if (ch == '\0') {
- return NGX_ERROR;
- }
-
-
- break;
- }
-
- break;
-
- /* header name */
- case sw_name:
- c = lowcase[ch];
-
- if (c) {
- break;
- }
-
- if (ch == ':') {
- name_e = p;
-#if (NGX_DEBUG)
- ngx_str_t name;
- name.data = name_s;
- name.len = name_e - name_s;
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "fastcgi header: %V", &name);
-#endif
- state = sw_space_before_value;
-
- if (ngx_strncasecmp(name_s, (u_char *) "status",
- name_e - name_s)
- == 0)
- {
-
- ngx_log_debug0(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "find status header");
-
- find = 1;
- }
-
- break;
- }
-
- if (ch == CR) {
- state = sw_almost_done;
- break;
- }
-
- if (ch == LF) {
- goto done;
- }
-
- /* IIS may send the duplicate "HTTP/1.1 ..." lines */
- if (ch == '\0') {
- return NGX_ERROR;
- }
-
- break;
-
- /* space* before header value */
- case sw_space_before_value:
- switch (ch) {
- case ' ':
- break;
- case CR:
- state = sw_almost_done;
- break;
- case LF:
- goto done;
- case '\0':
- return NGX_ERROR;
- default:
- state = sw_value;
- if (find) {
- if (ch < '1' || ch > '9') {
- return NGX_ERROR;
- }
-
- status->code = status->code * 10 + ch - '0';
- if (status->count++ != 0) {
- return NGX_ERROR;
- }
- }
-
- break;
- }
-
- break;
-
- /* header value */
- case sw_value:
-
- if (find) {
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- status->code = status->code * 10 + ch - '0';
-
- if (++status->count == 3) {
- return NGX_DONE;
- }
- }
-
- switch (ch) {
- case ' ':
- state = sw_space_after_value;
- break;
- case CR:
- state = sw_almost_done;
- break;
- case LF:
- goto done;
- case '\0':
- return NGX_ERROR;
- }
-
- break;
-
- /* space* before end of header line */
- case sw_space_after_value:
- switch (ch) {
- case ' ':
- break;
- case CR:
- state = sw_almost_done;
- break;
- case LF:
- state = sw_start;
- break;
- case '\0':
- return NGX_ERROR;
- default:
- state = sw_value;
- break;
- }
- break;
-
- /* ignore header line */
- case sw_ignore_line:
- switch (ch) {
- case LF:
- state = sw_start;
- break;
- default:
- break;
- }
- break;
-
- /* end of header line */
- case sw_almost_done:
- switch (ch) {
- case LF:
- goto done;
- case CR:
- break;
- default:
- return NGX_ERROR;
- }
- break;
-
- /* end of header */
- case sw_header_almost_done:
- switch (ch) {
- case LF:
- goto header_done;
- default:
- return NGX_ERROR;
- }
- }
- }
-
- b->pos = p;
- ctx->state = state;
-
- return NGX_AGAIN;
-
-done:
-
- b->pos = p + 1;
- ctx->state = sw_start;
-
- return NGX_OK;
-
-header_done:
-
- b->pos = p + 1;
- ctx->state = sw_start;
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_parse_status_line(ngx_http_upstream_check_ctx_t *ctx,
- ngx_buf_t *b, ngx_http_status_t *status)
-{
- u_char ch, *p;
- enum {
- sw_start = 0,
- sw_H,
- sw_HT,
- sw_HTT,
- sw_HTTP,
- sw_first_major_digit,
- sw_major_digit,
- sw_first_minor_digit,
- sw_minor_digit,
- sw_status,
- sw_space_after_status,
- sw_status_text,
- sw_almost_done
- } state;
-
- state = ctx->state;
-
- for (p = b->pos; p < b->last; p++) {
- ch = *p;
-
- switch (state) {
-
- /* "HTTP/" */
- case sw_start:
- if (ch != 'H') {
- return NGX_ERROR;
- }
-
- state = sw_H;
- break;
-
- case sw_H:
- if (ch != 'T') {
- return NGX_ERROR;
- }
-
- state = sw_HT;
- break;
-
- case sw_HT:
- if (ch != 'T') {
- return NGX_ERROR;
- }
-
- state = sw_HTT;
- break;
-
- case sw_HTT:
- if (ch != 'P') {
- return NGX_ERROR;
- }
-
- state = sw_HTTP;
- break;
-
- case sw_HTTP:
- if (ch != '/') {
- return NGX_ERROR;
- }
-
- state = sw_first_major_digit;
- break;
-
- /* the first digit of major HTTP version */
- case sw_first_major_digit:
- if (ch < '1' || ch > '9') {
- return NGX_ERROR;
- }
-
- state = sw_major_digit;
- break;
-
- /* the major HTTP version or dot */
- case sw_major_digit:
- if (ch == '.') {
- state = sw_first_minor_digit;
- break;
- }
-
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- break;
-
- /* the first digit of minor HTTP version */
- case sw_first_minor_digit:
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- state = sw_minor_digit;
- break;
-
- /* the minor HTTP version or the end of the request line */
- case sw_minor_digit:
- if (ch == ' ') {
- state = sw_status;
- break;
- }
-
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- break;
-
- /* HTTP status code */
- case sw_status:
- if (ch == ' ') {
- break;
- }
-
- if (ch < '0' || ch > '9') {
- return NGX_ERROR;
- }
-
- status->code = status->code * 10 + ch - '0';
-
- if (++status->count == 3) {
- state = sw_space_after_status;
- status->start = p - 2;
- }
-
- break;
-
- /* space or end of line */
- case sw_space_after_status:
- switch (ch) {
- case ' ':
- state = sw_status_text;
- break;
- case '.': /* IIS may send 403.1, 403.2, etc */
- state = sw_status_text;
- break;
- case CR:
- state = sw_almost_done;
- break;
- case LF:
- goto done;
- default:
- return NGX_ERROR;
- }
- break;
-
- /* any text until end of line */
- case sw_status_text:
- switch (ch) {
- case CR:
- state = sw_almost_done;
-
- break;
- case LF:
- goto done;
- }
- break;
-
- /* end of status line */
- case sw_almost_done:
- status->end = p - 1;
- if (ch == LF) {
- goto done;
- } else {
- return NGX_ERROR;
- }
- }
- }
-
- b->pos = p;
- ctx->state = state;
-
- return NGX_AGAIN;
-
-done:
-
- b->pos = p + 1;
-
- if (status->end == NULL) {
- status->end = p;
- }
-
- ctx->state = sw_start;
-
- return NGX_OK;
-}
-
-
-static void
-ngx_http_upstream_check_http_reinit(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_http_upstream_check_ctx_t *ctx;
-
- ctx = peer->check_data;
-
- ctx->send.pos = ctx->send.start;
- ctx->send.last = ctx->send.end;
-
- ctx->recv.pos = ctx->recv.last = ctx->recv.start;
-
- ctx->state = 0;
-
- ngx_memzero(&ctx->status, sizeof(ngx_http_status_t));
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_ssl_hello_init(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_http_upstream_check_ctx_t *ctx;
- ngx_http_upstream_check_srv_conf_t *ucscf;
-
- ctx = peer->check_data;
- ucscf = peer->conf;
-
- ctx->send.start = ctx->send.pos = (u_char *)ucscf->send.data;
- ctx->send.end = ctx->send.last = ctx->send.start + ucscf->send.len;
-
- ctx->recv.start = ctx->recv.pos = NULL;
- ctx->recv.end = ctx->recv.last = NULL;
-
- return NGX_OK;
-}
-
-
-/* a rough check of server ssl_hello responses */
-static ngx_int_t
-ngx_http_upstream_check_ssl_hello_parse(ngx_http_upstream_check_peer_t *peer)
-{
- size_t size;
- ngx_ssl_server_hello_t *resp;
- ngx_http_upstream_check_ctx_t *ctx;
-
- ctx = peer->check_data;
-
- size = ctx->recv.last - ctx->recv.pos;
- if (size < sizeof(ngx_ssl_server_hello_t)) {
- return NGX_AGAIN;
- }
-
- resp = (ngx_ssl_server_hello_t *) ctx->recv.pos;
-
- ngx_log_debug7(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "http check ssl_parse, type: %ud, version: %ud.%ud, "
- "length: %ud, handshanke_type: %ud, hello_version: %ud.%ud",
- resp->msg_type, resp->version.major, resp->version.minor,
- ntohs(resp->length), resp->handshake_type,
- resp->hello_version.major, resp->hello_version.minor);
-
- if (resp->msg_type != NGX_SSL_HANDSHAKE) {
- return NGX_ERROR;
- }
-
- if (resp->handshake_type != NGX_SSL_SERVER_HELLO) {
- return NGX_ERROR;
- }
-
- return NGX_OK;
-}
-
-
-static void
-ngx_http_upstream_check_ssl_hello_reinit(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_http_upstream_check_ctx_t *ctx;
-
- ctx = peer->check_data;
-
- ctx->send.pos = ctx->send.start;
- ctx->send.last = ctx->send.end;
-
- ctx->recv.pos = ctx->recv.last = ctx->recv.start;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_mysql_init(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_http_upstream_check_ctx_t *ctx;
- ngx_http_upstream_check_srv_conf_t *ucscf;
-
- ctx = peer->check_data;
- ucscf = peer->conf;
-
- ctx->send.start = ctx->send.pos = (u_char *)ucscf->send.data;
- ctx->send.end = ctx->send.last = ctx->send.start + ucscf->send.len;
-
- ctx->recv.start = ctx->recv.pos = NULL;
- ctx->recv.end = ctx->recv.last = NULL;
-
- return NGX_OK;
-}
-
-
-/* a rough check of mysql greeting responses */
-static ngx_int_t
-ngx_http_upstream_check_mysql_parse(ngx_http_upstream_check_peer_t *peer)
-{
- size_t size;
- ngx_mysql_handshake_init_t *handshake;
- ngx_http_upstream_check_ctx_t *ctx;
-
- ctx = peer->check_data;
-
- size = ctx->recv.last - ctx->recv.pos;
- if (size < sizeof(ngx_mysql_handshake_init_t)) {
- return NGX_AGAIN;
- }
-
- handshake = (ngx_mysql_handshake_init_t *) ctx->recv.pos;
-
- ngx_log_debug3(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "mysql_parse: packet_number=%ud, protocol=%ud, server=%s",
- handshake->packet_number, handshake->protocol_version,
- handshake->others);
-
- /* The mysql greeting packet's serial number always begins with 0. */
- if (handshake->packet_number != 0x00) {
- return NGX_ERROR;
- }
-
- return NGX_OK;
-}
-
-
-static void
-ngx_http_upstream_check_mysql_reinit(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_http_upstream_check_ctx_t *ctx;
-
- ctx = peer->check_data;
-
- ctx->send.pos = ctx->send.start;
- ctx->send.last = ctx->send.end;
-
- ctx->recv.pos = ctx->recv.last = ctx->recv.start;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_ajp_init(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_http_upstream_check_ctx_t *ctx;
- ngx_http_upstream_check_srv_conf_t *ucscf;
-
- ctx = peer->check_data;
- ucscf = peer->conf;
-
- ctx->send.start = ctx->send.pos = (u_char *)ucscf->send.data;
- ctx->send.end = ctx->send.last = ctx->send.start + ucscf->send.len;
-
- ctx->recv.start = ctx->recv.pos = NULL;
- ctx->recv.end = ctx->recv.last = NULL;
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_ajp_parse(ngx_http_upstream_check_peer_t *peer)
-{
- size_t size;
- u_char *p;
- ngx_http_upstream_check_ctx_t *ctx;
-
- ctx = peer->check_data;
-
- size = ctx->recv.last - ctx->recv.pos;
- if (size < sizeof(ngx_ajp_cpong_packet)) {
- return NGX_AGAIN;
- }
-
- p = ctx->recv.pos;
-
-#if (NGX_DEBUG)
- {
- ngx_ajp_raw_packet_t *ajp;
-
- ajp = (ngx_ajp_raw_packet_t *) p;
- ngx_log_debug3(NGX_LOG_DEBUG_HTTP, ngx_cycle->log, 0,
- "ajp_parse: preamble=0x%uxd, length=0x%uxd, type=0x%uxd",
- ntohs(ajp->preamble), ntohs(ajp->length), ajp->type);
- }
-#endif
-
- if (ngx_memcmp(ngx_ajp_cpong_packet, p, sizeof(ngx_ajp_cpong_packet)) == 0)
- {
- return NGX_OK;
- } else {
- return NGX_ERROR;
- }
-}
-
-
-static void
-ngx_http_upstream_check_ajp_reinit(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_http_upstream_check_ctx_t *ctx;
-
- ctx = peer->check_data;
-
- ctx->send.pos = ctx->send.start;
- ctx->send.last = ctx->send.end;
-
- ctx->recv.pos = ctx->recv.last = ctx->recv.start;
-}
-
-
-static void
-ngx_http_upstream_check_status_update(ngx_http_upstream_check_peer_t *peer,
- ngx_int_t result)
-{
- ngx_http_upstream_check_srv_conf_t *ucscf;
-
- ucscf = peer->conf;
-
- if (result) {
- peer->shm->rise_count++;
- peer->shm->fall_count = 0;
- if (peer->shm->down && peer->shm->rise_count >= ucscf->rise_count) {
- peer->shm->down = 0;
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "enable check peer: %V ",
- &peer->check_peer_addr->name);
- }
- } else {
- peer->shm->rise_count = 0;
- peer->shm->fall_count++;
- if (!peer->shm->down && peer->shm->fall_count >= ucscf->fall_count) {
- peer->shm->down = 1;
- ngx_log_error(NGX_LOG_ERR, ngx_cycle->log, 0,
- "disable check peer: %V ",
- &peer->check_peer_addr->name);
- }
- }
-
- peer->shm->access_time = ngx_current_msec;
-}
-
-
-static void
-ngx_http_upstream_check_clean_event(ngx_http_upstream_check_peer_t *peer)
-{
- ngx_connection_t *c;
- ngx_http_upstream_check_srv_conf_t *ucscf;
- ngx_check_conf_t *cf;
-
- c = peer->pc.connection;
- ucscf = peer->conf;
- cf = ucscf->check_type_conf;
-
- if (c) {
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
- "http check clean event: index:%i, fd: %d",
- peer->index, c->fd);
- if (c->error == 0 &&
- cf->need_keepalive &&
- (c->requests < ucscf->check_keepalive_requests))
- {
- c->write->handler = ngx_http_upstream_check_dummy_handler;
- c->read->handler = ngx_http_upstream_check_discard_handler;
- } else {
- ngx_close_connection(c);
- peer->pc.connection = NULL;
- }
- }
-
- if (peer->check_timeout_ev.timer_set) {
- ngx_del_timer(&peer->check_timeout_ev);
- }
-
- peer->state = NGX_HTTP_CHECK_ALL_DONE;
-
- if (peer->check_data != NULL && peer->reinit) {
- peer->reinit(peer);
- }
-
- peer->shm->owner = NGX_INVALID_PID;
-}
-
-
-static void
-ngx_http_upstream_check_timeout_handler(ngx_event_t *event)
-{
- ngx_http_upstream_check_peer_t *peer;
-
- if (ngx_http_upstream_check_need_exit()) {
- return;
- }
-
- peer = event->data;
- peer->pc.connection->error = 1;
-
- ngx_log_error(NGX_LOG_ERR, event->log, 0,
- "check time out with peer: %V ",
- &peer->check_peer_addr->name);
-
- ngx_http_upstream_check_status_update(peer, 0);
- ngx_http_upstream_check_clean_event(peer);
-}
-
-
-static void
-ngx_http_upstream_check_finish_handler(ngx_event_t *event)
-{
- if (ngx_http_upstream_check_need_exit()) {
- return;
- }
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_need_exit()
-{
- if (ngx_terminate || ngx_exiting || ngx_quit) {
- ngx_http_upstream_check_clear_all_events();
- return 1;
- }
-
- return 0;
-}
-
-
-static void
-ngx_http_upstream_check_clear_all_events()
-{
- ngx_uint_t i;
- ngx_connection_t *c;
- ngx_http_upstream_check_peer_t *peer;
- ngx_http_upstream_check_peers_t *peers;
-
- static ngx_flag_t has_cleared = 0;
-
- if (has_cleared || check_peers_ctx == NULL) {
- return;
- }
-
- ngx_log_error(NGX_LOG_NOTICE, ngx_cycle->log, 0,
- "clear all the events on %P ", ngx_pid);
-
- has_cleared = 1;
-
- peers = check_peers_ctx;
-
- peer = peers->peers.elts;
- for (i = 0; i < peers->peers.nelts; i++) {
-
- if (peer[i].check_ev.timer_set) {
- ngx_del_timer(&peer[i].check_ev);
- }
-
- if (peer[i].check_timeout_ev.timer_set) {
- ngx_del_timer(&peer[i].check_timeout_ev);
- }
-
- c = peer[i].pc.connection;
- if (c) {
- ngx_close_connection(c);
- peer[i].pc.connection = NULL;
- }
-
- if (peer[i].pool != NULL) {
- ngx_destroy_pool(peer[i].pool);
- peer[i].pool = NULL;
- }
- }
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_status_handler(ngx_http_request_t *r)
-{
- size_t buffer_size;
- ngx_int_t rc;
- ngx_buf_t *b;
- ngx_chain_t out;
- ngx_http_upstream_check_peers_t *peers;
- ngx_http_upstream_check_loc_conf_t *uclcf;
- ngx_http_upstream_check_status_ctx_t *ctx;
-
- if (r->method != NGX_HTTP_GET && r->method != NGX_HTTP_HEAD) {
- return NGX_HTTP_NOT_ALLOWED;
- }
-
- rc = ngx_http_discard_request_body(r);
- if (rc != NGX_OK) {
- return rc;
- }
+static char *ngx_http_upstream_check(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
+static char * ngx_http_upstream_check_http_send(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
+static char * ngx_http_upstream_check_http_expect_alive(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
+
+static char * ngx_http_upstream_check_shm_size(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
+static char * ngx_http_upstream_check_status(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf);
- uclcf = ngx_http_get_module_loc_conf(r, ngx_http_upstream_check_module);
+static void *ngx_http_upstream_check_create_main_conf(ngx_conf_t *cf);
+static char *ngx_http_upstream_check_init_main_conf(ngx_conf_t *cf, void *conf);
- ctx = ngx_pcalloc(r->pool, sizeof(ngx_http_upstream_check_status_ctx_t));
- if (ctx == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
+static void * ngx_http_upstream_check_create_srv_conf(ngx_conf_t *cf);
+static char * ngx_http_upstream_check_init_srv_conf(ngx_conf_t *cf, void *conf);
- ngx_http_upstream_check_status_parse_args(r, ctx);
+static ngx_int_t ngx_http_check_init_process(ngx_cycle_t *cycle);
- if (ctx->format == NULL) {
- ctx->format = uclcf->format;
- }
- r->headers_out.content_type = ctx->format->content_type;
+static ngx_conf_bitmask_t ngx_check_http_expect_alive_masks[] = {
+ { ngx_string("http_2xx"), NGX_CHECK_HTTP_2XX },
+ { ngx_string("http_3xx"), NGX_CHECK_HTTP_3XX },
+ { ngx_string("http_4xx"), NGX_CHECK_HTTP_4XX },
+ { ngx_string("http_5xx"), NGX_CHECK_HTTP_5XX },
+ { ngx_null_string, 0 }
+};
- if (r->method == NGX_HTTP_HEAD) {
- r->headers_out.status = NGX_HTTP_OK;
- rc = ngx_http_send_header(r);
+static ngx_command_t ngx_http_upstream_check_commands[] = {
- if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
- return rc;
- }
- }
+ { ngx_string("check"),
+ NGX_HTTP_UPS_CONF|NGX_CONF_1MORE,
+ ngx_http_upstream_check,
+ 0,
+ 0,
+ NULL },
- peers = check_peers_ctx;
- if (peers == NULL) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "http upstream check module can not find any check "
- "server, make sure you've added the check servers");
+ { ngx_string("check_http_send"),
+ NGX_HTTP_UPS_CONF|NGX_CONF_TAKE1,
+ ngx_http_upstream_check_http_send,
+ 0,
+ 0,
+ NULL },
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
+ { ngx_string("check_http_expect_alive"),
+ NGX_HTTP_UPS_CONF|NGX_CONF_1MORE,
+ ngx_http_upstream_check_http_expect_alive,
+ 0,
+ 0,
+ NULL },
- /* 1/4 pagesize for each record */
- buffer_size = peers->peers.nelts * ngx_pagesize / 4;
- buffer_size = ngx_align(buffer_size, ngx_pagesize) + ngx_pagesize;
+ { ngx_string("check_shm_size"),
+ NGX_HTTP_MAIN_CONF|NGX_CONF_TAKE1,
+ ngx_http_upstream_check_shm_size,
+ 0,
+ 0,
+ NULL },
- b = ngx_create_temp_buf(r->pool, buffer_size);
- if (b == NULL) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
- }
+ { ngx_string("check_status"),
+ NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_NOARGS,
+ ngx_http_upstream_check_status,
+ 0,
+ 0,
+ NULL },
- out.buf = b;
- out.next = NULL;
+ ngx_null_command
+};
- ctx->format->output(b, peers, ctx->flag);
- r->headers_out.status = NGX_HTTP_OK;
- r->headers_out.content_length_n = b->last - b->pos;
+static ngx_http_module_t ngx_http_upstream_check_module_ctx = {
+ NULL, /* preconfiguration */
+ NULL, /* postconfiguration */
- if (r->headers_out.content_length_n == 0) {
- r->header_only = 1;
- }
+ ngx_http_upstream_check_create_main_conf, /* create main configuration */
+ ngx_http_upstream_check_init_main_conf, /* init main configuration */
- b->last_buf = 1;
+ ngx_http_upstream_check_create_srv_conf, /* create server configuration */
+ NULL, /* merge server configuration */
- rc = ngx_http_send_header(r);
+ NULL, /* create location configuration */
+ NULL /* merge location configuration */
+};
- if (rc == NGX_ERROR || rc > NGX_OK || r->header_only) {
- return rc;
- }
- return ngx_http_output_filter(r, &out);
-}
+ngx_module_t ngx_http_upstream_check_module = {
+ NGX_MODULE_V1,
+ &ngx_http_upstream_check_module_ctx, /* module context */
+ ngx_http_upstream_check_commands, /* module directives */
+ NGX_HTTP_MODULE, /* module type */
+ NULL, /* init master */
+ NULL, /* init module */
+ ngx_http_check_init_process, /* init process */
+ NULL, /* init thread */
+ NULL, /* exit thread */
+ NULL, /* exit process */
+ NULL, /* exit master */
+ NGX_MODULE_V1_PADDING
+};
-static void
-ngx_http_upstream_check_status_parse_args(ngx_http_request_t *r,
- ngx_http_upstream_check_status_ctx_t *ctx)
+check_conf_t *
+ngx_http_get_check_type_conf(ngx_str_t *str)
{
- ngx_str_t value;
- ngx_uint_t i;
- ngx_check_status_command_t *command;
-
- if (r->args.len == 0) {
- return;
- }
+ ngx_uint_t i;
- for (i = 0; /* void */ ; i++) {
+ for (i = 0; ;i++) {
- command = &ngx_check_status_commands[i];
-
- if (command->name.len == 0) {
+ if (ngx_check_types[i].type == 0) {
break;
}
- if (ngx_http_arg(r, command->name.data, command->name.len, &value)
- == NGX_OK) {
-
- if (command->handler(ctx, &value) != NGX_OK) {
- ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
- "http upstream check, bad argument: \"%V\"",
- &value);
- }
+ if (ngx_strncmp(str->data,
+ (u_char *)ngx_check_types[i].name, str->len) == 0) {
+ return &ngx_check_types[i];
}
}
- ngx_log_error(NGX_LOG_DEBUG, r->connection->log, 0,
- "http upstream check, flag: \"%ui\"", ctx->flag);
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_status_command_format(
- ngx_http_upstream_check_status_ctx_t *ctx, ngx_str_t *value)
-{
- ctx->format = ngx_http_get_check_status_format_conf(value);
- if (ctx->format == NULL) {
- return NGX_ERROR;
- }
-
- return NGX_OK;
+ return NULL;
}
-static ngx_int_t
-ngx_http_upstream_check_status_command_status(
- ngx_http_upstream_check_status_ctx_t *ctx, ngx_str_t *value)
+ngx_uint_t
+ngx_http_check_add_peer(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us,
+ ngx_peer_addr_t *peer_addr)
{
- if (value->len == (sizeof("down") - 1)
- && ngx_strncasecmp(value->data, (u_char *) "down", value->len) == 0) {
-
- ctx->flag |= NGX_CHECK_STATUS_DOWN;
-
- } else if (value->len == (sizeof("up") - 1)
- && ngx_strncasecmp(value->data, (u_char *) "up", value->len)
- == 0) {
-
- ctx->flag |= NGX_CHECK_STATUS_UP;
+ ngx_http_check_peer_t *peer;
+ ngx_http_check_peers_t *peers;
+ ngx_http_upstream_check_srv_conf_t *ucscf;
+ ngx_http_upstream_check_main_conf_t *ucmcf;
- } else {
+ if (us->srv_conf == NULL) {
return NGX_ERROR;
}
- return NGX_OK;
-}
-
-
-static void
-ngx_http_upstream_check_status_html_format(ngx_buf_t *b,
- ngx_http_upstream_check_peers_t *peers, ngx_uint_t flag)
-{
- ngx_uint_t i, count;
- ngx_http_upstream_check_peer_t *peer;
-
- peer = peers->peers.elts;
-
- count = 0;
-
- for (i = 0; i < peers->peers.nelts; i++) {
-
- if (flag & NGX_CHECK_STATUS_DOWN) {
-
- if (!peer[i].shm->down) {
- continue;
- }
-
- } else if (flag & NGX_CHECK_STATUS_UP) {
-
- if (peer[i].shm->down) {
- continue;
- }
- }
-
- count++;
- }
-
- b->last = ngx_snprintf(b->last, b->end - b->last,
- "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\n"
- "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n"
- "<html xmlns=\"http://www.w3.org/1999/xhtml\">\n"
- "<head>\n"
- " <title>Nginx http upstream check status</title>\n"
- "</head>\n"
- "<body>\n"
- "<h1>Nginx http upstream check status</h1>\n"
- "<h2>Check upstream server number: %ui, generation: %ui</h2>\n"
- "<table style=\"background-color:white\" cellspacing=\"0\" "
- " cellpadding=\"3\" border=\"1\">\n"
- " <tr bgcolor=\"#C0C0C0\">\n"
- " <th>Index</th>\n"
- " <th>Upstream</th>\n"
- " <th>Name</th>\n"
- " <th>Status</th>\n"
- " <th>Rise counts</th>\n"
- " <th>Fall counts</th>\n"
- " <th>Check type</th>\n"
- " <th>Check port</th>\n"
- " </tr>\n",
- count, ngx_http_upstream_check_shm_generation);
-
- for (i = 0; i < peers->peers.nelts; i++) {
-
- if (flag & NGX_CHECK_STATUS_DOWN) {
-
- if (!peer[i].shm->down) {
- continue;
- }
-
- } else if (flag & NGX_CHECK_STATUS_UP) {
-
- if (peer[i].shm->down) {
- continue;
- }
- }
-
- b->last = ngx_snprintf(b->last, b->end - b->last,
- " <tr%s>\n"
- " <td>%ui</td>\n"
- " <td>%V</td>\n"
- " <td>%V</td>\n"
- " <td>%s</td>\n"
- " <td>%ui</td>\n"
- " <td>%ui</td>\n"
- " <td>%V</td>\n"
- " <td>%ui</td>\n"
- " </tr>\n",
- peer[i].shm->down ? " bgcolor=\"#FF0000\"" : "",
- i,
- peer[i].upstream_name,
- &peer[i].peer_addr->name,
- peer[i].shm->down ? "down" : "up",
- peer[i].shm->rise_count,
- peer[i].shm->fall_count,
- &peer[i].conf->check_type_conf->name,
- peer[i].conf->port);
- }
-
- b->last = ngx_snprintf(b->last, b->end - b->last,
- "</table>\n"
- "</body>\n"
- "</html>\n");
-}
-
-
-static void
-ngx_http_upstream_check_status_csv_format(ngx_buf_t *b,
- ngx_http_upstream_check_peers_t *peers, ngx_uint_t flag)
-{
- ngx_uint_t i;
- ngx_http_upstream_check_peer_t *peer;
-
- peer = peers->peers.elts;
- for (i = 0; i < peers->peers.nelts; i++) {
-
- if (flag & NGX_CHECK_STATUS_DOWN) {
-
- if (!peer[i].shm->down) {
- continue;
- }
-
- } else if (flag & NGX_CHECK_STATUS_UP) {
-
- if (peer[i].shm->down) {
- continue;
- }
- }
-
- b->last = ngx_snprintf(b->last, b->end - b->last,
- "%ui,%V,%V,%s,%ui,%ui,%V,%ui\n",
- i,
- peer[i].upstream_name,
- &peer[i].peer_addr->name,
- peer[i].shm->down ? "down" : "up",
- peer[i].shm->rise_count,
- peer[i].shm->fall_count,
- &peer[i].conf->check_type_conf->name,
- peer[i].conf->port);
- }
-}
-
-
-static void
-ngx_http_upstream_check_status_json_format(ngx_buf_t *b,
- ngx_http_upstream_check_peers_t *peers, ngx_uint_t flag)
-{
- ngx_uint_t count, i, last;
- ngx_http_upstream_check_peer_t *peer;
-
- peer = peers->peers.elts;
-
- count = 0;
-
- for (i = 0; i < peers->peers.nelts; i++) {
-
- if (flag & NGX_CHECK_STATUS_DOWN) {
-
- if (!peer[i].shm->down) {
- continue;
- }
-
- } else if (flag & NGX_CHECK_STATUS_UP) {
-
- if (peer[i].shm->down) {
- continue;
- }
- }
+ ucscf = ngx_http_conf_upstream_srv_conf(us, ngx_http_upstream_check_module);
- count++;
+ if(ucscf->check_interval == 0) {
+ return NGX_ERROR;
}
- b->last = ngx_snprintf(b->last, b->end - b->last,
- "{\"servers\": {\n"
- " \"total\": %ui,\n"
- " \"generation\": %ui,\n"
- " \"server\": [\n",
- count,
- ngx_http_upstream_check_shm_generation);
-
- last = peers->peers.nelts - 1;
- for (i = 0; i < peers->peers.nelts; i++) {
-
- if (flag & NGX_CHECK_STATUS_DOWN) {
-
- if (!peer[i].shm->down) {
- continue;
- }
-
- } else if (flag & NGX_CHECK_STATUS_UP) {
-
- if (peer[i].shm->down) {
- continue;
- }
- }
+ ucmcf = ngx_http_conf_get_module_main_conf(cf,
+ ngx_http_upstream_check_module);
+ peers = ucmcf->peers;
- b->last = ngx_snprintf(b->last, b->end - b->last,
- " {\"index\": %ui, "
- "\"upstream\": \"%V\", "
- "\"name\": \"%V\", "
- "\"status\": \"%s\", "
- "\"rise\": %ui, "
- "\"fall\": %ui, "
- "\"type\": \"%V\", "
- "\"port\": %ui}"
- "%s\n",
- i,
- peer[i].upstream_name,
- &peer[i].peer_addr->name,
- peer[i].shm->down ? "down" : "up",
- peer[i].shm->rise_count,
- peer[i].shm->fall_count,
- &peer[i].conf->check_type_conf->name,
- peer[i].conf->port,
- (i == last) ? "" : ",");
+ peer = ngx_array_push(&peers->peers);
+ if (peer == NULL) {
+ return NGX_ERROR;
}
- b->last = ngx_snprintf(b->last, b->end - b->last,
- " ]\n");
-
- b->last = ngx_snprintf(b->last, b->end - b->last,
- "}}\n");
-}
-
-
-static ngx_check_conf_t *
-ngx_http_get_check_type_conf(ngx_str_t *str)
-{
- ngx_uint_t i;
-
- for (i = 0; /* void */ ; i++) {
-
- if (ngx_check_types[i].type == 0) {
- break;
- }
+ ngx_memzero(peer, sizeof(ngx_http_check_peer_t));
- if (str->len != ngx_check_types[i].name.len) {
- continue;
- }
+ peer->index = peers->peers.nelts - 1;
+ peer->conf = ucscf;
+ peer->upstream_name = &us->host;
+ peer->peer_addr = peer_addr;
- if (ngx_strncmp(str->data, ngx_check_types[i].name.data,
- str->len) == 0)
- {
- return &ngx_check_types[i];
- }
- }
+ peers->checksum +=
+ ngx_murmur_hash2(peer_addr->name.data, peer_addr->name.len);
- return NULL;
+ return peer->index;
}
@@ -3069,12 +177,11 @@
ngx_http_upstream_check(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
ngx_str_t *value, s;
- ngx_uint_t i, port, rise, fall, default_down;
+ ngx_uint_t i, rise, fall, default_down;
ngx_msec_t interval, timeout;
ngx_http_upstream_check_srv_conf_t *ucscf;
- /* default values */
- port = 0;
+ /* set default */
rise = 2;
fall = 5;
interval = 30000;
@@ -3104,24 +211,14 @@
continue;
}
- if (ngx_strncmp(value[i].data, "port=", 5) == 0) {
- s.len = value[i].len - 5;
- s.data = value[i].data + 5;
-
- port = ngx_atoi(s.data, s.len);
- if (port == (ngx_uint_t) NGX_ERROR || port == 0) {
- goto invalid_check_parameter;
- }
-
- continue;
- }
-
if (ngx_strncmp(value[i].data, "interval=", 9) == 0) {
s.len = value[i].len - 9;
s.data = value[i].data + 9;
interval = ngx_atoi(s.data, s.len);
- if (interval == (ngx_msec_t) NGX_ERROR || interval == 0) {
+ if (interval == (ngx_msec_t) NGX_ERROR) {
+ goto invalid_check_parameter;
+ } else if (interval == 0) {
goto invalid_check_parameter;
}
@@ -3133,7 +230,9 @@
s.data = value[i].data + 8;
timeout = ngx_atoi(s.data, s.len);
- if (timeout == (ngx_msec_t) NGX_ERROR || timeout == 0) {
+ if (timeout == (ngx_msec_t) NGX_ERROR) {
+ goto invalid_check_parameter;
+ } else if (timeout == 0) {
goto invalid_check_parameter;
}
@@ -3145,7 +244,9 @@
s.data = value[i].data + 5;
rise = ngx_atoi(s.data, s.len);
- if (rise == (ngx_uint_t) NGX_ERROR || rise == 0) {
+ if (rise == (ngx_uint_t) NGX_ERROR) {
+ goto invalid_check_parameter;
+ } else if (rise == 0) {
goto invalid_check_parameter;
}
@@ -3157,7 +258,9 @@
s.data = value[i].data + 5;
fall = ngx_atoi(s.data, s.len);
- if (fall == (ngx_uint_t) NGX_ERROR || fall == 0) {
+ if (fall == (ngx_uint_t) NGX_ERROR) {
+ goto invalid_check_parameter;
+ } else if (fall == 0) {
goto invalid_check_parameter;
}
@@ -3186,7 +289,6 @@
goto invalid_check_parameter;
}
- ucscf->port = port;
ucscf->check_interval = interval;
ucscf->check_timeout = timeout;
ucscf->fall_count = fall;
@@ -3194,87 +296,34 @@
ucscf->default_down = default_down;
if (ucscf->check_type_conf == NGX_CONF_UNSET_PTR) {
- ngx_str_set(&s, "tcp");
- ucscf->check_type_conf = ngx_http_get_check_type_conf(&s);
- }
-
- return NGX_CONF_OK;
-
-invalid_check_parameter:
-
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid parameter \"%V\"", &value[i]);
-
- return NGX_CONF_ERROR;
-}
-
-
-static char *
-ngx_http_upstream_check_keepalive_requests(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf)
-{
- ngx_str_t *value;
- ngx_http_upstream_check_srv_conf_t *ucscf;
- ngx_uint_t requests;
-
- value = cf->args->elts;
-
- ucscf = ngx_http_conf_get_module_srv_conf(cf,
- ngx_http_upstream_check_module);
+ s.len = sizeof("tcp") - 1;
+ s.data =(u_char *) "tcp";
- requests = ngx_atoi(value[1].data, value[1].len);
- if (requests == (ngx_uint_t) NGX_ERROR || requests == 0) {
- return "invalid value";
+ ucscf->check_type_conf = ngx_http_get_check_type_conf(&s);
}
- ucscf->check_keepalive_requests = requests;
-
return NGX_CONF_OK;
-}
-
-
-static char *
-ngx_http_upstream_check_http_send(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf)
-{
- ngx_str_t *value;
- ngx_http_upstream_check_srv_conf_t *ucscf;
- value = cf->args->elts;
-
- ucscf = ngx_http_conf_get_module_srv_conf(cf,
- ngx_http_upstream_check_module);
+invalid_check_parameter:
- ucscf->send = value[1];
+ ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
+ "invalid parameter \"%V\"", &value[i]);
- return NGX_CONF_OK;
+ return NGX_CONF_ERROR;
}
static char *
-ngx_http_upstream_check_fastcgi_params(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf)
+ngx_http_upstream_check_http_send(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
{
- ngx_str_t *value, *k, *v;
+ ngx_str_t *value;
ngx_http_upstream_check_srv_conf_t *ucscf;
value = cf->args->elts;
- ucscf = ngx_http_conf_get_module_srv_conf(cf,
- ngx_http_upstream_check_module);
-
- k = ngx_array_push(ucscf->fastcgi_params);
- if (k == NULL) {
- return NGX_CONF_ERROR;
- }
-
- v = ngx_array_push(ucscf->fastcgi_params);
- if (v == NULL) {
- return NGX_CONF_ERROR;
- }
+ ucscf = ngx_http_conf_get_module_srv_conf(cf, ngx_http_upstream_check_module);
- *k = value[1];
- *v = value[2];
+ ucscf->send = value[1];
return NGX_CONF_OK;
}
@@ -3282,7 +331,7 @@
static char *
ngx_http_upstream_check_http_expect_alive(ngx_conf_t *cf, ngx_command_t *cmd,
- void *conf)
+ void *conf)
{
ngx_str_t *value;
ngx_uint_t bit, i, m;
@@ -3337,7 +386,8 @@
ngx_http_upstream_check_main_conf_t *ucmcf;
ucmcf = ngx_http_conf_get_module_main_conf(cf,
- ngx_http_upstream_check_module);
+ ngx_http_upstream_check_module);
+
if (ucmcf->check_shm_size) {
return "is duplicate";
}
@@ -3353,58 +403,16 @@
}
-static ngx_check_status_conf_t *
-ngx_http_get_check_status_format_conf(ngx_str_t *str)
-{
- ngx_uint_t i;
-
- for (i = 0; /* void */ ; i++) {
-
- if (ngx_check_status_formats[i].format.len == 0) {
- break;
- }
-
- if (str->len != ngx_check_status_formats[i].format.len) {
- continue;
- }
-
- if (ngx_strncmp(str->data, ngx_check_status_formats[i].format.data,
- str->len) == 0)
- {
- return &ngx_check_status_formats[i];
- }
- }
-
- return NULL;
-}
-
-
static char *
-ngx_http_upstream_check_status(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+ngx_http_upstream_check_status(ngx_conf_t *cf,
+ ngx_command_t *cmd, void *conf)
{
- ngx_str_t *value;
- ngx_http_core_loc_conf_t *clcf;
- ngx_http_upstream_check_loc_conf_t *uclcf;
-
- value = cf->args->elts;
+ ngx_http_core_loc_conf_t *clcf;
clcf = ngx_http_conf_get_module_loc_conf(cf, ngx_http_core_module);
clcf->handler = ngx_http_upstream_check_status_handler;
- if (cf->args->nelts == 2) {
- uclcf = ngx_http_conf_get_module_loc_conf(cf,
- ngx_http_upstream_check_module);
-
- uclcf->format = ngx_http_get_check_status_format_conf(&value[1]);
- if (uclcf->format == NULL) {
- ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
- "invalid check format \"%V\"", &value[1]);
-
- return NGX_CONF_ERROR;
- }
- }
-
return NGX_CONF_OK;
}
@@ -3419,8 +427,7 @@
return NULL;
}
- ucmcf->peers = ngx_pcalloc(cf->pool,
- sizeof(ngx_http_upstream_check_peers_t));
+ ucmcf->peers = ngx_pcalloc(cf->pool, sizeof(ngx_http_check_peers_t));
if (ucmcf->peers == NULL) {
return NULL;
}
@@ -3428,7 +435,7 @@
ucmcf->peers->checksum = 0;
if (ngx_array_init(&ucmcf->peers->peers, cf->pool, 16,
- sizeof(ngx_http_upstream_check_peer_t)) != NGX_OK)
+ sizeof(ngx_http_check_peer_t)) != NGX_OK)
{
return NULL;
}
@@ -3437,133 +444,14 @@
}
-static ngx_buf_t *
-ngx_http_upstream_check_create_fastcgi_request(ngx_pool_t *pool,
- ngx_str_t *params, ngx_uint_t num)
-{
- size_t size, len, padding;
- ngx_buf_t *b;
- ngx_str_t *k, *v;
- ngx_uint_t i, j;
- ngx_http_fastcgi_header_t *h;
-
- len = 0;
- for (i = 0, j = 0; i < num; i++, j = i * 2) {
- k = ¶ms[j];
- v = ¶ms[j + 1];
-
- len += 1 + k->len + ((v->len > 127) ? 4 : 1) + v->len;
- }
-
- padding = 8 - len % 8;
- padding = (padding == 8) ? 0 : padding;
-
- size = sizeof(ngx_http_fastcgi_header_t)
- + sizeof(ngx_http_fastcgi_begin_request_t)
-
- + sizeof(ngx_http_fastcgi_header_t) /* NGX_HTTP_FASTCGI_PARAMS */
- + len + padding
- + sizeof(ngx_http_fastcgi_header_t) /* NGX_HTTP_FASTCGI_PARAMS */
-
- + sizeof(ngx_http_fastcgi_header_t); /* NGX_HTTP_FASTCGI_STDIN */
-
-
- b = ngx_create_temp_buf(pool, size);
- if (b == NULL) {
- return NULL;
- }
-
- ngx_http_fastcgi_request_start.br.flags = 0;
-
- ngx_memcpy(b->pos, &ngx_http_fastcgi_request_start,
- sizeof(ngx_http_fastcgi_request_start_t));
-
- h = (ngx_http_fastcgi_header_t *)
- (b->pos + sizeof(ngx_http_fastcgi_header_t)
- + sizeof(ngx_http_fastcgi_begin_request_t));
-
- h->content_length_hi = (u_char) ((len >> 8) & 0xff);
- h->content_length_lo = (u_char) (len & 0xff);
- h->padding_length = (u_char) padding;
- h->reserved = 0;
-
- b->last = b->pos + sizeof(ngx_http_fastcgi_header_t)
- + sizeof(ngx_http_fastcgi_begin_request_t)
- + sizeof(ngx_http_fastcgi_header_t);
-
- for (i = 0, j = 0; i < num; i++, j = i * 2) {
- k = ¶ms[j];
- v = ¶ms[j + 1];
-
- if (k->len > 127) {
- *b->last++ = (u_char) (((k->len >> 24) & 0x7f) | 0x80);
- *b->last++ = (u_char) ((k->len >> 16) & 0xff);
- *b->last++ = (u_char) ((k->len >> 8) & 0xff);
- *b->last++ = (u_char) (k->len & 0xff);
-
- } else {
- *b->last++ = (u_char) k->len;
- }
-
- if (v->len > 127) {
- *b->last++ = (u_char) (((v->len >> 24) & 0x7f) | 0x80);
- *b->last++ = (u_char) ((v->len >> 16) & 0xff);
- *b->last++ = (u_char) ((v->len >> 8) & 0xff);
- *b->last++ = (u_char) (v->len & 0xff);
-
- } else {
- *b->last++ = (u_char) v->len;
- }
-
- b->last = ngx_copy(b->last, k->data, k->len);
- b->last = ngx_copy(b->last, v->data, v->len);
- }
-
- if (padding) {
- ngx_memzero(b->last, padding);
- b->last += padding;
- }
-
- h = (ngx_http_fastcgi_header_t *) b->last;
- b->last += sizeof(ngx_http_fastcgi_header_t);
-
- h->version = 1;
- h->type = NGX_HTTP_FASTCGI_PARAMS;
- h->request_id_hi = 0;
- h->request_id_lo = 1;
- h->content_length_hi = 0;
- h->content_length_lo = 0;
- h->padding_length = 0;
- h->reserved = 0;
-
- h = (ngx_http_fastcgi_header_t *) b->last;
- b->last += sizeof(ngx_http_fastcgi_header_t);
-
- return b;
-}
-
-
static char *
ngx_http_upstream_check_init_main_conf(ngx_conf_t *cf, void *conf)
{
- ngx_buf_t *b;
- ngx_uint_t i;
- ngx_http_upstream_srv_conf_t **uscfp;
- ngx_http_upstream_main_conf_t *umcf;
+ ngx_uint_t i;
+ ngx_http_upstream_srv_conf_t **uscfp;
+ ngx_http_upstream_main_conf_t *umcf;
umcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_upstream_module);
-
- b = ngx_http_upstream_check_create_fastcgi_request(cf->pool,
- fastcgi_default_params,
- sizeof(fastcgi_default_params) / sizeof(ngx_str_t) / 2);
-
- if (b == NULL) {
- return NGX_CONF_ERROR;
- }
-
- fastcgi_default_request.data = b->pos;
- fastcgi_default_request.len = b->last - b->pos;
-
uscfp = umcf->upstreams.elts;
for (i = 0; i < umcf->upstreams.nelts; i++) {
@@ -3587,46 +475,21 @@
return NULL;
}
- ucscf->fastcgi_params = ngx_array_create(cf->pool, 2 * 4, sizeof(ngx_str_t));
- if (ucscf->fastcgi_params == NULL) {
- return NULL;
- }
-
- ucscf->port = NGX_CONF_UNSET_UINT;
ucscf->fall_count = NGX_CONF_UNSET_UINT;
ucscf->rise_count = NGX_CONF_UNSET_UINT;
ucscf->check_timeout = NGX_CONF_UNSET_MSEC;
- ucscf->check_keepalive_requests = NGX_CONF_UNSET_UINT;
ucscf->check_type_conf = NGX_CONF_UNSET_PTR;
return ucscf;
}
-static void *
-ngx_http_upstream_check_create_loc_conf(ngx_conf_t *cf)
-{
- ngx_http_upstream_check_loc_conf_t *uclcf;
-
- uclcf = ngx_pcalloc(cf->pool, sizeof(ngx_http_upstream_check_loc_conf_t));
- if (uclcf == NULL) {
- return NULL;
- }
-
- uclcf->format = NGX_CONF_UNSET_PTR;
-
- return uclcf;
-}
-
-
static char *
ngx_http_upstream_check_init_srv_conf(ngx_conf_t *cf, void *conf)
{
- ngx_str_t s;
- ngx_buf_t *b;
- ngx_check_conf_t *check;
- ngx_http_upstream_srv_conf_t *us = conf;
- ngx_http_upstream_check_srv_conf_t *ucscf;
+ check_conf_t *check;
+ ngx_http_upstream_srv_conf_t *us = conf;
+ ngx_http_upstream_check_srv_conf_t *ucscf;
if (us->srv_conf == NULL) {
return NGX_CONF_OK;
@@ -3634,10 +497,6 @@
ucscf = ngx_http_conf_upstream_srv_conf(us, ngx_http_upstream_check_module);
- if (ucscf->port == NGX_CONF_UNSET_UINT) {
- ucscf->port = 0;
- }
-
if (ucscf->fall_count == NGX_CONF_UNSET_UINT) {
ucscf->fall_count = 2;
}
@@ -3654,44 +513,17 @@
ucscf->check_timeout = 1000;
}
- if (ucscf->check_keepalive_requests == NGX_CONF_UNSET_UINT) {
- ucscf->check_keepalive_requests = 1;
- }
-
if (ucscf->check_type_conf == NGX_CONF_UNSET_PTR) {
ucscf->check_type_conf = NULL;
}
check = ucscf->check_type_conf;
-
if (check) {
if (ucscf->send.len == 0) {
- ngx_str_set(&s, "fastcgi");
-
- if (check == ngx_http_get_check_type_conf(&s)) {
-
- if (ucscf->fastcgi_params->nelts == 0) {
- ucscf->send.data = fastcgi_default_request.data;
- ucscf->send.len = fastcgi_default_request.len;
-
- } else {
- b = ngx_http_upstream_check_create_fastcgi_request(
- cf->pool, ucscf->fastcgi_params->elts,
- ucscf->fastcgi_params->nelts / 2);
- if (b == NULL) {
- return NGX_CONF_ERROR;
- }
-
- ucscf->send.data = b->pos;
- ucscf->send.len = b->last - b->pos;
- }
- } else {
- ucscf->send.data = check->default_send.data;
- ucscf->send.len = check->default_send.len;
- }
+ ucscf->send.data = check->default_send.data;
+ ucscf->send.len = check->default_send.len;
}
-
if (ucscf->code.status_alive == 0) {
ucscf->code.status_alive = check->default_status_alive;
}
@@ -3701,366 +533,8 @@
}
-static char *
-ngx_http_upstream_check_merge_loc_conf(ngx_conf_t *cf, void *parent,
- void *child)
-{
- ngx_str_t format = ngx_string("html");
- ngx_http_upstream_check_loc_conf_t *prev = parent;
- ngx_http_upstream_check_loc_conf_t *conf = child;
-
- ngx_conf_merge_ptr_value(conf->format, prev->format,
- ngx_http_get_check_status_format_conf(&format));
-
- return NGX_CONF_OK;
-}
-
-
-static char *
-ngx_http_upstream_check_init_shm(ngx_conf_t *cf, void *conf)
-{
- ngx_str_t *shm_name;
- ngx_uint_t shm_size;
- ngx_shm_zone_t *shm_zone;
- ngx_http_upstream_check_main_conf_t *ucmcf = conf;
-
- if (ucmcf->peers->peers.nelts > 0) {
-
- ngx_http_upstream_check_shm_generation++;
-
- shm_name = &ucmcf->peers->check_shm_name;
-
- ngx_http_upstream_check_get_shm_name(shm_name, cf->pool,
- ngx_http_upstream_check_shm_generation);
-
- /* The default check shared memory size is 1M */
- shm_size = 1 * 1024 * 1024;
-
- shm_size = shm_size < ucmcf->check_shm_size ?
- ucmcf->check_shm_size : shm_size;
-
- shm_zone = ngx_shared_memory_add(cf, shm_name, shm_size,
- &ngx_http_upstream_check_module);
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, cf->log, 0,
- "http upstream check, upsteam:%V, shm_zone size:%ui",
- shm_name, shm_size);
-
- shm_zone->data = cf->pool;
- check_peers_ctx = ucmcf->peers;
-
- shm_zone->init = ngx_http_upstream_check_init_shm_zone;
- }
- else {
- check_peers_ctx = NULL;
- }
-
- return NGX_CONF_OK;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_get_shm_name(ngx_str_t *shm_name, ngx_pool_t *pool,
- ngx_uint_t generation)
-{
- u_char *last;
-
- shm_name->data = ngx_palloc(pool, SHM_NAME_LEN);
- if (shm_name->data == NULL) {
- return NGX_ERROR;
- }
-
- last = ngx_snprintf(shm_name->data, SHM_NAME_LEN, "%s#%ui",
- "ngx_http_upstream_check", generation);
-
- shm_name->len = last - shm_name->data;
-
- return NGX_OK;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_init_shm_zone(ngx_shm_zone_t *shm_zone, void *data)
-{
- size_t size;
- ngx_str_t oshm_name;
- ngx_int_t rc;
- ngx_uint_t i, same, number;
- ngx_pool_t *pool;
- ngx_shm_zone_t *oshm_zone;
- ngx_slab_pool_t *shpool;
- ngx_http_upstream_check_peer_t *peer;
- ngx_http_upstream_check_peers_t *peers;
- ngx_http_upstream_check_srv_conf_t *ucscf;
- ngx_http_upstream_check_peer_shm_t *peer_shm, *opeer_shm;
- ngx_http_upstream_check_peers_shm_t *peers_shm, *opeers_shm;
-
- opeers_shm = NULL;
- peers_shm = NULL;
- ngx_str_null(&oshm_name);
-
- same = 0;
- peers = check_peers_ctx;
- if (peers == NULL) {
- return NGX_OK;
- }
-
- number = peers->peers.nelts;
- if (number == 0) {
- return NGX_OK;
- }
-
- pool = shm_zone->data;
- if (pool == NULL) {
- pool = ngx_cycle->pool;
- }
-
- shpool = (ngx_slab_pool_t *) shm_zone->shm.addr;
-
- if (data) {
- opeers_shm = data;
-
- if ((opeers_shm->number == number)
- && (opeers_shm->checksum == peers->checksum)) {
-
- peers_shm = data;
- same = 1;
- }
- }
-
- if (!same) {
-
- if (ngx_http_upstream_check_shm_generation > 1) {
-
- ngx_http_upstream_check_get_shm_name(&oshm_name,
- pool, ngx_http_upstream_check_shm_generation - 1);
-
- /* The global variable ngx_cycle still points to the old one */
- oshm_zone = ngx_shared_memory_find((ngx_cycle_t *) ngx_cycle,
- &oshm_name,
- &ngx_http_upstream_check_module);
-
- if (oshm_zone) {
- opeers_shm = oshm_zone->data;
-
- ngx_log_debug2(NGX_LOG_DEBUG_HTTP, shm_zone->shm.log, 0,
- "http upstream check, find oshm_zone:%p, "
- "opeers_shm: %p",
- oshm_zone, opeers_shm);
- }
- }
-
- size = sizeof(*peers_shm) +
- (number - 1) * sizeof(ngx_http_upstream_check_peer_shm_t);
-
- peers_shm = ngx_slab_alloc(shpool, size);
-
- if (peers_shm == NULL) {
- goto failure;
- }
-
- ngx_memzero(peers_shm, size);
- }
-
- peers_shm->generation = ngx_http_upstream_check_shm_generation;
- peers_shm->checksum = peers->checksum;
- peers_shm->number = number;
-
- peer = peers->peers.elts;
-
- for (i = 0; i < number; i++) {
-
- peer_shm = &peers_shm->peers[i];
-
- /*
- * This function may be triggered before the old stale
- * work process exits. The owner may stick to the old
- * pid.
- */
- peer_shm->owner = NGX_INVALID_PID;
-
- if (same) {
- continue;
- }
-
- peer_shm->socklen = peer[i].peer_addr->socklen;
- peer_shm->sockaddr = ngx_slab_alloc(shpool, peer_shm->socklen);
- if (peer_shm->sockaddr == NULL) {
- goto failure;
- }
-
- ngx_memcpy(peer_shm->sockaddr, peer[i].peer_addr->sockaddr,
- peer_shm->socklen);
-
- if (opeers_shm) {
-
- opeer_shm = ngx_http_upstream_check_find_shm_peer(opeers_shm,
- peer[i].peer_addr,
- peer[i].upstream_name);
- if (opeer_shm) {
- ngx_log_debug1(NGX_LOG_DEBUG_HTTP, shm_zone->shm.log, 0,
- "http upstream check, inherit opeer: %V ",
- &peer[i].peer_addr->name);
-
- rc = ngx_http_upstream_check_init_shm_peer(peer_shm, opeer_shm,
- 0, pool, &peer[i].peer_addr->name, peer[i].upstream_name);
- if (rc != NGX_OK) {
- return NGX_ERROR;
- }
-
- continue;
- }
- }
-
- ucscf = peer[i].conf;
- rc = ngx_http_upstream_check_init_shm_peer(peer_shm, NULL,
- ucscf->default_down, pool,
- &peer[i].peer_addr->name,
- peer[i].upstream_name);
- if (rc != NGX_OK) {
- return NGX_ERROR;
- }
- }
-
- peers->peers_shm = peers_shm;
- shm_zone->data = peers_shm;
-
- return NGX_OK;
-
-failure:
- ngx_log_error(NGX_LOG_EMERG, shm_zone->shm.log, 0,
- "http upstream check_shm_size is too small, "
- "you should specify a larger size.");
- return NGX_ERROR;
-}
-
-
-static ngx_shm_zone_t *
-ngx_shared_memory_find(ngx_cycle_t *cycle, ngx_str_t *name, void *tag)
-{
- ngx_uint_t i;
- ngx_shm_zone_t *shm_zone;
- ngx_list_part_t *part;
-
- part = (ngx_list_part_t *) &(cycle->shared_memory.part);
- shm_zone = part->elts;
-
- for (i = 0; /* void */ ; i++) {
-
- if (i >= part->nelts) {
- if (part->next == NULL) {
- break;
- }
- part = part->next;
- shm_zone = part->elts;
- i = 0;
- }
-
- if (name->len != shm_zone[i].shm.name.len) {
- continue;
- }
-
- if (ngx_strncmp(name->data, shm_zone[i].shm.name.data, name->len) != 0)
- {
- continue;
- }
-
- if (tag != shm_zone[i].tag) {
- continue;
- }
-
- return &shm_zone[i];
- }
-
- return NULL;
-}
-
-
-static ngx_http_upstream_check_peer_shm_t *
-ngx_http_upstream_check_find_shm_peer(ngx_http_upstream_check_peers_shm_t *p,
- ngx_addr_t *addr, ngx_str_t *upstream_name)
-{
- ngx_uint_t i;
- ngx_http_upstream_check_peer_shm_t *peer_shm;
-
- for (i = 0; i < p->number; i++) {
-
- peer_shm = &p->peers[i];
-
- if (addr->socklen != peer_shm->socklen) {
- continue;
- }
-
- if (ngx_memcmp(addr->sockaddr, peer_shm->sockaddr, addr->socklen) == 0
- && upstream_name->len == peer_shm->upstream_name->len
- && ngx_strncmp(upstream_name->data, peer_shm->upstream_name->data, upstream_name->len) == 0) {
- return peer_shm;
- }
- }
-
- return NULL;
-}
-
-
-static ngx_int_t
-ngx_http_upstream_check_init_shm_peer(ngx_http_upstream_check_peer_shm_t *psh,
- ngx_http_upstream_check_peer_shm_t *opsh, ngx_uint_t init_down,
- ngx_pool_t *pool, ngx_str_t *name, ngx_str_t *upstream_name)
-{
- u_char *file;
-
- if (opsh) {
- psh->access_time = opsh->access_time;
- psh->access_count = opsh->access_count;
-
- psh->fall_count = opsh->fall_count;
- psh->rise_count = opsh->rise_count;
- psh->busyness = opsh->busyness;
-
- psh->down = opsh->down;
- psh->upstream_name = opsh->upstream_name;
-
- } else {
- psh->access_time = 0;
- psh->access_count = 0;
-
- psh->fall_count = 0;
- psh->rise_count = 0;
- psh->busyness = 0;
-
- psh->down = init_down;
- psh->upstream_name = upstream_name;
- }
-
-#if (NGX_HAVE_ATOMIC_OPS)
-
- file = NULL;
-
-#else
-
- file = ngx_pnalloc(pool, ngx_cycle->lock_file.len + name->len);
- if (file == NULL) {
- return NGX_ERROR;
- }
-
- (void) ngx_sprintf(file, "%V%V%Z", &ngx_cycle->lock_file, name);
-
-#endif
-
-#if (nginx_version >= 1002000)
- if (ngx_shmtx_create(&psh->mutex, &psh->lock, file) != NGX_OK) {
-#else
- if (ngx_shmtx_create(&psh->mutex, (void *) &psh->lock, file) != NGX_OK) {
-#endif
- return NGX_ERROR;
- }
-
- return NGX_OK;
-}
-
-
static ngx_int_t
-ngx_http_upstream_check_init_process(ngx_cycle_t *cycle)
+ngx_http_check_init_process(ngx_cycle_t *cycle)
{
- return ngx_http_upstream_check_add_timers(cycle);
+ return ngx_http_check_add_timers(cycle);
}
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/ngx_http_upstream_check_module.h
^
|
@@ -1,19 +1,101 @@
#ifndef _NGX_HTTP_UPSTREAM_CHECK_MODELE_H_INCLUDED_
#define _NGX_HTTP_UPSTREAM_CHECK_MODELE_H_INCLUDED_
-
#include <ngx_config.h>
#include <ngx_core.h>
+#include <ngx_event.h>
+#include <ngx_event_connect.h>
+#include <ngx_event_pipe.h>
#include <ngx_http.h>
+#include <nginx.h>
+
+
+typedef struct ngx_http_check_peer_s ngx_http_check_peer_t;
+typedef struct ngx_http_check_peers_s ngx_http_check_peers_t;
+typedef struct check_conf_s check_conf_t;
+
+/* make nginx-0.8.22+ happy */
+#if defined(nginx_version) && nginx_version >= 8022
+typedef ngx_addr_t ngx_peer_addr_t;
+#endif
+
+typedef ngx_int_t (*ngx_http_check_packet_init_pt)(ngx_http_check_peer_t *peer);
+typedef ngx_int_t (*ngx_http_check_packet_parse_pt)(ngx_http_check_peer_t *peer);
+typedef void (*ngx_http_check_packet_clean_pt)(ngx_http_check_peer_t *peer);
+
+#define NGX_HTTP_CHECK_TCP 0x0001
+#define NGX_HTTP_CHECK_HTTP 0x0002
+#define NGX_HTTP_CHECK_SSL_HELLO 0x0004
+#define NGX_HTTP_CHECK_SMTP 0x0008
+#define NGX_HTTP_CHECK_MYSQL 0x0010
+#define NGX_HTTP_CHECK_POP3 0x0020
+#define NGX_HTTP_CHECK_IMAP 0x0040
+#define NGX_HTTP_CHECK_AJP 0x0080
+
+
+#define NGX_CHECK_HTTP_2XX 0x0002
+#define NGX_CHECK_HTTP_3XX 0x0004
+#define NGX_CHECK_HTTP_4XX 0x0008
+#define NGX_CHECK_HTTP_5XX 0x0010
+#define NGX_CHECK_HTTP_6XX 0x0020
+#define NGX_CHECK_HTTP_ERR 0x8000
+
+#define NGX_CHECK_SMTP_2XX 0x0002
+#define NGX_CHECK_SMTP_3XX 0x0004
+#define NGX_CHECK_SMTP_4XX 0x0008
+#define NGX_CHECK_SMTP_5XX 0x0010
+#define NGX_CHECK_SMTP_6XX 0x0020
+#define NGX_CHECK_SMTP_ERR 0x8000
+
+struct check_conf_s {
+ ngx_uint_t type;
+
+ char *name;
+
+ ngx_str_t default_send;
+
+ /* HTTP */
+ ngx_uint_t default_status_alive;
+
+ ngx_event_handler_pt send_handler;
+ ngx_event_handler_pt recv_handler;
+
+ ngx_http_check_packet_init_pt init;
+ ngx_http_check_packet_parse_pt parse;
+ ngx_http_check_packet_clean_pt reinit;
+
+ unsigned need_pool;
+};
+
+typedef struct {
+ ngx_uint_t check_shm_size;
+ ngx_http_check_peers_t *peers;
+} ngx_http_upstream_check_main_conf_t;
+
+typedef struct {
+ ngx_uint_t fall_count;
+ ngx_uint_t rise_count;
+ ngx_msec_t check_interval;
+ ngx_msec_t check_timeout;
+
+ check_conf_t *check_type_conf;
+ ngx_str_t send;
+
+ union {
+ ngx_uint_t return_code;
+ ngx_uint_t status_alive;
+ } code;
+
+ ngx_uint_t default_down;
+} ngx_http_upstream_check_srv_conf_t;
-ngx_uint_t ngx_http_upstream_check_add_peer(ngx_conf_t *cf,
- ngx_http_upstream_srv_conf_t *us, ngx_addr_t *peer);
-ngx_uint_t ngx_http_upstream_check_peer_down(ngx_uint_t index);
+ngx_uint_t ngx_http_check_add_peer(ngx_conf_t *cf,
+ ngx_http_upstream_srv_conf_t *us, ngx_peer_addr_t *peer);
-void ngx_http_upstream_check_get_peer(ngx_uint_t index);
-void ngx_http_upstream_check_free_peer(ngx_uint_t index);
+check_conf_t *ngx_http_get_check_type_conf(ngx_str_t *str);
+extern ngx_module_t ngx_http_upstream_check_module;
#endif //_NGX_HTTP_UPSTREAM_CHECK_MODELE_H_INCLUDED_
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/ngx_http_upstream_jvm_route_module.patch
^
|
@@ -6,8 +6,8 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
@@ -17,7 +17,7 @@
time_t fail_timeout;
ngx_uint_t down; /* unsigned down:1; */
ngx_str_t srun_id;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_uint_t check_index;
+#endif
@@ -27,10 +27,10 @@
peers->peer[n].fail_timeout = server[i].fail_timeout;
peers->peer[n].down = server[i].down;
peers->peer[n].weight = server[i].down ? 0 : server[i].weight;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -43,10 +43,10 @@
backup->peer[n].max_busy = server[i].max_busy;
backup->peer[n].fail_timeout = server[i].fail_timeout;
backup->peer[n].down = server[i].down;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -59,7 +59,7 @@
peers->peer[i].max_fails = 1;
peers->peer[i].max_busy = 0;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
@@ -69,8 +69,8 @@
return NGX_BUSY;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+ if (ngx_http_upstream_check_peer_down(peer->check_index)) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++ if (ngx_http_check_peer_down(peer->check_index)) {
+ return NGX_BUSY;
+ }
+#endif
|
[-]
[+]
|
Deleted |
nginx_upstream_check_module-master.tar.gz/test/t/check_interface.t
^
|
@@ -1,522 +0,0 @@
-# vi:filetype=perl
-
-use lib 'lib';
-use Test::Nginx::LWP;
-
-plan tests => repeat_each(2) * 3 * blocks();
-
-no_root_location();
-
-run_tests();
-
-__DATA__
-
-=== TEST 1: the http_check interface, default type
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status;
- }
-
---- request
-GET /status
---- response_headers
-Content-Type: text/html
---- response_body_like: ^.*Check upstream server number: 6.*$
-
-=== TEST 2: the http_check interface, html
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status html;
- }
-
---- request
-GET /status
---- response_headers
-Content-Type: text/html
---- response_body_like: ^.*Check upstream server number: 6.*$
-
-=== TEST 3: the http_check interface, csv
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status csv;
- }
-
---- request
-GET /status
---- response_headers
-Content-Type: text/plain
---- response_body_like: ^.*$
-
-=== TEST 4: the http_check interface, json
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status json;
- }
-
---- request
-GET /status
---- response_headers
-Content-Type: application/json
---- response_body_like: ^.*"total": 6,.*$
-
-=== TEST 5: the http_check interface, default html, request csv
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status html;
- }
-
---- request
-GET /status?format=csv
---- response_headers
-Content-Type: text/plain
---- response_body_like: ^.*$
-
-=== TEST 6: the http_check interface, default csv, request json
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status csv;
- }
-
---- request
-GET /status?format=json
---- response_headers
-Content-Type: application/json
---- response_body_like: ^.*"total": 6,.*$
-
-=== TEST 7: the http_check interface, default json, request html
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status json;
- }
-
---- request
-GET /status?format=html
---- response_headers
-Content-Type: text/html
---- response_body_like: ^.*Check upstream server number: 6.*$
-
-=== TEST 8: the http_check interface, default json, request htm, bad format
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status json;
- }
-
---- request
-GET /status?format=htm
---- response_headers
-Content-Type: application/json
---- response_body_like: ^.*"total": 6,.*$
-
-=== TEST 9: the http_check interface, default html, request csv and up
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status html;
- }
-
---- request
-GET /status?format=csv&status=up
---- response_headers
-Content-Type: text/plain
---- response_body_like: ^[:\.,\w]+\n$
-
-=== TEST 10: the http_check interface, default csv, request json and down
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status csv;
- }
-
---- request
-GET /status?format=json&status=down
---- response_headers
-Content-Type: application/json
---- response_body_like: ^.*"total": 5,.*$
-
-=== TEST 11: the http_check interface, default json, request html and up
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=2000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status json;
- }
-
---- request
-GET /status?format=html&status=up
---- response_headers
-Content-Type: text/html
---- response_body_like: ^.*Check upstream server number: 1.*$
-
-=== TEST 12: the http_check interface, default json, request html, bad status
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status json;
- }
-
---- request
-GET /status?format=html&status=foo
---- response_headers
-Content-Type: text/html
---- response_body_like: ^.*Check upstream server number: 6.*$
-
-=== TEST 13: the http_check interface, with check_keepalive_requests configured
---- http_config
-upstream backend {
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
- server 127.0.0.1:1973;
- server 127.0.0.1:1970;
- server 127.0.0.1:1974;
- server 127.0.0.1:1975;
-
- check_keepalive_requests 10;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
-}
-
-server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
-}
-
---- config
- location / {
- proxy_pass http://backend;
- }
-
- location /status {
- check_status;
- }
-
---- request
-GET /status
---- response_headers
-Content-Type: text/html
---- response_body_like: ^.*Check upstream server number: 6.*$
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/test/t/http_check.t
^
|
@@ -1,3 +1,21 @@
+#
+#===============================================================================
+#
+# FILE: http_check.t
+#
+# DESCRIPTION: test
+#
+# FILES: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Weibin Yao (http://yaoweibin.cn/), yaoweibin@gmail.com
+# COMPANY:
+# VERSION: 1.0
+# CREATED: 03/02/2010 03:18:28 PM
+# REVISION: ---
+#===============================================================================
+
+
# vi:filetype=perl
use lib 'lib';
@@ -6,6 +24,7 @@
plan tests => repeat_each(2) * 2 * blocks();
no_root_location();
+#no_diff;
run_tests();
@@ -14,21 +33,12 @@
=== TEST 1: the http_check test-single server
--- http_config
upstream test{
- server 127.0.0.1:1970;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ server blog.163.com:80;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -41,10 +51,10 @@
=== TEST 2: the http_check test-multi_server
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
@@ -58,15 +68,6 @@
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -79,23 +80,14 @@
=== TEST 3: the http_check test
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET /foo HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -109,17 +101,8 @@
=== TEST 4: the http_check without check directive
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
+ server blog.163.com:80;
+ server blog.163.com:81;
}
--- config
@@ -134,26 +117,17 @@
=== TEST 5: the http_check which does not use the upstream
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
- proxy_pass http://127.0.0.1:1970;
+ proxy_pass http://blog.163.com;
}
--- request
@@ -163,23 +137,14 @@
=== TEST 6: the http_check test-single server
--- http_config
upstream test{
- server 127.0.0.1:1970;
+ server blog.163.com:80;
ip_hash;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -192,24 +157,15 @@
=== TEST 7: the http_check test-multi_server
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
ip_hash;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -222,24 +178,15 @@
=== TEST 8: the http_check test
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
ip_hash;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET /foo HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -253,20 +200,11 @@
=== TEST 9: the http_check without check directive
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
ip_hash;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -279,27 +217,18 @@
=== TEST 10: the http_check which does not use the upstream
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
ip_hash;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
- proxy_pass http://127.0.0.1:1970;
+ proxy_pass http://blog.163.com;
}
--- request
@@ -309,30 +238,21 @@
=== TEST 11: the http_check which does not use the upstream, with variable
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
ip_hash;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
resolver 8.8.8.8;
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
set $test "/";
- proxy_pass http://www.taobao.com$test;
+ proxy_pass http://blog.163.com$test;
}
--- request
@@ -340,25 +260,18 @@
--- response_body_like: ^<(.*)>$
=== TEST 12: the http_check test-single server, least conn
+--- skip_nginx
+2: < 1.2.2
--- http_config
upstream test{
- server 127.0.0.1:1970;
+ server blog.163.com:80;
least_conn;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -369,26 +282,19 @@
--- response_body_like: ^<(.*)>$
=== TEST 13: the http_check test-multi_server, least conn
+--- skip_nginx
+2: < 1.2.2
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
least_conn;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET / HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -399,26 +305,19 @@
--- response_body_like: ^<(.*)>$
=== TEST 14: the http_check test, least conn
+--- skip_nginx
+2: < 1.2.2
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
least_conn;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
+ check interval=3000 rise=1 fall=5 timeout=2000 type=http;
check_http_send "GET /foo HTTP/1.0\r\n\r\n";
check_http_expect_alive http_2xx http_3xx;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -430,106 +329,15 @@
--- response_body_like: ^.*$
=== TEST 15: the http_check without check directive, least conn
+--- skip_nginx
+2: < 1.2.2
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
+ server blog.163.com:80;
+ server blog.163.com:81;
least_conn;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
---- config
- location / {
- proxy_pass http://test;
- }
-
---- request
-GET /
---- response_body_like: ^<(.*)>$
-
-=== TEST 16: the http_check with port
---- http_config
- upstream test{
- server 127.0.0.1:1970;
- check interval=2000 rise=1 fall=1 timeout=1000 type=http port=1971;
- check_http_send "GET / HTTP/1.0\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
---- config
- location / {
- proxy_pass http://test;
- }
-
---- request
-GET /
---- error_code: 502
---- response_body_like: ^.*$
-
-=== TEST 17: the http_check with port
---- http_config
- upstream test{
- server 127.0.0.1:1971;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http port=1970;
- check_http_send "GET / HTTP/1.0\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
---- config
- location / {
- proxy_pass http://test;
- }
-
---- request
-GET /
---- error_code: 502
---- response_body_like: ^.*$
-
-=== TEST 18: the http_check with check_keepalive_requests configured
---- http_config
- upstream test{
- server 127.0.0.1:1970;
- check_keepalive_requests 10;
- check interval=3000 rise=1 fall=1 timeout=1000 type=http;
- check_http_send "GET / HTTP/1.0\r\nConnection: keep-alive\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/test/t/ssl_hello_check.t
^
|
@@ -1,3 +1,21 @@
+#
+#===============================================================================
+#
+# FILE: ssl_hello_check.t
+#
+# DESCRIPTION: test
+#
+# FILES: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Weibin Yao (http://yaoweibin.cn/), yaoweibin@gmail.com
+# COMPANY:
+# VERSION: 1.0
+# CREATED: 03/02/2010 03:18:28 PM
+# REVISION: ---
+#===============================================================================
+
+
# vi:filetype=perl
use lib 'lib';
@@ -19,12 +37,11 @@
server www.alipay.com:444;
server www.alipay.com:445;
- check interval=4000 rise=1 fall=1 timeout=2000 type=ssl_hello;
+ check interval=4000 rise=1 fall=5 timeout=2000 type=ssl_hello;
}
--- config
location / {
- proxy_ssl_session_reuse off;
proxy_pass https://test;
}
@@ -40,12 +57,11 @@
server www.alipay.com:445;
ip_hash;
- check interval=4000 rise=1 fall=1 timeout=2000 type=ssl_hello;
+ check interval=4000 rise=1 fall=5 timeout=2000 type=ssl_hello;
}
--- config
location / {
- proxy_ssl_session_reuse off;
proxy_pass https://test;
}
@@ -61,12 +77,11 @@
server www.alipay.com:444;
server www.alipay.com:445;
- check interval=4000 rise=1 fall=1 timeout=2000 type=ssl_hello;
+ check interval=4000 rise=1 fall=5 timeout=2000 type=ssl_hello;
}
--- config
location / {
- proxy_ssl_session_reuse off;
proxy_pass https://test;
}
@@ -75,6 +90,8 @@
--- response_body_like: ^<(.*)>[\r\n\s\t]*$
=== TEST 4: the ssl_hello_check test with least_conn
+--- skip_nginx
+2: < 1.2.2
--- http_config
upstream test{
server www.alipay.com:443;
@@ -82,50 +99,11 @@
server www.alipay.com:445;
least_conn;
- check interval=4000 rise=1 fall=1 timeout=2000 type=ssl_hello;
- }
-
---- config
- location / {
- proxy_ssl_session_reuse off;
- proxy_pass https://test;
- }
-
---- request
-GET /
---- response_body_like: ^<(.*)>[\r\n\s\t]*$
-
-=== TEST 5: the ssl_hello_check test with port 80
---- http_config
- upstream test{
- server www.alipay.com:443;
-
- check interval=4000 rise=1 fall=1 timeout=2000 type=http port=80;
- check_http_send "GET / HTTP/1.0\r\n\r\n";
- check_http_expect_alive http_2xx http_3xx;
- }
-
---- config
- location / {
- proxy_ssl_session_reuse off;
- proxy_pass https://test;
- }
-
---- request
-GET /
---- response_body_like: ^<(.*)>[\r\n\s\t]*$
-
-=== TEST 6: the ssl_hello_check test with port 443
---- http_config
- upstream test{
- server www.alipay.com:443;
-
- check interval=4000 rise=1 fall=1 timeout=2000 type=ssl_hello port=443;
+ check interval=4000 rise=1 fall=5 timeout=2000 type=ssl_hello;
}
--- config
location / {
- proxy_ssl_session_reuse off;
proxy_pass https://test;
}
@@ -133,22 +111,3 @@
GET /
--- response_body_like: ^<(.*)>[\r\n\s\t]*$
-=== TEST 7: the ssl_hello_check test with port 444
---- http_config
- upstream test{
- server www.alipay.com:443;
-
- check interval=4000 rise=1 fall=1 timeout=2000 type=ssl_hello port=444;
- }
-
---- config
- location / {
- proxy_ssl_session_reuse off;
- proxy_pass https://test;
- }
-
---- request
-GET /
---- error_code: 502
---- response_body_like: ^.*$
-
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/test/t/tcp_check.t
^
|
@@ -1,3 +1,21 @@
+#
+#===============================================================================
+#
+# FILE: tcp_check.t
+#
+# DESCRIPTION: test
+#
+# FILES: ---
+# BUGS: ---
+# NOTES: ---
+# AUTHOR: Weibin Yao (http://yaoweibin.cn/), yaoweibin@gmail.com
+# COMPANY:
+# VERSION: 1.0
+# CREATED: 03/02/2010 03:18:28 PM
+# REVISION: ---
+#===============================================================================
+
+
# vi:filetype=perl
use lib 'lib';
@@ -15,24 +33,15 @@
=== TEST 1: the tcp_check test
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
-
- check interval=3000 rise=1 fall=1 timeout=1000;
- }
-
- server {
- listen 1970;
+ server blog.163.com:80;
+ server blog.163.com:81;
+ server blog.163.com:82;
- location / {
- root html;
- index index.html index.htm;
- }
+ check interval=3000 rise=1 fall=5 timeout=1000;
}
--- config
- location / {
+ location / {
proxy_pass http://test;
}
@@ -43,25 +52,16 @@
=== TEST 2: the tcp_check test with ip_hash
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
+ server blog.163.com:80;
+ server blog.163.com:81;
+ server blog.163.com:82;
ip_hash;
- check interval=3000 rise=1 fall=1 timeout=1000 type=tcp;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
+ check interval=3000 rise=1 fall=5 timeout=1000 type=tcp;
}
--- config
- location / {
+ location / {
proxy_pass http://test;
}
@@ -72,25 +72,16 @@
=== TEST 3: the tcp_check test which don't use the checked upstream
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
+ server blog.163.com:80;
+ server blog.163.com:81;
+ server blog.163.com:82;
- check interval=3000 rise=1 fall=1 timeout=1000;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
+ check interval=3000 rise=1 fall=5 timeout=1000;
}
--- config
location / {
- proxy_pass http://127.0.0.1:1970;
+ proxy_pass http://blog.163.com;
}
--- request
@@ -98,25 +89,18 @@
--- response_body_like: ^<(.*)>$
=== TEST 3: the tcp_check test with least_conn;
+--- skip_nginx
+2: < 1.2.2
--- http_config
upstream test{
- server 127.0.0.1:1970;
- server 127.0.0.1:1971;
- server 127.0.0.1:1972;
+ server blog.163.com:80;
+ server blog.163.com:81;
+ server blog.163.com:82;
least_conn;
check interval=3000 rise=1 fall=5 timeout=1000 type=tcp;
}
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
--- config
location / {
proxy_pass http://test;
@@ -126,83 +110,3 @@
GET /
--- response_body_like: ^<(.*)>$
-=== TEST 4: the tcp_check test with port
---- http_config
- upstream test{
- server 127.0.0.1:1971;
-
- check interval=3000 rise=1 fall=1 timeout=1000 type=tcp port=1970;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
---- config
- location / {
- proxy_pass http://test;
- }
-
---- request
-GET /
---- error_code: 502
---- response_body_like: ^.*$
-
-=== TEST 5: the tcp_check test with port
---- http_config
- upstream test{
- server 127.0.0.1:1970;
-
- check interval=2000 rise=1 fall=1 timeout=1000 type=tcp port=1971;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
---- config
- location / {
- proxy_pass http://test;
- }
-
---- request
-GET /
---- error_code: 502
---- response_body_like: ^.*$
-
-=== TEST 5: the tcp_check test with check_keepalive_requests configured
---- http_config
- upstream test{
- server 127.0.0.1:1970;
-
- check_keepalive_requests 10;
- check interval=2000 rise=1 fall=1 timeout=1000 type=tcp;
- }
-
- server {
- listen 1970;
-
- location / {
- root html;
- index index.html index.htm;
- }
- }
-
---- config
- location / {
- proxy_pass http://test;
- }
-
---- request
-GET /
---- response_body_like: ^<(.*)>$
|
[-]
[+]
|
Changed |
nginx_upstream_check_module-master.tar.gz/upstream_fair.patch
^
|
@@ -1,37 +1,37 @@
-diff --git a/ngx_http_upstream_fair_module.c b/ngx_http_upstream_fair_module.c
-index a4419ca..af80bba 100644
---- a/ngx_http_upstream_fair_module.c
-+++ b/ngx_http_upstream_fair_module.c
+diff --git a/nginx-upstream-fair/ngx_http_upstream_fair_module.c b/nginx-upstream-fair/ngx_http_upstream_fair_module.c
+index 722b6c3..187a23b 100644
+--- a/nginx-upstream-fair/ngx_http_upstream_fair_module.c
++++ b/nginx-upstream-fair/ngx_http_upstream_fair_module.c
@@ -9,6 +9,10 @@
#include <ngx_core.h>
#include <ngx_http.h>
-+#if (NGX_HTTP_UPSTREAM_CHECK)
-+#include "ngx_http_upstream_check_module.h"
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
+#endif
+
typedef struct {
ngx_uint_t nreq;
ngx_uint_t total_req;
-@@ -42,6 +42,10 @@ typedef struct {
+@@ -42,6 +46,10 @@ typedef struct {
ngx_uint_t max_fails;
time_t fail_timeout;
-
-+#if (NGX_HTTP_UPSTREAM_CHECK)
+
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_uint_t check_index;
+#endif
+
time_t accessed;
ngx_uint_t down:1;
-
-@@ -474,6 +478,15 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
+
+@@ -474,6 +482,15 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
peers->peer[n].fail_timeout = server[i].fail_timeout;
peers->peer[n].down = server[i].down;
peers->peer[n].weight = server[i].down ? 0 : server[i].weight;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ peers->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -40,14 +40,14 @@
n++;
}
}
-@@ -524,6 +537,15 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
+@@ -524,6 +541,15 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
backup->peer[n].max_fails = server[i].max_fails;
backup->peer[n].fail_timeout = server[i].fail_timeout;
backup->peer[n].down = server[i].down;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ if (!server[i].down) {
+ backup->peer[n].check_index =
-+ ngx_http_upstream_check_add_peer(cf, us, &server[i].addrs[j]);
++ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
+ }
+ else {
+ backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
@@ -56,36 +56,35 @@
n++;
}
}
-@@ -580,6 +602,9 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
+@@ -580,6 +606,9 @@ ngx_http_upstream_init_fair_rr(ngx_conf_t *cf, ngx_http_upstream_srv_conf_t *us)
peers->peer[i].weight = 1;
peers->peer[i].max_fails = 1;
peers->peer[i].fail_timeout = 10;
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
+#endif
}
-
+
us->peer.data = peers;
-@@ -723,6 +748,12 @@ ngx_http_upstream_fair_try_peer(ngx_peer_connection_t *pc,
+@@ -721,6 +750,11 @@ ngx_http_upstream_fair_try_peer(ngx_peer_connection_t *pc,
peer = &fp->peers->peer[peer_id];
-
+
if (!peer->down) {
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
-+ "[upstream_fair] get fair peer, check_index: %ui",
-+ peer->check_index);
-+ if (!ngx_http_upstream_check_peer_down(peer->check_index)) {
++ "[upstream_fair] get fair peer, check_index: %ui", peer->check_index);
++ if (!ngx_http_check_peer_down(peer->check_index)) {
+#endif
if (peer->max_fails == 0 || peer->shared->fails < peer->max_fails) {
return NGX_OK;
}
-@@ -733,6 +764,9 @@ ngx_http_upstream_fair_try_peer(ngx_peer_connection_t *pc,
+@@ -731,6 +765,9 @@ ngx_http_upstream_fair_try_peer(ngx_peer_connection_t *pc,
peer->shared->fails = 0;
return NGX_OK;
}
-+#if (NGX_HTTP_UPSTREAM_CHECK)
++#if (NGX_UPSTREAM_CHECK_MODULE)
+ }
+#endif
}
-
+
return NGX_BUSY;
|
|
Deleted |
ngx_cache_purge-2.3.tar.gz
^
|
|
Deleted |
ngx_cache_purge.tar.gz
^
|
|
Deleted |
ngx_pagespeed-latest-testing.zip
^
|
|
Deleted |
ngx_pagespeed-latest-testing.zip.old
^
|
[-]
[+]
|
Deleted |
pagespeed.conf
^
|
@@ -1,53 +0,0 @@
-pagespeed off;
-
-
-# Configuring PageSpeed Filters
-pagespeed RewriteLevel PassThrough;
-
-# Needs to exist and be writable by nginx. Use tmpfs for best performance.
-pagespeed MemcachedServers "127.0.0.1:11211";
-pagespeed FileCachePath /var/ngx_pagespeed_cache;
-
-# PageSpeed Admin
-pagespeed StatisticsPath /ngx_pagespeed_statistics;
-pagespeed GlobalStatisticsPath /ngx_pagespeed_global_statistics;
-pagespeed MessagesPath /ngx_pagespeed_message;
-pagespeed ConsolePath /pagespeed_console;
-pagespeed AdminPath /pagespeed_admin;
-pagespeed GlobalAdminPath /pagespeed_global_admin;
-
-# PageSpeed Cache Purge
-pagespeed EnableCachePurge on;
-pagespeed PurgeMethod PURGE;
-
-
-# Ensure requests for pagespeed optimized resources go to the pagespeed handler
-# and no extraneous headers get set.
-location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" {
- add_header "" "";
-}
-
-
-# HTTPS Support
-# pagespeed FetchHttps enable;
-
-# PageSpeed Filters
-# CSS Minification
-# pagespeed EnableFilters combine_css,rewrite_css;
-
-# JS Minification
-# pagespeed EnableFilters combine_javascript,rewrite_javascript;
-
-# Images Optimization
-#pagespeed EnableFilters lazyload_images;
-#pagespeed EnableFilters rewrite_images;
-#pagespeed EnableFilters convert_jpeg_to_progressive,convert_png_to_jpeg,convert_jpeg_to_webp,convert_to_webp_lossless;
-
-# Remove comments from HTML
-#pagespeed EnableFilters remove_comments;
-# Remove WHITESPACE from HTML
-#pagespeed EnableFilters collapse_whitespace;
-
-
-# CDN Support
-#pagespeed MapRewriteDomain cdn.example.com www.example.com;
\ No newline at end of file
|
|
Deleted |
release-1.11.33.2-beta.zip
^
|
[-]
[+]
|
Deleted |
ssl-ciphersample
^
|
@@ -1,3 +0,0 @@
-ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
-ssl_ciphers EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:EECDH+RC4:RSA+RC4:!MD5;
-ssl_prefer_server_ciphers on;
|
[-]
[+]
|
Changed |
ssl.conf
^
|
@@ -1,3 +1,6 @@
+#
+# HTTPS server configuration
+#
#server {
# listen 443;
@@ -7,31 +10,15 @@
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
-# Don't use outdated SSLv3 protocol. Protects against BEAST and POODLE attacks.
-# ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
+# ssl_session_timeout 5m;
-# Use secure ciphers - courtesy Cloudflare
-# ssl_ciphers EECDH+CHACHA20:EECDH+CHACHA20-draft:EECDH+AES128:RSA+AES128:EECDH+AES256:RSA+AES256:EECDH+3DES:RSA+3DES:!MD5;
-# ssl_prefer_server_ciphers on;
-
-# ssl_session_cache shared:SSL:20m;
-# ssl_session_tickets on;
-# ssl_session_timeout 30m;
-
-# HSTS - Use HTTPS exclusively , uncomment one.
-# add_header Strict-Transport-Security "max-age=15768000; includeSubdomains";
-
-# create new one with: openssl dhparam -out dhparams.pem 2048
-# ssl_dhparam /etc/nginx/ssl/dhparams_2048.pem;
-
-# ssl_buffer_size 4k;
-
-# if you want extra security at the cost of considerable pressure on processor ..
-# ssl_ecdh_curve secp384r1;
+# ssl_protocols SSLv2 SSLv3 TLSv1;
+# ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
+# ssl_prefer_server_ciphers on;
# location / {
-# root html;
-# index index.html index.htm;
-# }
+# root html;
+# index index.html index.htm;
+# }
#}
|
|
Deleted |
v1.10.33.6-beta.zip
^
|