forked from yaoweibin/nginx_ajp_module
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ajp.patch
122 lines (105 loc) · 4.04 KB
/
ajp.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
diff -Naur nginx-stable/src/core/ngx_config.h nginx-working/src/core/ngx_config.h
--- nginx-stable/src/core/ngx_config.h 2012-01-18 16:07:43.000000000 +0100
+++ nginx-working/src/core/ngx_config.h 2012-02-16 20:32:25.711162684 +0100
@@ -11,6 +11,7 @@
#include <ngx_auto_headers.h>
+#include <nginx.h>
#if defined __DragonFly__ && !defined __FreeBSD__
#define __FreeBSD__ 4
diff -Naur nginx-stable/src/http/ngx_http_upstream.c nginx-working/src/http/ngx_http_upstream.c
--- nginx-stable/src/http/ngx_http_upstream.c 2012-02-13 16:41:11.000000000 +0100
+++ nginx-working/src/http/ngx_http_upstream.c 2012-02-16 20:27:34.850822069 +0100
@@ -4093,6 +4093,8 @@
|NGX_HTTP_UPSTREAM_WEIGHT
|NGX_HTTP_UPSTREAM_MAX_FAILS
|NGX_HTTP_UPSTREAM_FAIL_TIMEOUT
+ |NGX_HTTP_UPSTREAM_SRUN_ID
+ |NGX_HTTP_UPSTREAM_MAX_BUSY
|NGX_HTTP_UPSTREAM_DOWN
|NGX_HTTP_UPSTREAM_BACKUP);
if (uscf == NULL) {
@@ -4184,9 +4186,9 @@
ngx_http_upstream_srv_conf_t *uscf = conf;
time_t fail_timeout;
- ngx_str_t *value, s;
+ ngx_str_t *value, s, id;
ngx_url_t u;
- ngx_int_t weight, max_fails;
+ ngx_int_t weight, max_fails, max_busy;
ngx_uint_t i;
ngx_http_upstream_server_t *us;
@@ -4223,7 +4225,10 @@
weight = 1;
max_fails = 1;
+ max_busy = 0;
fail_timeout = 10;
+ id.data = (u_char *) "a";
+ id.len = sizeof("a") - 1;
for (i = 2; i < cf->args->nelts; i++) {
@@ -4257,6 +4262,21 @@
continue;
}
+ if (ngx_strncmp(value[i].data, "max_busy=", 9) == 0) {
+
+ if (!(uscf->flags & NGX_HTTP_UPSTREAM_MAX_BUSY)) {
+ goto invalid;
+ }
+
+ max_busy = ngx_atoi(&value[i].data[9], value[i].len - 9);
+
+ if (max_busy == NGX_ERROR) {
+ goto invalid;
+ }
+
+ continue;
+ }
+
if (ngx_strncmp(value[i].data, "fail_timeout=", 13) == 0) {
if (!(uscf->flags & NGX_HTTP_UPSTREAM_FAIL_TIMEOUT)) {
@@ -4275,6 +4295,22 @@
continue;
}
+ if (ngx_strncmp(value[i].data, "srun_id=", 8) == 0) {
+
+ if (!(uscf->flags & NGX_HTTP_UPSTREAM_SRUN_ID)) {
+ goto invalid;
+ }
+
+ id.len = value[i].len - 8;
+ id.data = &value[i].data[8];
+
+ if (id.len == 0) {
+ goto invalid;
+ }
+
+ continue;
+ }
+
if (ngx_strncmp(value[i].data, "backup", 6) == 0) {
if (!(uscf->flags & NGX_HTTP_UPSTREAM_BACKUP)) {
@@ -4304,7 +4340,9 @@
us->naddrs = u.naddrs;
us->weight = weight;
us->max_fails = max_fails;
+ us->max_busy = max_busy;
us->fail_timeout = fail_timeout;
+ us->srun_id = id;
return NGX_CONF_OK;
diff -Naur nginx-stable/src/http/ngx_http_upstream.h nginx-working/src/http/ngx_http_upstream.h
--- nginx-stable/src/http/ngx_http_upstream.h 2012-02-13 12:01:58.000000000 +0100
+++ nginx-working/src/http/ngx_http_upstream.h 2012-02-16 20:28:23.366503079 +0100
@@ -90,6 +90,8 @@
ngx_uint_t weight;
ngx_uint_t max_fails;
time_t fail_timeout;
+ ngx_uint_t max_busy;
+ ngx_str_t srun_id;
unsigned down:1;
unsigned backup:1;
@@ -102,6 +104,8 @@
#define NGX_HTTP_UPSTREAM_FAIL_TIMEOUT 0x0008
#define NGX_HTTP_UPSTREAM_DOWN 0x0010
#define NGX_HTTP_UPSTREAM_BACKUP 0x0020
+#define NGX_HTTP_UPSTREAM_SRUN_ID 0x0040
+#define NGX_HTTP_UPSTREAM_MAX_BUSY 0x0080
struct ngx_http_upstream_srv_conf_s {