Skip to content

Commit e2f31f3

Browse files
committed
chomp the space in the end of line
1 parent 7a4fd30 commit e2f31f3

9 files changed

+238
-238
lines changed

check.patch

+26-26
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,18 @@ index fd9ecbe..d3849b6 100644
55
@@ -9,6 +9,10 @@
66
#include <ngx_core.h>
77
#include <ngx_http.h>
8-
8+
99
+#if (NGX_UPSTREAM_CHECK_MODULE)
1010
+#include "ngx_http_upstream_check_handler.h"
1111
+#endif
1212
+
13-
13+
1414
typedef struct {
1515
/* the round robin data must be first */
1616
@@ -182,6 +186,12 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
17-
17+
1818
if (!peer->down) {
19-
19+
2020
+#if (NGX_UPSTREAM_CHECK_MODULE)
2121
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
2222
+ "get ip_hash peer, check_index: %ui",
@@ -34,7 +34,7 @@ index fd9ecbe..d3849b6 100644
3434
+ }
3535
+#endif
3636
}
37-
37+
3838
iphp->rrp.tried[n] |= m;
3939
diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
4040
index afc9b2e..1c0344e 100644
@@ -43,11 +43,11 @@ index afc9b2e..1c0344e 100644
4343
@@ -9,6 +9,9 @@
4444
#include <ngx_core.h>
4545
#include <ngx_http.h>
46-
46+
4747
+#if (NGX_UPSTREAM_CHECK_MODULE)
4848
+#include "ngx_http_upstream_check_handler.h"
4949
+#endif
50-
50+
5151
static ngx_int_t ngx_http_upstream_cmp_servers(const void *one,
5252
const void *two);
5353
@@ -75,6 +78,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
@@ -57,7 +57,7 @@ index afc9b2e..1c0344e 100644
5757
+
5858
+#if (NGX_UPSTREAM_CHECK_MODULE)
5959
+ if (!server[i].down) {
60-
+ peers->peer[n].check_index =
60+
+ peers->peer[n].check_index =
6161
+ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
6262
+ }
6363
+ else {
@@ -75,7 +75,7 @@ index afc9b2e..1c0344e 100644
7575
+
7676
+#if (NGX_UPSTREAM_CHECK_MODULE)
7777
+ if (!server[i].down) {
78-
+ backup->peer[n].check_index =
78+
+ backup->peer[n].check_index =
7979
+ ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
8080
+ }
8181
+ else {
@@ -94,7 +94,7 @@ index afc9b2e..1c0344e 100644
9494
+ peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
9595
+#endif
9696
}
97-
97+
9898
us->peer.data = peers;
9999
@@ -302,6 +330,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
100100
peers->peer[0].current_weight = 1;
@@ -103,9 +103,9 @@ index afc9b2e..1c0344e 100644
103103
+#if (NGX_UPSTREAM_CHECK_MODULE)
104104
+ peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
105105
+#endif
106-
106+
107107
} else {
108-
108+
109109
@@ -334,6 +365,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
110110
peers->peer[i].current_weight = 1;
111111
peers->peer[i].max_fails = 1;
@@ -115,9 +115,9 @@ index afc9b2e..1c0344e 100644
115115
+#endif
116116
}
117117
}
118-
118+
119119
@@ -411,7 +445,11 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
120-
120+
121121
if (rrp->peers->single) {
122122
peer = &rrp->peers->peer[0];
123123
-
@@ -127,15 +127,15 @@ index afc9b2e..1c0344e 100644
127127
+ }
128128
+#endif
129129
} else {
130-
130+
131131
/* there are several peers */
132132
@@ -438,6 +476,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
133-
133+
134134
if (!peer->down) {
135-
135+
136136
+#if (NGX_UPSTREAM_CHECK_MODULE)
137137
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
138-
+ "get rr peer, check_index: %ui",
138+
+ "get rr peer, check_index: %ui",
139139
+ peer->check_index);
140140
+ if (!ngx_http_check_peer_down(peer->check_index)) {
141141
+#endif
@@ -149,13 +149,13 @@ index afc9b2e..1c0344e 100644
149149
+#if (NGX_UPSTREAM_CHECK_MODULE)
150150
+ }
151151
+#endif
152-
152+
153153
peer->current_weight = 0;
154-
154+
155155
@@ -486,6 +533,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
156-
156+
157157
if (!peer->down) {
158-
158+
159159
+#if (NGX_UPSTREAM_CHECK_MODULE)
160160
+ ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
161161
+ "get rr peer2, check_index: %ui",
@@ -172,21 +172,21 @@ index afc9b2e..1c0344e 100644
172172
+#if (NGX_UPSTREAM_CHECK_MODULE)
173173
+ }
174174
+#endif
175-
175+
176176
peer->current_weight = 0;
177-
177+
178178
diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h
179179
index 6d285ab..354cca2 100644
180180
--- a/src/http/ngx_http_upstream_round_robin.h
181181
+++ b/src/http/ngx_http_upstream_round_robin.h
182182
@@ -28,6 +28,10 @@ typedef struct {
183183
ngx_uint_t max_fails;
184184
time_t fail_timeout;
185-
185+
186186
+#if (NGX_UPSTREAM_CHECK_MODULE)
187187
+ ngx_uint_t check_index;
188188
+#endif
189189
+
190190
ngx_uint_t down; /* unsigned down:1; */
191-
191+
192192
#if (NGX_HTTP_SSL)

config

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ if [ $ngx_found = yes ]; then
1515
HTTP_MODULES="$HTTP_MODULES ngx_http_upstream_check_module"
1616
NGX_ADDON_DEPS="$NGX_ADDON_DEPS $ngx_feature_deps"
1717
NGX_ADDON_SRCS="$NGX_ADDON_SRCS $ngx_check_src"
18-
else
18+
else
1919
cat << END
2020
$0: error: the ngx_http_upstream_check_module addon error.
2121
END

http_response_parse.c

+26-26
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ static const int http_parser_en_main = 1;
3434

3535
int http_parser_init(http_parser *parser) {
3636
int cs = 0;
37-
37+
3838
#line 39 "http_response_parse.c"
3939
{
4040
cs = http_parser_start;
@@ -47,7 +47,7 @@ int http_parser_init(http_parser *parser) {
4747
parser->mark = 0;
4848
parser->nread = 0;
4949
parser->field_len = 0;
50-
parser->field_start = 0;
50+
parser->field_start = 0;
5151

5252
return(1);
5353
}
@@ -63,7 +63,7 @@ size_t http_parser_execute(http_parser *parser, const char *buffer, size_t len,
6363
p = buffer + off;
6464
pe = buffer + len;
6565

66-
66+
6767
#line 68 "http_response_parse.c"
6868
{
6969
if ( p == pe )
@@ -144,7 +144,7 @@ case 9:
144144
goto st0;
145145
tr9:
146146
#line 36 "http_response_parse.rl"
147-
{
147+
{
148148
if(parser->http_version != NULL)
149149
parser->http_version(parser->data, PTR_TO(mark), LEN(mark, p));
150150
}
@@ -279,8 +279,8 @@ case 16:
279279
goto st0;
280280
tr19:
281281
#line 51 "http_response_parse.rl"
282-
{
283-
parser->body_start = p - buffer + 1;
282+
{
283+
parser->body_start = p - buffer + 1;
284284
if(parser->header_done != NULL)
285285
parser->header_done(parser->data, p + 1, pe - p - 1);
286286
{p++; cs = 20; goto _out;}
@@ -327,7 +327,7 @@ case 17:
327327
goto st0;
328328
tr21:
329329
#line 24 "http_response_parse.rl"
330-
{
330+
{
331331
parser->field_len = LEN(field_start, p);
332332
}
333333
goto st18;
@@ -358,25 +358,25 @@ case 19:
358358
goto tr26;
359359
goto st19;
360360
}
361-
_test_eof2: cs = 2; goto _test_eof;
362-
_test_eof3: cs = 3; goto _test_eof;
363-
_test_eof4: cs = 4; goto _test_eof;
364-
_test_eof5: cs = 5; goto _test_eof;
365-
_test_eof6: cs = 6; goto _test_eof;
366-
_test_eof7: cs = 7; goto _test_eof;
367-
_test_eof8: cs = 8; goto _test_eof;
368-
_test_eof9: cs = 9; goto _test_eof;
369-
_test_eof10: cs = 10; goto _test_eof;
370-
_test_eof11: cs = 11; goto _test_eof;
371-
_test_eof12: cs = 12; goto _test_eof;
372-
_test_eof13: cs = 13; goto _test_eof;
373-
_test_eof14: cs = 14; goto _test_eof;
374-
_test_eof15: cs = 15; goto _test_eof;
375-
_test_eof16: cs = 16; goto _test_eof;
376-
_test_eof20: cs = 20; goto _test_eof;
377-
_test_eof17: cs = 17; goto _test_eof;
378-
_test_eof18: cs = 18; goto _test_eof;
379-
_test_eof19: cs = 19; goto _test_eof;
361+
_test_eof2: cs = 2; goto _test_eof;
362+
_test_eof3: cs = 3; goto _test_eof;
363+
_test_eof4: cs = 4; goto _test_eof;
364+
_test_eof5: cs = 5; goto _test_eof;
365+
_test_eof6: cs = 6; goto _test_eof;
366+
_test_eof7: cs = 7; goto _test_eof;
367+
_test_eof8: cs = 8; goto _test_eof;
368+
_test_eof9: cs = 9; goto _test_eof;
369+
_test_eof10: cs = 10; goto _test_eof;
370+
_test_eof11: cs = 11; goto _test_eof;
371+
_test_eof12: cs = 12; goto _test_eof;
372+
_test_eof13: cs = 13; goto _test_eof;
373+
_test_eof14: cs = 14; goto _test_eof;
374+
_test_eof15: cs = 15; goto _test_eof;
375+
_test_eof16: cs = 16; goto _test_eof;
376+
_test_eof20: cs = 20; goto _test_eof;
377+
_test_eof17: cs = 17; goto _test_eof;
378+
_test_eof18: cs = 18; goto _test_eof;
379+
_test_eof19: cs = 19; goto _test_eof;
380380

381381
_test_eof: {}
382382
_out: {}

http_response_parse.rl

+6-6
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515
/** Machine **/
1616

1717
%%{
18-
18+
1919
machine http_parser;
2020

2121
action mark {MARK(mark, fpc); }
2222

2323
action start_field { MARK(field_start, fpc); }
24-
action write_field {
24+
action write_field {
2525
parser->field_len = LEN(field_start, fpc);
2626
}
2727

@@ -33,7 +33,7 @@
3333
}
3434
}
3535

36-
action http_version {
36+
action http_version {
3737
if(parser->http_version != NULL)
3838
parser->http_version(parser->data, PTR_TO(mark), LEN(mark, fpc));
3939
}
@@ -48,8 +48,8 @@
4848
parser->reason_phrase(parser->data, PTR_TO(mark), LEN(mark,fpc));
4949
}
5050

51-
action done {
52-
parser->body_start = fpc - buffer + 1;
51+
action done {
52+
parser->body_start = fpc - buffer + 1;
5353
if(parser->header_done != NULL)
5454
parser->header_done(parser->data, fpc + 1, pe - fpc - 1);
5555
fbreak;
@@ -99,7 +99,7 @@ int http_parser_init(http_parser *parser) {
9999
parser->mark = 0;
100100
parser->nread = 0;
101101
parser->field_len = 0;
102-
parser->field_start = 0;
102+
parser->field_start = 0;
103103

104104
return(1);
105105
}

0 commit comments

Comments
 (0)